Package: rstpm2 1.6.6.1

Mark Clements

rstpm2: Smooth Survival Models, Including Generalized Survival Models

R implementation of generalized survival models (GSMs), smooth accelerated failure time (AFT) models and Markov multi-state models. For the GSMs, g(S(t|x))=eta(t,x) for a link function g, survival S at time t with covariates x and a linear predictor eta(t,x). The main assumption is that the time effect(s) are smooth <doi:10.1177/0962280216664760>. For fully parametric models with natural splines, this re-implements Stata's 'stpm2' function, which are flexible parametric survival models developed by Royston and colleagues. We have extended the parametric models to include any smooth parametric smoothers for time. We have also extended the model to include any smooth penalized smoothers from the 'mgcv' package, using penalized likelihood. These models include left truncation, right censoring, interval censoring, gamma frailties and normal random effects <doi:10.1002/sim.7451>, and copulas. For the smooth AFTs, S(t|x) = S_0(t*eta(t,x)), where the baseline survival function S_0(t)=exp(-exp(eta_0(t))) is modelled for natural splines for eta_0, and the time-dependent cumulative acceleration factor eta(t,x)=\int_0^t exp(eta_1(u,x)) du for log acceleration factor eta_1(u,x). The Markov multi-state models allow for a range of models with smooth transitions to predict transition probabilities, length of stay, utilities and costs, with differences, ratios and standardisation.

Authors:Mark Clements [aut, cre], Xing-Rong Liu [aut], Benjamin Christoffersen [aut], Paul Lambert [ctb], Lasse Hjort Jakobsen [ctb], Alessandro Gasparini [ctb], Gordon Smyth [cph], Patrick Alken [cph], Simon Wood [cph], Rhys Ulerich [cph]

rstpm2_1.6.6.1.tar.gz
rstpm2_1.6.6.1.tar.gz(r-4.5-noble)rstpm2_1.6.6.1.tar.gz(r-4.4-noble)
rstpm2_1.6.6.1.tgz(r-4.4-emscripten)rstpm2_1.6.6.1.tgz(r-4.3-emscripten)
rstpm2.pdf |rstpm2.html
rstpm2/json (API)
NEWS

# Install 'rstpm2' in R:
install.packages('rstpm2', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/mclements/rstpm2/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
Datasets:

fortranopenblascpp

8.56 score 1 stars 49 packages 135 scripts 7.6k downloads 4 mentions 45 exports 14 dependencies

Last updated 9 days agofrom:ccc97702fd. Checks:OK: 2. Indexed: no.

TargetResultDate
Doc / VignettesOKDec 22 2024
R-4.5-linux-x86_64OKDec 22 2024

Exports:addModelaftaftModelAICAICcanovabhazardBICcoefcoef<-confintconfint.predictnlcox.tvceformformulagsmgsm_designhazFunhrModelincrVarlinesmarkov_msmmarkov_sdensxnsxDplotpredictpredictnlpredictnl.defaultpstpm2qAICcratio_markov_msmresidualssimulatesmoothpwcsplineFunstandardisestpm2summaryupdatevcovvoptimisevoptimizevunirootzeroModel

Dependencies:bbmlebdsmatrixBHfastGHQuadlatticeMASSMatrixmgcvmvtnormnlmenumDerivRcppRcppArmadillosurvival

\texttt{rstpm2}: a simple guide

Rendered fromSimpleGuide.Rnwusingutils::Sweaveon Dec 22 2024.

Last update: 2019-10-15
Started: 2019-10-15

Introduction to the predictnl function

Rendered frompredictnl.Rnwusingutils::Sweaveon Dec 22 2024.

Last update: 2018-05-29
Started: 2018-05-29

Introduction to the rstpm2 Package

Rendered fromIntroduction.Rnwusingutils::Sweaveon Dec 22 2024.

Last update: 2019-11-05
Started: 2015-07-26

Predictions for Markov multi-state models

Rendered frommultistate.Rnwusingutils::Sweaveon Dec 22 2024.

Last update: 2019-10-15
Started: 2019-10-15

Readme and manuals

Help Manual

Help pageTopics
Parametric accelerated failure time model with smooth time functionsaft
Class "stpm2" ~~~aft-class lines,aft-method plot,aft,missing-method predict,aft-method predictnl,aft-method
Placemarker function for a baseline hazard function.bhazard
German breast cancer data from Stata.brcancer
Generic method to update the coef in an object.coef<-
Colon cancer.colon
Test for a time-varying effect in the 'coxph' modelcox.tvc
S3 method for to provide exponentiated coefficents with confidence intervals.eform eform.default eform.stpm2
gradient function (internal function)grad
Parametric and penalised generalised survival modelsgsm pstpm2 stpm2
Extract design information from an stpm2/gsm object and newdata for use in C++gsm_design
Defaults for the gsm callgsm.control
Utility that returns a function to increment a variable in a data-frame.incrVar
Legendre quadrature rule for n=200.legendre.quadrature.rule.200
S3 methods for lineslines.pstpm2 lines.stpm2
Predictions for continuous time, nonhomogeneous Markov multi-state models using parametric and penalised survival models.addModel aftModel as.data.frame.markov_msm as.data.frame.markov_msm_diff as.data.frame.markov_msm_ratio collapse_markov_msm diff diff.markov_msm hazFun hrModel markov_msm plot.markov_msm ratio_markov_msm rbind.markov_msm splineFun standardise standardise.markov_msm subset.markov_msm transform.markov_msm vcov.markov_msm zeroModel
Predictions for continuous time, nonhomogeneous Markov multi-state models using Aalen's additive hazards models.as.data.frame.markov_sde markov_sde plot.markov_sde standardise.markov_sde
Generate a Basis Matrix for Natural Cubic Splines (with eXtensions)nsx
Generate a Basis Matrix for the first derivative of Natural Cubic Splines (with eXtensions)nsxD
Calculate numerical delta method for non-linear predictions.numDeltaMethod
plots for an stpm2 fitplot,pstpm2-method plot,stpm2-method plot-methods
Background mortality rates for the colon dataset.popmort
Predicted values for an stpm2 or pstpm2 fitpredict,pstpm2-method predict,stpm2-method predict-methods
Evaluate a Spline Basispredict.nsx
Estimation of standard errors using the numerical delta method.confint.predictnl predict.formula predictnl predictnl.default predictnl.lm
~~ Methods for Function predictnl ~~predictnl,mle2-method predictnl-methods
Class "pstpm2"AIC,pstpm2-method AICc,pstpm2-method anova,pstpm2-method BIC,pstpm2-method eform,pstpm2-method lines,pstpm2-method plot,pstpm2,missing-method predictnl,pstpm2-method pstpm2-class qAICc,pstpm2-method summary,pstpm2-method
Residual values for an stpm2 or pstpm2 fitresiduals,pstpm2-method residuals,stpm2-method residuals-methods
Internal functions for the rstpm2 package.lhs lhs<- rhs rhs<-
Simulate values from an stpm2 or pstpm2 fitsimulate,pstpm2-method simulate,stpm2-method simulate-methods
Utility to use a smooth function in markov_msm based on piece-wise constant valuessmoothpwc
Class "stpm2" ~~~eform,stpm2-method lines,stpm2-method plot,stpm2,missing-method predictnl,stpm2-method stpm2-class summary,stpm2-method
Class '"tvcCoxph"'plot,tvcCoxph,missing-method tvcCoxph-class
Methods for Function updateupdate,stpm2-method update-methods
Vectorised One Dimensional Optimizationvoptimise voptimize
Vectorised One Dimensional Root (Zero) Findingvuniroot