predict.ahazpen | R Documentation |
Compute regression coefficient estimates, linear predictor, cumulative hazard function, or integrated martingale residuals for a fitted penalized semiparametric additive hazards model.
## S3 method for class 'ahazpen' predict(object, newX, type=c("coef","lp","residuals","cumhaz"), lambda=NULL, ...) ## S3 method for class 'ahazpen' coef(object, ...)
object |
The result of an |
newX |
New matrix of covariates at which to do
predictions. |
lambda |
Value of lambda for at which predictions are
to be made. This argument is required for |
type |
The type of prediction. Options are the regression coefficients
(" |
... |
For future methods. |
See the details in predict.ahaz
for information on
the different types of predictions.
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). |
ahazpen
, print.ahazpen
,
plot.ahazpen
, predict.ahaz
, plot.cumahaz
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.