Learn R Programming

trtswitch (version 0.2.4)

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.4

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Kaifeng Lu

Last Published

February 12th, 2026

Functions in trtswitch (0.2.4)

plot.assess_phregr

Plot method for assess_phregr objects
logisregr

Logistic Regression Models for Binary Data
kmest

Kaplan-Meier Estimates of Survival Curve
msm

Marginal Structural Model (MSM) for Treatment Switching
lrtest

Log-Rank Test of Survival Curve Difference
liferegr

Parametric Regression Models for Failure Time Data
phregr

Proportional Hazards Regression Models
merge_append

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

Plot method for ipcw objects
liver

The liver data used in SAS PROC PHREG documentation examples.
plot.rpsftm

Plot method for rpsftm objects
print.ipe

Print method for ipe objects
plot.tsegest

Plot method for tsegest objects
plot.msm

Plot method for msm objects
plot.ipe

Plot method for ipe objects
preptdc

Prepare Survival Data With Time-Dependent Covariates
recensor_sim_rpsftm

Simulation Study to Evaluate Recensoring Rules in RPSFTM
plot.tsesimp

Plot method for tsesimp objects
print.liferegr

Print liferegr Object
print.logisregr

Print logisregr Object
print.tsegest

Print method for tsegest objects
rawdata

A simulated time-to-event data set with 10 replications
process_cov

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

Print method for msm objects
print.tsesimp

Print method for tsesimp objects
rmdiff

Estimate of Restricted Mean Survival Time Difference
residuals_phregr

Residuals for Proportional Hazards Regression Models
survfit_phregr

Survival Curve for Proportional Hazards Regression Models
survsplit

Split a survival data set at specified cut points
rpsftm

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

Estimate of Restricted Mean Survival Time
residuals_liferegr

Residuals for Parametric Regression Models for Failure Time Data
survQuantile

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

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

Urinary tract infection data from the logistf package
print.phregr

Print phregr Object
print.rpsftm

Print method for rpsftm objects
print.ipcw

Print method for ipcw objects
print.assess_phregr

Print method for assess_phregr objects
shilong

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

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

Simple Two-Stage Estimation (TSEsimp) for Treatment Switching
tssim

Simulate Data for Treatment Switching
tsegestsim

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

Assess Proportional Hazards Assumption Based on Scaled Schoenfeld Residuals
trtswitch-package

Treatment Switching
tobin

Tobin's tobit data from the survival package
assess_phregr

Assess Proportional Hazards Assumption Based on Supremum Test
adtdc

Longitudinal time-dependent covariate data
ipcw

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

Iterative Parameter Estimation (IPE) for Treatment Switching
kmdiff

Estimate of Milestone Survival Difference
ingots

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

Simulated CONCORDE trial data from the rpsftm package
aml

Acute myelogenous leukemia survival data from the survival package
adsl

Baseline subject-level data
heart

Stanford heart transplant data from the survival package