Skip to content

rstpm2

1.7.1

Smooth Survival Models, Including Generalized Survival Models

19packages depend
175.9Kdownloads / year
31.7%test coverage
13/13checks pass

Overview

About
Maintained by Mark ClementsFirst published 2015-07-2628 releasesCRAN page ↗GitHub ↗

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.5 min · r-oldrel-windows-x86_64
Code health
Yes
Tests · ratio 0.11
31.7%
Coverage · measured lines
94%
Documentation · exports
14
Dependencies · direct
Check history
  • OK2026-04-25
    12 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE
  • NOTE2026-04-22
    12 OK · 2 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE
  • ERROR2026-04-18
    11 OK · 2 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE
  • NOTE2026-03-10
    12 OK · 2 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE

Documentation

Documentation
READMEYes · 323 wordsVignettesYes · dynamicpkgdown siteNoNEWSYes · 100% structuredCode of conductNoContributing guideNo
Examples that run
94%
Documented parameters
90%
Return-value docs
100%
References docs
80%

Downloads

175.9K
CRAN downloads in the past year
Rank #1,073 · ~482/day · ~14.7K/mo
Daily download trend is not available in this view yet.
10.7K30 days
38.4K90 days
175.9K1 year
Compare downloads with other packages →
Also on4.7K r2u29 autocran7.8K conda_forge118 c2d4u

Repository

Repository
31Stars
12Forks
8Open issues
1Open PRs
6Releases
812Commits
13Contributors
812 commits · Last activity 2025-08-27

Repository practices

Upstream repositoryBeta

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

Checks run against github.com/mclements/rstpm2 on 2026-07-26.

Continuous integration (1)
GitHub Actions
Reproducibility and dev environment (1)
Makefile
How this is detected·Detection ruleset v1 (2026-07-18)

Dependencies

Declared dependencies
17 external dependencies (excludes base and recommended)
Depends (4)
R >= 3.0.2methodssurvivalsplines
Imports (11)
graphicsRcppstatsmgcvbbmlefastGHQuadutilsparallelmvtnormnumDerivlsoda
LinkingTo (2)
Enhances (0)
none

Code & Tests

Datasets

People & History

People (10)
Maintainer (1)
Author, Maintainer
Authors (3)
Author, Maintainer
Author · added in 1.5.2
Contributors (3)
Contributor · added in 1.4.4
Contributor · added in 1.4.4
Contributor
Copyright holders (4)
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
Package Timeline

28 releases. Pick two to compare their code metrics. R releases are shown for context.

  • R
    R 4.6.0 released · 2026-04-24
  • 1.7.1Latest
    2025-11-13 · current release · diff ↗
  • 1.7.0
    2025-08-27 · diff ↗
  • 1.6.9
    2025-07-25 · diff ↗
  • 1.6.7
    2025-05-11 · diff ↗
  • R
    R 4.5.0 released · 2025-04-11
  • 1.6.6.1
    2024-12-21 · diff ↗
  • 1.6.6
    2024-10-29 · diff ↗
  • 1.6.5
    2024-08-20 · diff ↗
  • 1.6.4
    2024-08-19 · diff ↗
  • R
    R 4.4.0 released · 2024-04-24
  • 1.6.3
    2023-12-05 · diff ↗
  • R
    R 4.3.0 released · 2023-04-21
  • 1.6.2
    2023-03-08 · diff ↗
  • 1.6.1
    2023-02-28 · diff ↗
  • 1.5.9
    2023-01-07 · diff ↗
Show 24 earlier events
  • 1.5.8
    2022-10-17 · diff ↗
  • 1.5.7
    2022-07-14 · diff ↗
  • 1.5.6
    2022-05-10 · diff ↗
  • R
    R 4.2.0 released · 2022-04-22
  • 1.5.5
    2022-04-19 · diff ↗
  • R
    R 4.1.0 released · 2021-05-18
  • 1.5.2
    2021-03-03 · diff ↗
  • R
    R 4.0.0 released · 2020-04-24
  • 1.5.1
    2019-11-06 · diff ↗
  • 1.5.0
    2019-10-15 · diff ↗
  • R
    R 3.6.0 released · 2019-04-26
  • 1.4.5
    2019-01-17 · diff ↗
  • 1.4.4
    2018-11-01 · diff ↗
  • 1.4.2
    2018-05-29 · diff ↗
  • R
    R 3.5.0 released · 2018-04-23
  • 1.4.1
    2017-09-20 · diff ↗
  • 1.4.0
    2017-08-31 · diff ↗
  • R
    R 3.4.0 released · 2017-04-21
  • 1.3.4
    2016-10-09 · diff ↗
  • R
    R 3.3.0 released · 2016-05-03
  • 1.3.2
    2016-04-13 · diff ↗
  • 1.3.1
    2016-02-24 · diff ↗
  • 1.2.2
    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
Installed size
not tracked yet
With dependencies
not tracked yet
Report a problem with this page →