Learn R Programming

spduration (version 0.17.2)

predict.spdur: Predict methods for spdur Objects

Description

predict and related methods for class ``spdur''.

Usage

# 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"), ...)

Value

Returns a data frame with 1 column corresponding to type, in the same order as the data frame used to estimate object.

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. For residuals, 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.

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.

Examples

Run this code
# 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