## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup-------------------------------------------------------------------- Sys.setenv(OMP_THREAD_LIMIT = 1) # Reducing core use, to avoid accidental use of too many cores library(Colossus) library(data.table) ## ----------------------------------------------------------------------------- # Each model has entry and exit columns, t0 and t1 # Events are in a column called lung # The hazard ratio has both an exponential and linear dependence Model_Eq <- Cox(t0, t1, lung) ~ loglinear(dose0, dose1, 0) + linear(dose2, 1) + ME() Model_Eq <- Cox(t0, t1, lung) ~ loglinear(dose0, dose1) + linear(dose2, 1) df <- data.table( dose0 = 1:4, dose1 = 2:5, dose2 = 3:6, t0 = c(0, 0, 1, 0), t1 = 5:8, lung = c(1, 0, 0, 1) ) res <- get_form(Model_Eq, df, nthreads = 1) formula <- res$model new_data <- res$data