Learn R Programming

survdnn (version 0.7.5)

predict.survdnn: Predict from a survdnn Model

Description

Generate predictions from a fitted `survdnn` model for new data. Supports linear predictors, survival probabilities at specified time points, or cumulative risk estimates.

Usage

# S3 method for survdnn
predict(object, newdata, times = NULL, type = c("survival", "lp", "risk"), ...)

Value

A numeric vector (if `type = "lp"` or `"risk"`), or a data frame (if `type = "survival"`) with one row per observation and one column per `times`.

Arguments

object

An object of class `"survdnn"` returned by [survdnn()].

newdata

A data frame of new observations to predict on.

times

Numeric vector of time points at which to compute survival or risk probabilities. Required if `type = "survival"` or `type = "risk"` for Cox/AFT models. For CoxTime, `times = NULL` is allowed when `type="survival"` and defaults to event times.

type

Character string specifying the type of prediction to return:

"lp"

Linear predictor. For `"cox"`/`"cox_l2"` this is a log-risk score (higher implies worse prognosis, consistent with training sign convention). For `"aft"`, this is the predicted location parameter \(\mu(x)\) on the log-time scale. For `"coxtime"`, this is \(g(t_0, x)\) evaluated at a reference time \(t_0\) (the first event time).

"survival"

Predicted survival probabilities at each value of `times`.

"risk"

Cumulative risk (1 - survival) at **a single** time point.

...

Currently ignored (for future extensions).