# `h_coxreg_univar_formulas`
## Simple formulas.
h_coxreg_univar_formulas(
variables = list(
time = "time", event = "status", arm = "armcd", covariates = c("X", "y")
)
)
## Addition of an optional strata.
h_coxreg_univar_formulas(
variables = list(
time = "time", event = "status", arm = "armcd", covariates = c("X", "y"),
strata = "SITE"
)
)
## Inclusion of the interaction term.
h_coxreg_univar_formulas(
variables = list(
time = "time", event = "status", arm = "armcd", covariates = c("X", "y"),
strata = "SITE"
),
interaction = TRUE
)
## Only covariates fitted in separate models.
h_coxreg_univar_formulas(
variables = list(
time = "time", event = "status", covariates = c("X", "y")
)
)
# `h_coxreg_multivar_formula`
h_coxreg_multivar_formula(
variables = list(
time = "AVAL", event = "event", arm = "ARMCD", covariates = c("RACE", "AGE")
)
)
# Addition of an optional strata.
h_coxreg_multivar_formula(
variables = list(
time = "AVAL", event = "event", arm = "ARMCD", covariates = c("RACE", "AGE"),
strata = "SITE"
)
)
# Example without treatment arm.
h_coxreg_multivar_formula(
variables = list(
time = "AVAL", event = "event", covariates = c("RACE", "AGE"),
strata = "SITE"
)
)
library(survival)
dta_simple <- data.frame(
time = c(5, 5, 10, 10, 5, 5, 10, 10),
status = c(0, 0, 1, 0, 0, 1, 1, 1),
armcd = factor(LETTERS[c(1, 1, 1, 1, 2, 2, 2, 2)], levels = c("A", "B")),
var1 = c(45, 55, 65, 75, 55, 65, 85, 75),
var2 = c("F", "M", "F", "M", "F", "M", "F", "U")
)
mod <- coxph(Surv(time, status) ~ armcd + var1, data = dta_simple)
result <- h_coxreg_univar_extract(
effect = "armcd", covar = "armcd", mod = mod, data = dta_simple
)
result
mod <- coxph(Surv(time, status) ~ armcd + var1, data = dta_simple)
result <- h_coxreg_multivar_extract(
var = "var1", mod = mod, data = dta_simple
)
result
Run the code above in your browser using DataLab