insightsengineering / teal.modules.clinical

Provides teal modules for the standard clinical trials outputs
https://insightsengineering.github.io/teal.modules.clinical/
Other
33 stars 17 forks source link

tm_t_coxreg should work without covariates #12

Closed cicdguy closed 2 years ago

cicdguy commented 3 years ago
NEST/tern/pull/1252 was carried out, `tm_t_coxreg` still seems to be an error because when covariates are unselected because we pass covariates as c() to the template function instead of NULL as this design requires. Provenance: ``` Creator: imazubi ```
yangx61 commented 2 years ago

tm_t_coxreg seems to be OK in the most recent release when covariates are unselected. See below example with covariate passed as c() and selection as NULL.

source("https://raw.github.roche.com/NEST/nest_on_bee/master/bee_nest_utils.R")
bee_use_nest(release = "2021_10_13")

library(scda)
library(tern)
library(teal.modules.clinical)
library(teal.modules.general)

ADSL  <- synthetic_cdisc_data("latest")$adsl
ADTTE <- synthetic_cdisc_data("latest")$adtte
arm_ref_comp = list(
  ACTARMCD = list(
    ref = "ARM B",
    comp = c("ARM A", "ARM C")
  ),
  ARM = list(
    ref = "B: Placebo",
    comp = c("A: Drug X", "C: Combination")
  )
)

app <- init(
  data = cdisc_data(
    cdisc_dataset("ADSL", ADSL, code = 'ADSL  <- synthetic_cdisc_data("latest")$adsl'),
    cdisc_dataset("ADTTE", ADTTE, code = 'ADTTE <- synthetic_cdisc_data("latest")$adtte'),
    check = TRUE
  ),
  modules = root_modules(
    tm_t_coxreg(
      label = "Cox Reg.",
      dataname = "ADTTE",
      arm_var = choices_selected(c("ARM", "ARMCD", "ACTARMCD"), "ARM"),
      arm_ref_comp = arm_ref_comp,
      paramcd = choices_selected(
        value_choices(ADTTE, "PARAMCD", "PARAM"), "OS"
      ),
      strata_var = choices_selected(
        c("COUNTRY", "STRATA1", "STRATA2"), NULL
      ),
      cov_var    = choices_selected(
        c(), NULL
      ),
      multivariate = F
    )
  )
)
## Not run: 
shinyApp(app$ui, app$server)
nsteed15 commented 2 years ago

The app works without the covariates selected in the current version bee_use_nest(release = "2022_06_09")