predict.ah: Prediction Based on the Fitted Additive Hazards Model

Description Usage Arguments Value See Also Examples

Description

This function predicts a subject's overall hazard rates at given time points based on this subject's covariate values. The prediction function is an additive hazards model fitted using ah.

Usage

1
2
## S3 method for class 'ah'
predict(object, newdata, newtime, ...)

Arguments

object

an object of class inhering from ah.

newdata

a dataframe of an individual's predictors.

newtime

a given sequence of time points at which the prediction is performed. The time should be on the same scale as the survival time in Surv.

...

further arguments passed to or from other methods.

Value

A dataframe including the time points for prediction, predicted values and their standard errors.

See Also

ah for fitting the additive hazards model, nwtsco for the description of nwtsco dataset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(survival)
###  fit the additive hazards model to the data
nwts<- nwtsco[1:100,]
fit <- ah(Surv(trel,relaps) ~ age + instit, data = nwts,  ties = FALSE, robust = FALSE)

###  see the covariate names in the prediction function
fit$call
###  the newdata should be a dataframe
###  the variable names are the same as the covariate names in
###  the prediction function
newdata <- data.frame(age=60, instit =1)

###  an alternative way to give the newdata
newdata <- nwtsco[101,]

###  based on this subject's covariate values, the function predicts  individual specific
###  hazard rates at time points 3 and 5
predict(fit, newdata, newtime = c(3,5))

Example output

ah(formula = Surv(trel, relaps) ~ age + instit, data = nwts, 
    robust = FALSE, ties = FALSE)
  time         L       L.se
1    3 0.2292466 0.01877927
2    5 0.2268009 0.02711817

addhazard documentation built on May 2, 2019, 9:40 a.m.