# NOT RUN {
## Set seed in order to have reproducibility of the bootstrap standard error estimate
set.seed(1234)
## Reshaping data from a long format to a suitable format
newdata <- dataprep_lt(data = longdata_lt, ID = id, time = t, W = w,
event = c, Z = c(z1, z2))
## Estimation of regression parameters only. No bootstrap variance estimation.
## with 'newdata'
fit_lt <- ciregic_lt(formula = Surv2(v = v, u = u, w = w, event = c) ~ z1 + z2, data = newdata,
alpha = c(1, 1), nboot = 0, do.par = FALSE)
fit_lt
## Bootstrap variance estimation based on 50 replications
fit_lt <- ciregic_lt(formula = Surv2(v = v, u = u, w = w, event = c) ~ z1 + z2, data = newdata,
alpha = c(1, 1), nboot = 50, do.par = FALSE)
# }
# NOT RUN {
## Note that the user can use parallel computing to decrease
## the computation time of the bootstrap variance-covariance
## estimation (e.g. nboot = 50)
## Summarize semiparametric regression model
summary(fit_lt)
## Predict and draw plot the cumulative incidence function evaluated at z1 = 1 and z2 = 0.5
mint <- fit_lt$tms[1]
maxt <- fit_lt$tms[2]
pred <- predict(object = fit_lt, covp = c(1, 0.5),
times = seq(mint, maxt, by = (maxt - mint) / 99))
pred
plot(pred$t, pred$cif1, type = "l", ylim = c(0, 1))
points(pred$t, pred$cif2, type = "l", col = 2)
# }
Run the code above in your browser using DataLab