Confidence Intervals for Predicted Survival Time Quantiles of Accelerated Failure Time Models

Description

This function is one of the methods of add_quantile and is automatically called when an object of class survreg is passed to add_quantile.

Usage

## S3 method for class 'survreg'
df,
fit,
p = 0.5,
name = NULL,
yhatName = "median_pred",
confint = TRUE,
alpha = 0.1,
...
)


Arguments

 df A data frame of new data. fit An object of class survreg. Predictions are made with this object. p A real number between 0 and 1. Sets the probability level of the quantiles. name NULL or a character vector of length 3. If NULL, quantiles automatically will be named by add_quantile, otherwise, they will be named name. yhatName A string. Name of the vector of predictions. confint A logical. If TRUE, confidence intervals for the quantiles are also appended to df. alpha A number. Controls the confidence level of the confidence intervals if confint = TRUE. ... Additional arguments.

Details

add_quantile.survreg produces quantiles for the estimated distribution of survival times from a survreg object. Estimated quantiles (such as the median survival time) may be calculated for a range of distributions including lognormal, exponential, weibull, and loglogistic models. add_quantile.survreg can compute quantiles through a parametric method based on the Delta Method. Generally, this method performs well under a mild to moderate amount of censoring. Parametric intervals are calculated using a transformation of the confidence intervals produced by predict.survreg and are mathematically identical to intervals calculated by a manual Delta Method.

Unlike other add_quantile methods, add_quantile.survreg additionally produces confidence intervals for predicted quantiles by default. This may optionally be disabled by switching the confint argument.

Note: Due to a limitation, the Surv object must be specified in survreg function call. See the examples section for one way to do this.

Note: add_quantile.survreg cannot inspect the convergence of fit. Poor maximum likelihood estimates will result in poor confidence intervals. Inspect any warning messages given from survreg.

Value

A dataframe, df, with predicted medians, level p quantiles, and confidence intervals attached.

References

For descriptions of the log-location scale models supported: Meeker, William Q., and Luis A. Escobar. Statistical methods for reliability data. John Wiley & Sons, 2014. (Chapter 4)

For a description of the multivariate Delta method: Meeker, William Q., and Luis A. Escobar. Statistical methods for reliability data. John Wiley & Sons, 2014. (Appendix B.2)

For a description of Delta Method Confidence Intervals: Meeker, William Q., and Luis A. Escobar. Statistical methods for reliability data. John Wiley & Sons, 2014. (Chapter 8)

add_ci.survreg for confidence intervals survreg objects, add_pi.survreg for prediction intervals of survreg objects, and add_probs.survreg for survival probabilities of survreg objects.

Examples

## Define a data set:
df <- survival::stanford2
## remove a covariate with missing values:
df <- df[, 1:4]
## next, create the Surv object inside the survreg call:
fit <- survival::survreg(survival::Surv(time, status) ~ age + I(age^2),
data = df, dist = "lognormal")
## Calculate the level 0.75 quantile wit CIs for that quantile
add_quantile(df, fit, p = 0.75, name = c("quant", "lwr", "upr"))

## Try a weibull model for the same data:
fit2 <- survival::survreg(survival::Surv(time, status) ~ age + I(age^2),
data = df, dist = "weibull")
## Calculate the level 0.75 quantile with CIs for the quantile
add_quantile(df, fit2, p = 0.75, name = c("quant", "lwr", "upr"))



[Package ciTools version 0.6.1 Index]