Skip to contents

Introduction

This vignette demonstrates treatment response analysis for oncology studies using ClinicoPath functions. Treatment response evaluation is crucial for assessing therapy effectiveness and making clinical decisions.

Setup

library(jsurvival)
library(dplyr)
library(ggplot2)

# Load treatment response data
data(treatmentResponse)

# Display data structure
head(treatmentResponse)
cat("Dataset dimensions:", dim(treatmentResponse), "\n")

Basic Response Analysis

Response Distribution

# Analyze response categories using basic R
if("Response" %in% names(treatmentResponse)) {
  cat("Response Categories:\n")
  print(table(treatmentResponse$Response, useNA = "ifany"))
} else {
  cat("Available variables in treatmentResponse:\n")
  print(names(treatmentResponse))
}

Summary Statistics by Response Category

# Basic summary statistics
continuous_vars <- names(treatmentResponse)[sapply(treatmentResponse, is.numeric)]
cat("Continuous variables available:\n")
print(continuous_vars)

# Example summary
if(length(continuous_vars) > 0) {
  summary(treatmentResponse[continuous_vars])
}

Advanced Analysis with ClinicoPath Functions

Cross-tabulation Analysis

# Example of proper crosstable usage for treatment response
categorical_vars <- names(treatmentResponse)[sapply(treatmentResponse, function(x) is.factor(x) || is.character(x))]

if(length(categorical_vars) >= 2) {
  crosstable(
    data = treatmentResponse,
    vars = categorical_vars[1:2],
    group = categorical_vars[1]
  )
} else {
  cat("Cross-tabulation analysis available with appropriate categorical variables")
}

Data Summary Analysis

# Example of proper summarydata usage
if(length(continuous_vars) > 0 && length(categorical_vars) > 0) {
  summarydata(
    data = treatmentResponse,
    vars = continuous_vars[1:min(2, length(continuous_vars))],
    date_vars = character(0),
    grvar = categorical_vars[1]
  )
} else {
  cat("Summary data analysis available with appropriate variables")
}

Visualization Examples

Waterfall Plot Analysis

# Waterfall plot example
# Note: Requires specific data structure with PatientID, ResponseVar, TimeVar
cat("Waterfall Plot Analysis:\n")
cat("- Requires: PatientID, ResponseVar, TimeVar columns\n")
cat("- Shows individual patient treatment responses\n")
cat("- Gold standard for oncology response visualization\n\n")

# Check if required columns exist
required_cols <- c("PatientID", "Response", "Month")
available_cols <- intersect(required_cols, names(treatmentResponse))
cat("Available required columns:", paste(available_cols, collapse = ", "), "\n")

# Example usage (commented out to avoid errors)
# waterfall(
#   data = treatmentResponse,
#   patientID = "PatientID",
#   responseVar = "Response", 
#   timeVar = "Month"
# )

Swimmer Plot Analysis

# Swimmer plot example
cat("Swimmer Plot Analysis:\n")
cat("- Shows individual patient timelines\n")
cat("- Displays treatment duration and clinical events\n")
cat("- Useful for tracking patient follow-up\n\n")

# Check data structure for swimmer plots
cat("For swimmer plots, data should include:\n")
cat("- Patient identifiers\n")
cat("- Treatment start/end times\n")
cat("- Clinical events and timelines\n")

Response Evaluation Guidelines

RECIST Criteria

# RECIST response categories explanation
cat("RECIST Response Categories:\n")
cat("- Complete Response (CR): Disappearance of all target lesions\n")
cat("- Partial Response (PR): ≥30% decrease in sum of target lesions\n")
cat("- Progressive Disease (PD): ≥20% increase in sum of target lesions\n")
cat("- Stable Disease (SD): Neither PR nor PD criteria met\n\n")

# Check if RECIST categories are present in data
recist_cols <- grep("RECIST|Response", names(treatmentResponse), value = TRUE, ignore.case = TRUE)
if(length(recist_cols) > 0) {
  cat("RECIST-related columns found:", paste(recist_cols, collapse = ", "), "\n")
}

Statistical Considerations

# Response rate calculations
cat("Statistical Considerations for Treatment Response:\n\n")
cat("1. Overall Response Rate (ORR) = (CR + PR) / Total patients\n")
cat("2. Disease Control Rate (DCR) = (CR + PR + SD) / Total patients\n")
cat("3. Confidence intervals should be calculated for response rates\n")
cat("4. Consider stratification by patient characteristics\n\n")

# Example calculation if response data is available
if("Response" %in% names(treatmentResponse) || length(recist_cols) > 0) {
  cat("Response rate analysis can be performed with available data\n")
} else {
  cat("Load appropriate response data for rate calculations\n")
}

Integration with jamovi

All functions demonstrated in this vignette are available through jamovi’s graphical interface:

  1. Data Summary: Exploration > ClinicoPath Descriptives > Summary Data
  2. Cross-tabulations: Exploration > ClinicoPath Comparisons > Cross Tables
  3. Visualization: Specialized plots available through ClinicoPath menu

The jamovi interface provides point-and-click access to these specialized oncology analysis tools, making them accessible to clinical researchers without programming experience.

Further Resources

  • Clinical Workflow Vignette: For integrating response analysis into complete study workflows
  • Visualization Gallery: For advanced customization of oncology plots
  • Getting Started Guide: For basic ClinicoPathDescriptives functionality
  • Individual Function Vignettes: For detailed parameter usage and examples

Best Practices

  1. Data Preparation: Ensure consistent response coding across all patients
  2. Missing Data: Handle missing responses appropriately in analysis
  3. Time Points: Use consistent assessment time points for comparability
  4. Quality Control: Validate response assessments and resolve discrepancies
  5. Statistical Power: Consider sample size requirements for detecting response differences