## Not run:
# theta <- seq(7,8.5,by=0.5)
# FOLLOW.D.DT <- defineIntervedTRT(data = data, theta = theta,
# ID = "StudyID", t = "X_intnum", I = "X_a1c",
# TRT = "X_exposure", CENS = "X_censor", MONITOR = "N.t",
# new.TRT.names = paste0("gstar",theta))
# ## End(Not run)
#-------------------------------------------------------------------
# EXAMPLE BASED ON SIMULATED DATA
#-------------------------------------------------------------------
require("data.table")
require("magrittr")
data(OdataCatCENS)
OdataDT <- as.data.table(OdataCatCENS, key=c(ID, t))
#-------------------------------------------------------------------
# Define the counterfactual dynamic treatment assignment
#-------------------------------------------------------------------
# Define two dynamic rules: dlow & dhigh
OdataDT <- defineIntervedTRT(OdataDT, theta = c(0,1), ID = "ID", t = "t", I = "highA1c",
CENS = "C", TRT = "TI", MONITOR = "N", tsinceNis1 = "lastNat1",
new.TRT.names = c("dlow", "dhigh"), return.allcolumns = TRUE)
Run the code above in your browser using DataLab