set.seed(1)
n <- 10
T <- 4
id <- rep(1:n, each = T)
dp <- rep(1:T, times = n)
A <- rbinom(n * T, 1, 0.5)
M <- rbinom(n * T, 1, plogis(-0.2 + 0.3 * A + 0.1 * dp))
Y <- ave(0.5 * A + 0.6 * M + 0.1 * dp + rnorm(n * T), id)
dat <- data.frame(id, dp, A, M, Y)
fit_usr <- mcee_userfit_nuisance(dat, "id","dp","Y","A","M",
time_varying_effect_form = ~ dp,
p1 = rep(0.5, nrow(dat)),
q1 = runif(nrow(dat),.3,.7),
eta1 = rnorm(nrow(dat)), eta0 = rnorm(nrow(dat)),
mu1 = rnorm(nrow(dat)), mu0 = rnorm(nrow(dat)),
nu1 = rnorm(nrow(dat)), nu0 = rnorm(nrow(dat)))
Run the code above in your browser using DataLab