predict() gives the linear predictor, the relative subdistribution hazard, or the cumulative
incidence of the modeled cause for new subjects (or for the subjects the model was fit to).
The linear predictor is centered at the covariate means of the fit, and the cumulative
incidence is \(1 - \exp\{-H_0(t) \exp(\eta)\}\), with \(H_0\) the Breslow estimate of the
baseline cumulative subdistribution hazard.
Arguments
- object
A
fine_gray()fit.- newdata
A data frame of covariates. The default uses the data the model was fit to.
- type
What to give:
"lp"(the default),"risk"(\(\exp(\eta)\)), or"cif".- times
For
type = "cif", the times to evaluate at. The default is the event times of the cause.- ...
Unused.
Value
For "lp" and "risk", a numeric vector with one value per subject. For "cif", a
data frame with one row per subject and time: subject (the row of newdata), time, and
estimate.
Examples
mgus <- data.frame(
time = c(30, 45, 60, 72, 80, 95, 110, 120, 130, 150, 160, 180, 200, 210, 220, 240),
status = c(1, 2, 0, 2, 1, 2, 0, 1, 2, 2, 0, 1, 1, 2, 0, 2),
age = c(62, 75, 58, 80, 66, 71, 59, 64, 77, 82, 60, 68, 55, 79, 63, 74)
)
mgus$event <- factor(mgus$status, levels = 0:2, labels = c("censor", "pcm", "death"))
fit <- fine_gray(Surv(time, event) ~ age, data = mgus, cause = "pcm")
predict(fit, newdata = data.frame(age = c(60, 75)), type = "risk")
#> [1] 2.3846906 0.4969946
predict(fit, newdata = data.frame(age = c(60, 75)), type = "cif", times = c(100, 200))
#> subject time estimate
#> 1 1 100 0.21347422
#> 2 1 200 0.61599266
#> 3 2 100 0.04881392
#> 4 2 200 0.18083387