The repository for the R package reslife.
reslife computes residual life functions (mean residual life, median residual life, and quantile residual life) for parametric survival distributions and fitted flexsurvreg survival models.
Installation
Stable release from CRAN
install.packages("reslife")Documentation & Website
- Package Website & Vignette: https://kaloklee.github.io/reslife/
- Methodology Paper: Wang, Z., Crawford, A., Lee, K. L., Lu, L., & Jaganathan, S. (2025). reslife: Residual Lifetime Analysis Tool in R. arXiv preprint arXiv:2308.07410.
Quick Example
library(reslife)
library(flexsurv)
library(survival)
# 1. Evaluate standalone distribution parameters
pars_weibull <- c(shape = 1.27, scale = 6.19)
residlife(values = c(1, 3, 5), distribution = "weibull", parameters = pars_weibull, type = "all")
# 2. Evaluate from a fitted flexsurvreg model
fit <- flexsurvreg(Surv(recyrs, censrec) ~ group, data = bc, dist = "weibull")
reslifefsr(obj = fit, life = 2, type = "all")