Learn R Programming

trtswitch (version 0.2.3)

Treatment Switching

Description

Implements rank preserving structural failure time model (RPSFTM), iterative parameter estimation (IPE), inverse probability of censoring weights (IPCW), marginal structural model (MSM), simple two-stage estimation (TSEsimp), and improved two-stage estimation with g-estimation (TSEgest) methods for treatment switching in randomized clinical trials.

Copy Link

Version

Install

install.packages('trtswitch')

Monthly Downloads

395

Version

0.2.3

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Kaifeng Lu

Last Published

January 10th, 2026

Functions in trtswitch (0.2.3)

logisregr

Logistic Regression Models for Binary Data
plot.ipcw

Plot method for ipcw objects
msm

Marginal Structural Model (MSM) for Treatment Switching
merge_append

Append columns from B to A by keyed join (fast, data.table-based)
plot.assess_phregr

Plot method for assess_phregr objects
phregr

Proportional Hazards Regression Models
lrtest

Log-Rank Test of Survival Curve Difference
plot.rpsftm

Plot method for rpsftm objects
preptdc

Prepare Survival Data With Time-Dependent Covariates
print.liferegr

Print liferegr Object
print.ipe

Print method for ipe objects
plot.tsegest

Plot method for tsegest objects
plot.ipe

Plot method for ipe objects
print.assess_phregr

Print method for assess_phregr objects
plot.tsesimp

Plot method for tsesimp objects
print.ipcw

Print method for ipcw objects
plot.msm

Plot method for msm objects
recensor_sim_rpsftm

Simulation Study to Evaluate Recensoring Rules in RPSFTM
print.phregr

Print phregr Object
residuals_liferegr

Residuals for Parametric Regression Models for Failure Time Data
process_cov

helper: process a base covariate specification and ensure design columns exist in df
print.tsesimp

Print method for tsesimp objects
rawdata

A simulated time-to-event data set with 10 replications
print.msm

Print method for msm objects
print.logisregr

Print logisregr Object
print.tsegest

Print method for tsegest objects
print.rpsftm

Print method for rpsftm objects
survfit_phregr

Survival Curve for Proportional Hazards Regression Models
rmest

Estimate of Restricted Mean Survival Time
survsplit

Split a survival data set at specified cut points
survQuantile

Brookmeyer-Crowley Confidence Interval for Quantiles of Right-Censored Time-to-Event Data
rmdiff

Estimate of Restricted Mean Survival Time Difference
rpsftm

Rank Preserving Structural Failure Time Model (RPSFTM) for Treatment Switching
residuals_phregr

Residuals for Proportional Hazards Regression Models
sexagg

Urinary tract infection data from the logistf package
six

The repeated measures data from the "Six Cities" study of the health effects of air pollution (Ware et al. 1984).
shilong

The randomized clinical trial SHIVA data in long format from the ipcwswitch package
tsesimp

Simple Two-Stage Estimation (TSEsimp) for Treatment Switching
trtswitch-package

Treatment Switching
tobin

Tobin's tobit data from the survival package
tssim

Simulate Data for Treatment Switching
zph_phregr

Assess Proportional Hazards Assumption Based on Scaled Schoenfeld Residuals
tsegestsim

Simulate Survival Data for Two-Stage Estimation with g-estimation
tsegest

Two-Stage Estimation with g-Estimation (TSEgest) for Treatment Switching
heart

Stanford heart transplant data from the survival package
assess_phregr

Assess Proportional Hazards Assumption Based on Supremum Test
kmdiff

Estimate of Milestone Survival Difference
ipe

Iterative Parameter Estimation (IPE) for Treatment Switching
ipcw

Inverse Probability of Censoring Weights (IPCW) for Treatment Switching
aml

Acute myelogenous leukemia survival data from the survival package
adsl

Baseline subject-level data
ingots

The binary data from Cox and Snell (1989, pp. 10-11).
immdef

Simulated CONCORDE trial data from the rpsftm package
adtdc

Longitudinal time-dependent covariate data
kmest

Kaplan-Meier Estimates of Survival Curve
liferegr

Parametric Regression Models for Failure Time Data
liver

The liver data used in SAS PROC PHREG documentation examples.