predict
and related methods for class ``spdur
''.
# S3 method for spdur
predict(
object,
newdata = NULL,
type = "response",
truncate = TRUE,
na.action = na.exclude,
...
)# S3 method for spdur
fitted(object, ...)
# S3 method for spdur
residuals(object, type = c("response"), ...)
Returns a data frame with 1 column corresponding to type
, in the same
order as the data frame used to estimate object
.
Object of class ``spdur
''.
Optional data for which to calculate fitted values, defaults to training data.
Quantity of interest to calculate. Default conditional hazard,
i.e. conditioned on observed survival up to time t
.
See below for list of values. For residuals
, the type of residual to
calculate
For conditional hazard, truncate values greater than 1.
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.
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.
# get model estimates
data(model.coups)
ch <- predict(model.coups)
head(fitted(model.coups))
head(residuals(model.coups))
Run the code above in your browser using DataLab