library(data.table)
df <- data.table::data.table(
"UserID" = c(112, 114, 213, 214, 115, 116, 117),
"t0" = c(18, 20, 18, 19, 21, 20, 18),
"t1" = c(30, 45, 57, 47, 36, 60, 55),
"lung" = c(0, 0, 1, 0, 1, 0, 0),
"dose" = c(0, 1, 1, 0, 1, 0, 1)
)
set.seed(3742)
df$rand <- floor(runif(nrow(df), min = 0, max = 5))
df$rand0 <- floor(runif(nrow(df), min = 0, max = 5))
df$rand1 <- floor(runif(nrow(df), min = 0, max = 5))
df$rand2 <- floor(runif(nrow(df), min = 0, max = 5))
names <- c("dose", "rand")
realization_columns <- matrix(c("rand0", "rand1", "rand2"), nrow = 1)
realization_index <- c("rand")
control <- list(
"ncores" = 1, "lr" = 0.75, "maxiter" = 1,
"halfmax" = 2, "epsilon" = 1e-6,
"deriv_epsilon" = 1e-6, "step_max" = 1.0,
"thres_step_max" = 100.0,
"verbose" = 0, "ties" = "breslow", "double_step" = 1
)
formula <- Cox(t0, t1, lung) ~ loglinear(dose, rand, 0) + multiplicative()
res <- CoxRun(formula, df, control = control)
Run the code above in your browser using DataLab