Skip to contents

Usage

pathsampling(
  data,
  analysisContext = "general",
  totalSamples = NULL,
  firstDetection = NULL,
  positiveCount = NULL,
  positiveSamplesList = NULL,
  sampleType = NULL,
  targetConfidence = 0.95,
  maxSamples = 10,
  bootstrapIterations = 10000,
  showBinomialModel = FALSE,
  showBootstrap = FALSE,
  showDetectionCurve = FALSE,
  showSensitivityCI = FALSE,
  setSeed = FALSE,
  seedValue = 42,
  positiveCassettes = NULL,
  maxPositiveSingle = NULL,
  showTumorBurden = FALSE,
  showStageMigration = FALSE,
  showCorrelation = FALSE,
  showDistributionPattern = FALSE,
  distributionThreshold = 5,
  modelType = "binomial",
  totalPopulation = NULL,
  successStates = NULL,
  targetDetections = 1,
  showHypergeometric = FALSE,
  showBetaBinomial = FALSE,
  totalLymphNodes = NULL,
  positiveLymphNodes = NULL,
  showLNAnalysis = FALSE,
  lnrThreshold1 = 0.1,
  lnrThreshold2 = 0.3,
  showEffectSizes = FALSE,
  showOmentumAnalysis = FALSE,
  showClinicalSummary = FALSE,
  showGuidedInstructions = FALSE,
  showConciseInstructions = FALSE,
  showEmpiricalCumulative = FALSE,
  showSpatialClustering = FALSE,
  showStratifiedAnalysis = FALSE,
  showPopulationDetection = FALSE,
  showIncrementalYield = FALSE,
  showMultifocalAnalysis = FALSE,
  showProbabilityExplanation = FALSE,
  showKeyResults = FALSE,
  showRecommendText = FALSE,
  showInterpretText = FALSE,
  showReferencesText = FALSE,
  estimationMethod = "auto",
  showHeterogeneityTest = FALSE,
  useGeometricCI = TRUE,
  ciMethod = "auto",
  showModelFit = FALSE,
  showObsPred = FALSE,
  showMarginalInterpretation = TRUE,
  showPowerAnalysis = FALSE,
  targetPower = 0.8,
  targetDetectionProb = 0.95,
  autoSelectModel = FALSE,
  appendVariables = FALSE,
  appendPrefix = "ps_",
  autoDetectHeterogeneity = TRUE
)

Arguments

data

.

analysisContext

Select the type of pathology sampling analysis: - Lymph Node: Adequacy of lymph node dissection - Omentum: Omentum sampling in ovarian/gastric cancer - Tumor: Tumor block sampling for VI, EMVI, PNI, or budding detection - Margin: Margin sampling adequacy - General: Custom sampling adequacy analysis

totalSamples

Total number of samples examined per case. Examples: total tumor blocks examined, total lymph nodes dissected, total omentum sections.

firstDetection

Sample number where outcome was first detected (e.g., which block first showed VI). Leave as NA for negative cases. For positive cases, enter the sequential sample number (1, 2, 3, etc.).

positiveCount

.

positiveSamplesList

.

sampleType

.

targetConfidence

.

maxSamples

.

bootstrapIterations

.

showBinomialModel

.

showBootstrap

.

showDetectionCurve

.

showSensitivityCI

.

setSeed

.

seedValue

.

positiveCassettes

.

maxPositiveSingle

.

showTumorBurden

.

showStageMigration

.

showCorrelation

.

showDistributionPattern

.

distributionThreshold

.

modelType

.

totalPopulation

.

successStates

.

targetDetections

.

showHypergeometric

.

showBetaBinomial

.

totalLymphNodes

.

positiveLymphNodes

.

showLNAnalysis

.

lnrThreshold1

.

lnrThreshold2

.

showEffectSizes

.

showOmentumAnalysis

.

showClinicalSummary

.

showGuidedInstructions

Display detailed step-by-step checklist with examples and common use cases. Best for first-time users and training.

showConciseInstructions

Display brief analysis overview with required variables and methods. Best for experienced users.

showEmpiricalCumulative

.

showSpatialClustering

.

showStratifiedAnalysis

.

showPopulationDetection

.

showIncrementalYield

.

showMultifocalAnalysis

.

showProbabilityExplanation

Show detailed explanation distinguishing conditional vs population-level detection probabilities.

showKeyResults

Display a concise summary of key findings at the top of results.

showRecommendText

Display context-specific clinical recommendations based on analysis results.

showInterpretText

Show statistical interpretation and guidance for result interpretation.

showReferencesText

Display statistical methods documentation and literature references.

estimationMethod

.

showHeterogeneityTest

Test if detection probability varies significantly across sample types. Only available when Sample Type variable is specified. Uses likelihood ratio test.

useGeometricCI

Use theoretical geometric model confidence intervals when bootstrap shows ceiling effect (100\ uncertainty estimates.

ciMethod

Method for calculating confidence intervals. Auto selects geometric when bootstrap shows ceiling effect, otherwise uses bootstrap.

showModelFit

Perform goodness-of-fit test comparing observed vs predicted detection distribution. Validates geometric/binomial model assumptions.

showObsPred

Compare observed detection rates with model predictions at each sample number. Visual model validation tool.

showMarginalInterpretation

Add cost-benefit interpretation to marginal gain analysis. Auto-enabled when Show Binomial Model is checked.

showPowerAnalysis

.

targetPower

.

targetDetectionProb

.

autoSelectModel

.

appendVariables

Add new columns to dataset with calculated detection probabilities and classifications. Variables include cumulative probabilities, recommended sample counts, and detection categories.

appendPrefix

Prefix for appended variable names (e.g., 'ps_' creates 'ps_cumulative_prob_5'). Only used when Append Variables is enabled.

autoDetectHeterogeneity

Automatically analyze and report if sample types have significantly different detection probabilities. Requires Sample Type variable. Warns if CV > 30\

A results object containing:

results$welcomea html
results$guidedInstructionsa html
results$conciseInstructionsa html
results$dataInfoa table
results$probabilityExplanationa html
results$keyResultsa html
results$clinicalSummarya html
results$binomialTexta html
results$binomialTablea table
results$recommendTablea table
results$bootstrapTexta html
results$bootstrapTablea table
results$detectionCurvean image
results$sensitivityPlotan image
results$heterogeneityTexta html
results$heterogeneityTesta table
results$modelFitTexta html
results$modelFitTablea table
results$obsPredTexta html
results$obsPredTablea table
results$empiricalCumulativeTexta html
results$empiricalCumulativeTablea table
results$empiricalCumulativePlotan image
results$incrementalYieldTexta html
results$incrementalYieldTablea table
results$populationDetectionTexta html
results$populationDetectionTablea table
results$spatialClusteringTexta html
results$clusteringTablea table
results$multifocalTexta html
results$multifocalTablea table
results$stratifiedTexta html
results$prevalenceTablea table
results$stratifiedDetectionTablea table
results$tumorBurdenTexta html
results$tumorBurdenInfoa table
results$cassetteDistributiona table
results$stageMigrationTexta html
results$stageMigrationTablea table
results$correlationTexta html
results$correlationStatsa table
results$correlationPlotan image
results$distributionPatternTexta html
results$distributionPatternTablea table
results$distributionComparisonTablea table
results$hypergeometricTexta html
results$hypergeometricTablea table
results$hyperRecommendTablea table
results$betaBinomialTexta html
results$betaBinomialTablea table
results$betaBinomialRecommendTablea table
results$powerAnalysisTexta html
results$powerTablea table
results$multifocalAnalysisTexta html
results$multifocalProbTablea table
results$modelSelectionTexta html
results$modelComparisonTablea table
results$lnAnalysisTexta html
results$lnrClassificationa table
results$ajccNStagea table
results$adequacyByELNa table
results$effectSizesTexta html
results$effectSizesTablea table
results$omentumTexta html
results$recommendTexta html
results$interpretTexta html
results$referencesTexta html
Tables can be converted to data frames with asDF or as.data.frame. For example:results$dataInfo$asDFas.data.frame(results$dataInfo) Pathology Sampling Adequacy Analysis