| predict.WA | R Documentation |
Predict while-alive loss rates
## S3 method for class 'WA'
predict(object, newdata, t_seq, level = 0.95, ...)
object |
A |
newdata |
Data frame with columns matching the RHS of the fitted model.
Predictions are computed for the rows of |
t_seq |
Numeric vector of times at which to evaluate predictions. |
level |
Confidence level for pointwise intervals (default 0.95). |
... |
Unused. |
A data frame with columns id (row index in newdata),
t, mu (predicted while-alive rate), and CI columns lb, ub.
ex_dt <- crt_dt[crt_dt$cluster %in% c(1,2,3,4,7,10), ]
fit <- WA_fit(survival::Surv(time, status) ~ trt + Z1 + Z2,
data = ex_dt, id="id", cluster="cluster",
knots=seq(0, max(ex_dt$time), length.out=6),
tau_grid=seq(0, max(ex_dt$time), length.out=6),
basis="bz", degree=1, link="log",
w_recur=c(1,1), w_term=2, ipcw="km")
nd <- unique(ex_dt[, c("trt","Z1","Z2")])
pred <- predict(fit, newdata = nd, t_seq = seq(0, max(fit$tau_grid), by = 0.2))
head(pred)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.