Skip to main content

Diagnostic biostatistics in R

Analytical and clinical performance, cut-offs and companion diagnostics, on simulated data

Author

Ignacio García Ribelles

The statistics of in-vitro diagnostics, worked in R on simulated data: analytical performance (precision, detection capability, linearity, method comparison), clinical performance (diagnostic accuracy, ROC, cut-offs, sample size), companion-diagnostic bridging, and a statistical analysis plan with a dry run and an independent re-derivation.

Every chapter has the same four parts:

Reading conventions

  • [S] = stated in a primary public source (cited in claims_ledger.csv).
  • [Y] = my synthesis of standard theory; not a quotation.
  • [A] = an assumption used in a simulation.
  • “not verified: paywalled” = could not be checked against the document; not stated as fact.
  • CLSI texts are paywalled. Nothing here quotes them.
  • All data are simulated. The one real-world example (Chapter 6) uses only numbers published in the FDA decision summary K261686, with page citations.

Contents

Chapter Topic Governing documents
1 Landscape and vocabulary IVDR, MDCG 2022-2, ISO 20916, FDA pathways
2 Precision and variance components EP05, EP15
3 Detection capability and linearity EP17, EP06
4 Method comparison, interference, stability, lots EP09c, EP07, EP25, EP26
5 Diagnostic accuracy, ROC EP12, EP24, FDA 2007 guidance, STARD
6 Cut-offs, two-cut-off designs, intermediate zone EP24, EP12, FDA decision summary
7 Sample size and power Buderer, Flahault, Hanley–McNeil
8 Companion diagnostics and bridging FDA CDx guidances, IVDR Art 48
9 Statistical analysis plan IVDR Annex XIII, ISO 20916, ICH E9
10 Reference intervals and longitudinal biomarkers EP28

Analysis question → governing document → R tools

m <- read.csv("question_map.csv")
kable(m, col.names = c("Analysis question", "Governing document", "R tools", "Chapter"), row.names = FALSE)
Analysis question Governing document R tools Chapter
How imprecise is the assay (within-run, between-day, within-lab)? CLSI EP05 (Ed4, 2025; A3 design 20x2x2); lab verification EP15-A3 VCA::anovaVCA, lme4::lmer 2
Does my lab reproduce the manufacturer’s precision/bias claim? CLSI EP15-A3 (+IG1/IG2, 2021) chi-square upper verification limit (hand) 2
What is the lowest concentration reliably detected / quantified? CLSI EP17-A2 (2012) parametric and nonparametric LoB/LoD (hand); bootstrap 3
Is the assay linear over the claimed range? CLSI EP06 Ed2 (2020) lm with polynomial terms; allowable deviation 3
Do two methods agree? What is the bias at a decision level? CLSI EP09c Ed3 (2018) mcr::mcreg (Deming, Passing-Bablok), Bland-Altman 4
Does an interferent bias the result? CLSI EP07 Ed3 (2018), EP37 tables paired differences + CI (hand) 4
How long is a reagent stable? CLSI EP25 Ed2 (2023) lm over time with acceptance limit 4
Does a new reagent lot shift results? CLSI EP26 Ed2 (2022) paired lot comparison (hand) 4
Sensitivity/specificity/PPV/NPV with CI? CLSI EP12 Ed3 (2023); FDA 2007 statistical guidance; STARD 2015 binom, epiR::epi.tests, helpers::report_2x2 5
Compare two tests on the same patients? FDA 2007 guidance; McNemar DTComPair, mcnemar.test 5
Candidate vs non-reference comparator: what do I call the metrics? FDA 2007 guidance (PPA/NPA, not sensitivity/specificity) helpers::report_2x2 (label PPA/NPA) 5
ROC curve, AUC, compare AUCs? CLSI EP24-A2 (2011); DeLong 1988 pROC::roc, ci.auc, roc.test 5
How do I choose and validate a cut-off (one or two)? EP24-A2; EP12 Ed3; FDA decision summaries cutpointr, OptimalCutpoints, helpers::classify_two_cut 6
How many subjects for a sensitivity/specificity target? Buderer 1996; Flahault 2005; Annex XIII Part A 2.3.2 (population size) helpers::n_buderer, presize, MKmisc, pROC::power.roc.test 7
How do I bridge a clinical-trial assay to the final CDx? FDA 2014 CDx guidance; FDA 2016 draft codevelopment; IVDR Art 48(7)-(8), Annex IX 5.2 simulation (Chapter 8) 8
What goes in the statistical analysis plan? IVDR Annex XIII Part A 2.3.2; ISO 20916:2019; ICH E9 / E9(R1) by analogy; MDCG 2022-2 mock_sap/ 9
What is the reference interval? CLSI EP28-A3c (2010) quantile, boot, refineR 10
Is a change in a patient’s serial results real? reference change value (RCV); monitoring is a separate intended use lme4, formula (hand) 10
Which CE class and route? IVDR Annex VIII Rules 1-7; Art 47-48 - 1
What must the performance evaluation contain? IVDR Art 56, Annex XIII Part A (PEP, PER); Part B (PMPF) - 1

Corrections to commonly repeated statements (verified 2026-10-16)

  1. EP05 is now Ed4 (Dec 2025); EP25, EP26, EP35 and EP19 also have newer editions than many references list.
  2. IVDR Arts 47–48 are classification and conformity assessment; the general safety and performance requirements are in Annex I. Companion diagnostics are class C (Rule 3(f)); the medicines-authority consultation is in Art 48(7)/(8) for class C (and 48(3)/(4) for class D).
  3. FDA’s 2020 CDx guidance is titled “…for a Specific Group of Oncology Therapeutic Products” (final); “Group or Class” was the draft. The 2016 codevelopment guidance is still a draft.
  4. pTau217: FDA decision 2026-08-19 (K261686), announced by the manufacturer on 2026-08-24. The two cited papers used a prototype assay, not the cleared one.

How it was made

Written with Claude Code as an AI-assisted coding workflow. Every claim carries its source and a confidence level in claims_ledger.csv; the K261686 figures were re-checked by hand against the decision-summary PDF, and the README lists what could not be verified. The helper functions are covered by unit tests in tests/testthat.