Skip to contents

IHC Heterogeneity Analysis

Usage

ihcheterogeneity(
  data,
  wholesection = NULL,
  biopsy1,
  biopsy2 = NULL,
  biopsy3 = NULL,
  biopsy4 = NULL,
  biopsies = NULL,
  spatial_id = NULL,
  analysis_type = "comprehensive",
  sampling_strategy = "unknown",
  cv_threshold = 20,
  correlation_threshold = 0.8,
  show_variability_plots = FALSE,
  variance_components = FALSE,
  power_analysis = FALSE,
  generate_recommendations = FALSE,
  showSummary = FALSE,
  showGlossary = FALSE
)

Arguments

data

the data as a data frame

wholesection

Optional reference measurement for comparison with regional measurements. Can be whole section average, hotspot area, or overall tumor measurement. Leave empty for inter-regional comparison studies. Example: Ki67 proliferation index (0-100%), ER H-score (0-300), PR percentage (0-100%).

biopsy1

Continuous biomarker measurement from first tissue region or area. Should represent same biomarker as reference measurement for heterogeneity comparison. Example: Ki67 % from tumor periphery, ER H-score from invasive front.

biopsy2

Second tissue region biomarker measurement for heterogeneity analysis

biopsy3

Third tissue region biomarker measurement

biopsy4

Fourth tissue region biomarker measurement

biopsies

additional simulated biopsy measurements

spatial_id

identifier for spatial regions or tissue areas

analysis_type

primary focus of biopsy simulation analysis

sampling_strategy

biopsy sampling strategy used

cv_threshold

Coefficient of variation threshold for acceptable sampling variability. Typical clinical values: 15-25% for immunohistochemistry (Ki67, ER, PR), 10-20% for molecular assays, 20-30% for heterogeneous markers (HER2, PD-L1). Lower values indicate more stringent quality requirements.

correlation_threshold

Minimum Spearman correlation between biopsy and whole section measurements. Clinical guidelines: ≥0.80 excellent agreement, ≥0.70 good agreement, ≥0.60 moderate agreement, <0.60 poor agreement. Higher values indicate better representativeness of biopsy samples.

show_variability_plots

display plots showing sampling variability

variance_components

perform variance component decomposition

power_analysis

perform power analysis for sample size recommendations

generate_recommendations

provide recommendations for optimal heterogeneity assessment strategy

showSummary

Display natural-language summary of heterogeneity analysis results

showGlossary

Display definitions of statistical terms (ICC, CV, correlation)

Value

A results object containing:

results$interpretationa html
results$report_sentencesPre-formatted sentences ready for clinical reports and publications
results$assumptionsAnalysis assumptions, data requirements, and methodological considerations
results$summaryNatural-language summary of heterogeneity analysis results
results$glossaryDefinitions of key statistical terms used in the analysis
results$reproducibilitytableCorrelation and reliability metrics
results$samplingbiastableSystematic bias assessment between methods
results$variancetableSources of measurement variability
results$poweranalysistableSample size recommendations and power calculations
results$spatialanalysistableVariability across spatial regions
results$biopsyplotDistribution comparison across regional measurements and reference (if provided)
results$variabilityplotCoefficient of variation by case
results$spatialplotSpatial distribution of biomarker values

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

results$reproducibilitytable$asDF

as.data.frame(results$reproducibilitytable)