predict.ahazpen {ahaz}R Documentation

Prediction methods for ahazpen

Description

Compute regression coefficient estimates, linear predictor, cumulative hazard function, or integrated martingale residuals for a fitted penalized semiparametric additive hazards model.

Usage

## S3 method for class 'ahazpen'
predict(object, newX, type=c("coef","lp","residuals","cumhaz"),
        lambda=NULL, ...)
## S3 method for class 'ahazpen'
coef(object, ...)

Arguments

object

The result of an ahazpen fit.

newX

New matrix of covariates at which to do predictions.
Required unless type="coef".

lambda

Value of lambda for at which predictions are to be made. This argument is required for type="residuals" and type="cumhaz". Since predictions rely on interpolations between lambda values, it is recommended not to use a lambda-value smaller than the minimum of object$lambda.

type

The type of prediction. Options are the regression coefficients ("coef"), the linear predictors ("lp"), the (integrated) martingale residuals ("residuals"), or the cumulative hazard ("cumhaz")

...

For future methods.

Details

See the details in predict.ahaz for information on the different types of predictions.

Value

For type="coef" and type="lp", a matrix of regression coefficients, respectively linear predictions for each value of the penalty parameter.

For type="residuals", a matrix of (integrated) martingale residuals associated with the nonzero penalized regression coefficients for a regularization parameter equal to lambda.

For type="cumhaz", an object with S3 class "cumahaz" based on the regression coefficients estimated for a regularization parameter equal to lambda, the object containing:

time

Jump times for the cumulative hazard estimate.

cumhaz

The cumulative hazard estimate.

event

Status at jump times (1 corresponds to death, 0 corresponds to entry/exit).

See Also

ahazpen, print.ahazpen, plot.ahazpen, predict.ahaz, plot.cumahaz.

Examples

data(sorlie)

set.seed(10101)

# Break ties
time <- sorlie$time+runif(nrow(sorlie))*1e-2

# Survival data + covariates
surv <- Surv(time,sorlie$status)
X <- as.matrix(sorlie[,3:ncol(sorlie)])

# Fit additive hazards regression model w/lasso penalty
fit <- ahazpen(surv, X, dfmax=100)

# Coefficients
beta <- predict(fit,X,lambda=0.08,type="coef")
barplot(as.numeric(beta))

# Linear predictions
linpred <- predict(fit,X,lambda=0.1,type="lp")
riskgrp <- factor(linpred < median(linpred))
plot(survfit(surv~riskgrp))

# Residuals
resid <- predict(fit, X, lambda=0.1, type = "residuals")
par(mfrow = c(1,2))
hist(resid[,1],main=colnames(resid)[1])
hist(resid[,2],main=colnames(resid)[2])

# Cumulative hazard
cumhaz <- predict(fit,X,lambda=0.1,type="cumhaz")
plot(cumhaz)



[Package ahaz version 1.14 Index]