Skip to content

rstpm2

Smooth Survival Models, Including Generalized Survival Models

v1.7.1 · Nov 12, 2025 · GPL-2 | GPL-3

Description

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.

Downloads

11.2K

Last 30 days

1183rd

35.8K

Last 90 days

158.4K

Last year

Trend: -3.1% (30d vs prior 30d)

CRAN Check Status

2 NOTE
12 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 NOTE
r-oldrel-macos-x86_64 NOTE
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (2 non-OK)
NOTE r-oldrel-macos-arm64

installed package size

installed size is 24.5Mb
  sub-directories of 1Mb or more:
    libs  22.3Mb
NOTE r-oldrel-macos-x86_64

installed package size

installed size is 25.3Mb
  sub-directories of 1Mb or more:
    libs  23.1Mb

Additional Issues

rcnst Details →

Check History

NOTE 12 OK · 2 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026
NOTE r-oldrel-macos-arm64

installed package size

installed size is 24.5Mb
  sub-directories of 1Mb or more:
    libs  22.3Mb
NOTE r-oldrel-macos-x86_64

installed package size

installed size is 25.3Mb
  sub-directories of 1Mb or more:
    libs  23.1Mb

Reverse Dependencies (16)

depends

Dependency Network

Dependencies Reverse dependencies survival Rcpp mgcv bbmle fastGHQuad mvtnorm numDeriv lsoda cuRe EventPredInCure JointFPM TukeyGH77 afthd eventPred expertsurv flexsurv biostat3 fastml marginaleffects mexhaz multinma rsimsum simsurv +1 more reverse deps rstpm2

Version History

new 1.7.1 Mar 10, 2026
updated 1.7.1 ← 1.7.0 diff Nov 12, 2025
updated 1.7.0 ← 1.6.9 diff Aug 26, 2025
updated 1.6.9 ← 1.6.7 diff Jul 24, 2025
updated 1.6.7 ← 1.6.6.1 diff May 10, 2025
updated 1.6.6.1 ← 1.6.6 diff Dec 20, 2024
updated 1.6.6 ← 1.6.5 diff Oct 28, 2024
updated 1.6.5 ← 1.6.4 diff Aug 19, 2024
updated 1.6.4 ← 1.6.3 diff Aug 18, 2024
updated 1.6.3 ← 1.6.2 diff Dec 4, 2023
updated 1.6.2 ← 1.6.1 diff Mar 7, 2023
updated 1.6.1 ← 1.5.9 diff Feb 27, 2023
updated 1.5.9 ← 1.5.8 diff Jan 6, 2023
updated 1.5.8 ← 1.5.7 diff Oct 16, 2022
updated 1.5.7 ← 1.5.6 diff Jul 13, 2022
updated 1.5.6 ← 1.5.5 diff May 9, 2022
updated 1.5.5 ← 1.5.2 diff Apr 18, 2022
updated 1.5.2 ← 1.5.1 diff Mar 2, 2021
updated 1.5.1 ← 1.5.0 diff Nov 5, 2019
updated 1.5.0 ← 1.4.5 diff Oct 14, 2019