predict.spdur: Predict methods for spdur Objects

View source: R/predict.spdur.R

predict.spdurR Documentation

Predict methods for spdur Objects

Description

predict and related methods for class “spdur”.

Usage

## S3 method for class 'spdur'
predict(
  object,
  newdata = NULL,
  type = "response",
  truncate = TRUE,
  na.action = na.exclude,
  ...
)

## S3 method for class 'spdur'
fitted(object, ...)

## S3 method for class 'spdur'
residuals(object, type = c("response"), ...)

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.

Value

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

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

head(residuals(model.coups))


spduration documentation built on May 29, 2024, 1:30 a.m.