predict and related methods for class “spdur”.
Arguments
- object
Object of class “
spdur”.- newdata
Optional data for which to calculate fitted values, defaults to training data.
- type
Quantity of interest to calculate. Default conditional hazard, i.e. conditioned on observed survival up to time
t. See below for list of values. Forresiduals, the type of residual to calculate- truncate
For conditional hazard, truncate values greater than 1.
- na.action
Function determining what should be done with missing values in newdata. The default is to predict NA (
na.exclude).- ...
not used, for compatibility with generic function.
Value
Returns a data frame with 1 column corresponding to type, in the same
order as the data frame used to estimate object.
Details
Calculates various types of probabilities, where “conditional” is used in
reference to conditioning on the observed survival time of a spell up to
time \(t\), in addition to conditioning on any variables included in the
model (which is always done). Valid values for the type option
include:
“conditional risk”: \(Pr(Cure=0|Z\gamma, T>t)\)
“conditional cure”: \(Pr(Cure=1|Z\gamma, T>t)\)
“hazard”: \(Pr(T=t|T>t, C=0, X\beta) * Pr(Cure=0|Z\gamma)\)
“failure”: \(Pr(T=t|T>t-1, C=0, X\beta) * Pr(Cure=0|Z\gamma)\)
“unconditional risk”: \(Pr(Cure=0|Z\gamma)\)
“unconditional cure”: \(Pr(Cure=1|Z\gamma)\)
“conditional hazard” or “response”: \(Pr(T=t|T>t, C=0, X\beta) * Pr(Cure=0|Z\gamma, T>t)\)
“conditional failure”: \(Pr(T=t|T>t-1, C=0, X\beta) * Pr(Cure=0|Z\gamma, T>t)\)
The vector \(Z\gamma\) indicates the cure/at risk equation covariate vector, while \(X\beta\) indicates the duration equation covariate vector.
Note
See forecast.spdur for producing forecasts when future
covariate values are unknown.
Examples
# get model estimates
data(model.coups)
ch <- predict(model.coups)
head(fitted(model.coups))
#> [1] 0.016552005 0.005726432 0.003026371 0.002446806 0.016492801 0.036707531
head(residuals(model.coups))
#> 5007 5006 5570 5039 4751 4877
#> -0.016552005 -0.005726432 -0.003026371 -0.002446806 -0.016492801 -0.036707531
