predict.ahaz {ahaz}R Documentation

Prediction methods for ahaz

Description

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

Usage

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

Arguments

object

The result of an ahaz fit.

newX

Optional new matrix of covariates at which to do predictions. Currently only supported for type="lp".

type

Type of prediction. Options are the regression coefficients ("coef"), the linear predictor ("lp"), the martingale residuals ("residuals"), or the cumulative hazard ("cumhaz"). See the details.

beta

Optional vector of regression coefficients. If unspecified, the regression coefficients derived from object are used.

...

For future methods.

Details

The Breslow estimator of the baseline cumulative hazard is described in Lin & Ying (1994).

The regression coefficients \beta_0 in the semiparametric additive hazards model are obtained as the solution \hat{\beta} to a quadratic system of linear equations D\beta=d. The (integrated) martingale residuals \epsilon_i for i=1,...,n are vectors, of length corresponding to the number of covariates, so that

D(\hat{\beta}-\beta_0) -d \approx \epsilon_1+\cdots+\epsilon_n

The residuals estimate integrated martingales and are asymptotically distributed as mean-zero IID multivariate Gaussian. They can be used to derive a sandwich-type variance estimator for regression coefficients (implemented in summary.ahaz when robust=TRUE is specified). They can moreover be used for implementing consistent standard error estimation under clustering; or for implementing resampling-based inferential methods.

See Martinussen & Scheike (2006), Chapter 5.4 for details.

Value

For type="coef" and type="lp", a vector of predictions.

For type="coef", a matrix of (integrated) martingale residuals, with number of columns corresponding to the number of covariates.

For type="cumhaz", an object with S3 class "cumahaz" consisting of:

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).

References

Martinussen, T. & Scheike, T. H. & (2006). Dynamic Regression Models for Survival Data. Springer.

See Also

ahaz, summary.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[,15:24])

# Fit additive hazards regression model
fit <- ahaz(surv, X)

# Parameter estimates
coef(fit)

# Linear predictor, equivalent to X%*%coef(fit)
predict(fit,type="lp")

# Cumulative baseline hazard
cumahaz <- predict(fit, type="cumhaz")

# Residuals - model fit
resid <- predict(fit, type = "residuals")
# Decorrelate, standardize, and check QQ-plots
stdres <- apply(princomp(resid)$scores,2,function(x){x/sd(x)})
par(mfrow = c(2,2))
for(i in 1:4){
  qqnorm(stdres[,i])
  abline(c(0,1))
}

# Residuals - alternative variance estimation
resid <- residuals(fit)
cov1 <- summary(fit)$coef[,2]
invD <- solve(fit$D)
Best<-t(resid)%*%resid
cov2 <- invD %*% Best %*% invD
# Compare with (nonrobust) SEs from 'summary.ahaz'
plot(cov1, sqrt(diag(cov2)),xlab="Nonrobust",ylab="Robust")
abline(c(0,1))

[Package ahaz version 1.15 Index]