glmnetsurvfit.glmnetsurv: Compute survival curve and cumulative hazard from a glmnet...

View source: R/glmnetsurvfit.R

glmnetsurvfit.glmnetsurvR Documentation

Compute survival curve and cumulative hazard from a glmnet model through glmnetsurv

Description

Compute the predicted survivor and cumulative hazard function for a penalized Cox proportional hazard model.

Usage

## S3 method for class 'glmnetsurv'
glmnetsurvfit(fit, newdata, ...)

## S3 method for class 'glmnetsurv'
glmnetbasehaz(fit, centered = TRUE)

Arguments

fit

fitted glmnetsurv object

newdata

a matrix containing the variables appearing on the right hand side of the model formula of glmnetsurv model.

...

for future implementations

centered

if TRUE (default), return data from a predicted survival function at the mean values of the predictors, if FALSE returns prediction for all predictors equal to zero (baseline hazard).

Details

glmnetsurvfit and glmnetbasehaz functions produce survival curves and estimated cumulative hazard, respectively, for a glmnet model fitted through glmnetsurv. They both return the estimated survival probability and the estimated cumulative hazard, which are both Breslow estimate.

The glmnetbasehaz is an alias for glmnetsurvfit which simply computed the predicted survival estimates (baseline).

If the newdata argument is missing, the "average" survival or cumulative hazard estimates are produced with the predictor values equal to means of the data set. See survfit.coxph for warning against this. If the newdata is specified, then the returned object will contain a matrix of both survival and cumulative hazard estimates with each column for each row in the newdata.

Value

glmnetsurvfit and glmnetbasehaz return S3 objects of class glmnetsurvfit.glmnetsurv and glmnetbasehaz.glmnetsurv, respectively:

n

number of observations used in the fit.

events

total number of events of interest in the fit.

time

time points defined by the risk set.

n.risk

the number of individuals at risk at time t.

n.event

the number of events that occur at time t.

n.censor

the number of subjects who exit the risk set, without an event, at time t.

surv

a vector or a matrix of estimated survival function.

cumhaz, hazard

a vector or a matrix of estimated cumulative hazard.

s

lambda value.

call

the call that produced the object.

See Also

glmnet, plot.glmnetsurvfit

Examples

data(veteran, package="survival")
lam <- 0
alp <- 1
gmodel <- glmnetsurv(Surv(time, status) ~ factor(trt) + karno + diagtime + age + prior
	, data = veteran
	, alpha = alp
	, lambda = lam
)

# Survival estimate
gsurv <- glmnetsurvfit(fit = gmodel)

# Baseline survival estimate
gbsurv <- glmnetbasehaz(gmodel, centered = FALSE)


CYGUBICKO/glmnetpostsurv documentation built on Sept. 1, 2022, 7:26 p.m.