Skip to contents

Treatment Switching Analysis

Usage

treatmentswitching(
  data,
  time,
  event,
  treatment,
  switchingTime,
  actualTreatment,
  covariates = list(),
  switchingMethod = "ipcw",
  switchingDirection = "control_to_treatment",
  censoringAssumption = "common_treatment",
  confidenceLevel = 95,
  treatmentEffect = TRUE,
  switchingPatterns = TRUE,
  survivalCurves = TRUE,
  sensitivityAnalysis = FALSE,
  causalEstimate = TRUE,
  methodComparison = TRUE,
  bootstrapSamples = 1000,
  psModel,
  accelerationFactor,
  treatmentLag = 0,
  plotWidth = 700,
  plotHeight = 500
)

Arguments

data

the data as a data frame

time

Time to event or censoring

event

Event status (0 = censored, 1 = event)

treatment

Original randomized treatment assignment

switchingTime

Time when treatment switching occurred (NA if no switching)

actualTreatment

Actual treatment received after any switching

covariates

Baseline covariates for adjustment

switchingMethod

Method for handling treatment switching

switchingDirection

Direction of treatment switching allowed

censoringAssumption

Assumptions for handling censoring in switching analysis

confidenceLevel

Confidence level for interval estimation

treatmentEffect

Display treatment effect estimates for different methods

switchingPatterns

Summarize patterns of treatment switching

survivalCurves

Display survival curves with switching adjustments

sensitivityAnalysis

Perform sensitivity analysis for switching assumptions

causalEstimate

Estimate causal treatment effects adjusting for switching

methodComparison

Compare results across different switching methods

bootstrapSamples

Number of bootstrap samples for uncertainty estimation

psModel

Formula for propensity score model (for IPCW method)

accelerationFactor

Acceleration factor for RPSFT method (estimated if not specified)

treatmentLag

Lag time before treatment effect begins

plotWidth

Width of survival plots in pixels

plotHeight

Height of survival plots in pixels

Value

A results object containing:

results$todoa html
results$summarya html
results$switchingPatternsTablea table
results$treatmentEffectTablea table
results$causalEffectTablea table
results$methodComparisonTablea table
results$survivalCurvesPlotan image
results$switchingPatternsPlotan image
results$sensitivityPlotan image
results$diagnosticsTablea table
results$sensitivityTablea table
results$bootstrapTablea table
results$clinicalInterpretationa html

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$switchingPatternsTable$asDF

as.data.frame(results$switchingPatternsTable)