predict.WA: Predict while-alive loss rates

predict.WAR Documentation

Predict while-alive loss rates

Description

Predict while-alive loss rates

Usage

## S3 method for class 'WA'
predict(object, newdata, t_seq, level = 0.95, ...)

Arguments

object

A "WA" object.

newdata

Data frame with columns matching the RHS of the fitted model. Predictions are computed for the rows of newdata.

t_seq

Numeric vector of times at which to evaluate predictions.

level

Confidence level for pointwise intervals (default 0.95).

...

Unused.

Value

A data frame with columns id (row index in newdata), t, mu (predicted while-alive rate), and CI columns lb, ub.

Examples


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)


WAreg documentation built on March 6, 2026, 5:07 p.m.

Related to predict.WA in WAreg...