Nonparametric Analysis of Clustered Multistate Processes
Overview
Nonparametric estimation of population-averaged transition probabilities, with cluster-bootstrap pointwise confidence intervals, simultaneous confidence bands, and two-sample Kolmogorov-Smirnov-type tests for clustered or independent multistate process data. Estimation follows Bakoyannis (2021) doi:10.1111/biom.13327; two-sample inference for the cluster-randomized and independent-samples designs follows Bakoyannis and Bandyopadhyay (2022) doi:10.1007/s10463-021-00819-x. Both methods use the working-independence Aalen-Johansen estimator. The package supports both progressive (acyclic) and non-monotone (e.g., illness-death with recovery) multistate processes, right censoring, left truncation, and informative cluster size. The user supplies data in interval format (one row per mutually-exclusive time interval per subject) and interacts with the package through a single formula-based function, patp().
Initial CRAN release
- Initial CRAN release of
clusteredMSM.
Highlights
- Nonparametric estimation of population-averaged transition probabilities for clustered or independent multistate process data, with cluster-bootstrap pointwise confidence intervals and simultaneous confidence bands.
- Two-sample Kolmogorov-Smirnov-type test, dispatched automatically when a grouping variable appears on the formula's right-hand side. Three regimes via a
designargument:"shared"(multicenter, every cluster carries both groups),"cluster_random"(cluster-randomized trial, stratified cluster bootstrap), and"indep_random"(independent observational comparison, unstratified cluster bootstrap)."auto"infers the regime from the data.
Show all changes in 0.1.0Hide the rest of the changes in 0.1.0
- Native support for non-monotone (recovery) multistate processes via a generic product-integral estimator (
prodint_AJ()). - Self-contained: depends only on
survival(which ships with R). Removes the dependency onmstatethat limited earlier implementations to progressive models. - Estimation methodology from Bakoyannis (2021) <doi:10.1111/biom.13327>; two-sample inference for the cluster-randomized and independent-samples designs follows Bakoyannis and Bandyopadhyay (2022) <doi:10.1007/s10463-021-00819-x>.
Public API
The package exposes a single user-facing function, patp(), with a
formula-based interface modelled after survival::Surv():
``` r
One-sample
patp(msm(Tstart, Tstop, Sstart, Sstop) ~ 1,
data = mydata, tmat = tmat,
id = "subj_id", cluster = "site",
h = 1, j = 2, B = 1000, cband = TRUE)
Two-sample (estimate + test)
patp(msm(Tstart, Tstop, Sstart, Sstop) ~ treatment,
data = mydata, tmat = tmat,
id = "subj_id", cluster = "site",
h = 1, j = 2, B = 1000)
```
patp() returns an S3 object of class patp with print() and
summary() methods.
Input format
Data are supplied in **interval format**: one row per mutually-exclusive
time interval per subject, with columns for interval start time, end
time, starting state, and ending state. Censoring is encoded as
Sstart == Sstop on the final row. Within each subject, intervals must
be temporally and spatially contiguous; this is enforced by strict
validation (validate_intervals()).
Known limitations
- The two-sample Kolmogorov-Smirnov-type test uses **unit weight** at every time point. Bakoyannis (2021) Section 2.5 recommends the harmonic-mean weight
W(t) = prod_p Y_p(t) / sum_p Y_p(t), which downweights regions where one group's at-risk set is small and tames tail instability of the difference estimator. A weighted variant following Bakoyannis (2021) Section 2.5 and Bakoyannis & Bandyopadhyay (2022) is planned for v0.2, alongside the linear and L2 tests. - Confidence bands use an equal-precision-type construction on the cloglog scale; the Hall-Wellner-type construction from Bakoyannis (2021) Section 2.3 will be added in v0.2.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK7 OK2026-05-28
Documentation
- Help pages
- 20 (5 internal)
- Examples that run
- 100%11 run in a plain check
- Exported functions with examples
- 77%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 20%
Downloads
Repository
Forks over time
3 development-tooling and community-health practices detected across 2 families in the upstream repository
Checks run against github.com/gbakoyannis/clusteredmsm on 2026-10-18.
This repository shows signs of AI coding tools.
- Claude Codefirst seen on or before 2026-05-07Seen in the repository: CLAUDE.mdNamed in .Rbuildignore: CLAUDE.mdCommits: at least 29 crediting it in the message
- Claude Opus 4.729 commits · May 2026
Dependencies
Installing clusteredMSM adds no packages beyond those that come with R.
Code & Tests
Datasets
People & History
- 0.1.0Latest2026-05-27 · current release
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-05-27
- Total releases
- 1 / 1 yrs
- License
- GPL-3 OSI
- Minimum R
- ≥ 3.5.0
- Bundled data
- 1.3 KB / 1 file
- Download size
- 66 KB
Cite
Cite this package
Run in R for the authors' entry:
citation("clusteredMSM")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.1111/biom.13327, 10.1007/s10463-021-00819-x.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.