Skip to content

rstpm2

1.7.1Package record

Smooth Survival Models, Including Generalized Survival Models

10packages dependsuggested by 10
173.3Kdownloads / year
31.7%test coverage
13/13flavors OK

Overview

About

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.

Install

Health

CRAN checks
13OK
Slowest check: 9.8 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK12 OK2026-04-25
  • NOTE12 OK, 2 NOTE2026-04-22
  • ERROR11 OK, 2 NOTE, 1 ERROR2026-04-18
Show 1 earlier changeHide 1 earlier change
  • NOTE12 OK, 2 NOTE2026-03-10
Advisories

none known

Documentation

In release 1.7.1
READMEYes · 323 wordsVignettesYes · 4 · dynamicNEWSYes · 100% structured · does not mention 1.7.1Citation fileYes · cites a publicationWebsitenot declared in DESCRIPTION
Help pages
35
Examples that run
91%21 run in a plain check · 2 never run
Exported functions with examples
75%
Documented parameters
90%
Return-value docs
100%
Help pages citing references
80%

Downloads

173.3K
CRAN downloads in the past year
Rank #904 · ~475/day · ~14.4K/mo
Daily download trend is not available in this view yet.
23.1K30 days
46.7K90 days
173.3K1 year
Compare downloads with other packages →
Also on2.7K r2u13 autocran7.5K conda_forge232 c2d4u

Repository

31Stars
12Forks
8Open issues
1Open PRs
6Releases
812Commits
13Commit identities
812 commits · Last activity 2025-08-27 · The default branch showed an older version (1.7.0) than CRAN on 2026-10-11
Responsiveness
How these are sampled
PRs merged (all time)
100%
Median days to close, 50 most recently updated closed issues
147
Median days to close, 50 most recently updated closed PRs
0
PracticesBeta

2 development-tooling and community-health practices detected across 2 families in the upstream repository

Checks run against github.com/mclements/rstpm2 on 2026-10-11.

Continuous integration (1)
GitHub Actions
Reproducibility and dev environment (1)
Makefile
How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
17 external dependencies (excludes base and recommended)

Installing rstpm2 adds 8 packages (6 with compiled code, 4.5 MB of source tarballs). Heaviest: Rcpp 1.8 MB, RcppArmadillo 1.0 MB, mvtnorm 1.0 MB.

Depends (4)
R >= 3.0.2methodssurvivalsplines
Imports (11)
graphicsRcppstatsmgcvbbmlefastGHQuadutilsparallelmvtnormnumDerivlsoda
LinkingTo (2)
Enhances (0)
none
Reverse dependencies
10direct
49indirect
Depends 1 · Imports 9
Suggested by 10
Show all 20 packagesHide all 20 packages
Depends, Imports or LinkingTo, most downloaded first
Suggests, most downloaded first

Datasets

People & History

People (10)
Author, Maintainer since 1.2.2 (2015)
Author · added in 1.5.2
Contributor · added in 1.4.4
Contributor · added in 1.4.4
Contributor
Copyright holder · added in 1.4.4
Copyright holder · added in 1.4.4
Copyright holder · added in 1.4.4
Copyright holder · added in 1.4.4
Releases (28)

Pick two releases to compare their code metrics.

Show 24 earlier eventsHide 24 earlier events
  • 1.5.8
    record
    2022-10-17 · diff ↗ ·
    added 1 export
    gsm_design
  • 1.5.7
    record
    2022-07-14 · diff ↗ ·
    added 1 export
    smoothpwc
  • 1.5.6
    record
    2022-05-10 · diff ↗
  • R
    R 4.2.0 released · 2022-04-22
  • 1.5.5
    record
    2022-04-19 · diff ↗ ·
    added 2 exports
    markov_sde, bhazard
  • R
    R 4.1.0 released · 2021-05-18
  • 1.5.2
    record
    2021-03-03 · diff ↗
  • R
    R 4.0.0 released · 2020-04-24
  • 1.5.1
    record
    2019-11-06 · diff ↗
  • 1.5.0
    record
    2019-10-15 · diff ↗ ·
    added 10 exports
    gsm, markov_msm, ratio_markov_msm, zeroModel, hrModel, aftModel, addModel, hazFun, splineFun, standardise
  • R
    R 3.6.0 released · 2019-04-26
  • 1.4.5
    record
    2019-01-17 · diff ↗
  • 1.4.4
    record
    2018-11-01 · diff ↗ ·
    added 1 export
    vuniroot
  • 1.4.2
    record
    2018-05-29 · diff ↗ ·
    added 5 exports
    eform, coef, confint, predictnl.default, confint.predictnl
  • R
    R 3.5.0 released · 2018-04-23
  • 1.4.1
    record
    2017-09-20 · diff ↗
  • 1.4.0
    record
    2017-08-31 · diff ↗ ·
    added 2 exports
    aft, nsxD
  • R
    R 3.4.0 released · 2017-04-21
  • 1.3.4
    record
    2016-10-09 · diff ↗ ·
    added 1 export
    cox.tvc
  • R
    R 3.3.0 released · 2016-05-03
  • 1.3.2
    record
    2016-04-13 · diff ↗
  • 1.3.1
    record
    2016-02-24 · diff ↗
  • 1.2.2
    record
    2015-07-26
  • R
    R 3.2.0 released · 2015-04-16

Package metadata

First published
2015-07-26
Total releases
28 / 11 yrs
License
GPL-2 | GPL-3 OSI
Minimum R
≥ 3.0.2
Bundled data
119 KB / 4 files
Download size
1.1 MB

Cite

Cite this package

Run in R for the authors' entry:

citation("rstpm2")

The package provides a citation file, so citation() returns the authors' own entry.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for rstpm2 version 1.7.1 [Data set]. HJJB, LLC. Data release v2026-10-18. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy