# Sample size calculation — Nivel 3 ypN0 predictor

**Document version:** 1.0  —  **Date:** 2026-05-14
**PI:** Dr. Sergio Cervera

---

## 1. Primary outcome

- **Outcome:** ypN0 (binary): no axillary macrometastasis on final pathology after NAC.
  - Definition: ypN0 OR ypN0(i+) per AJCC 8th edition.
- **Expected event rate (pooled, from Nivel 2 meta-regression):** ~0.37 (37%).
  - Range across subtypes: TNBC ~50%, HER2+ ~60%, HR+/HER2- ~20%.
- **Population:** cN+ patients (cN1–N3) treated with NAC.

---

## 2. Sample size for model development (Riley 2019 framework)

We use the **Riley et al. 2019 (Stat Med, doi:10.1002/sim.7992)** criteria for binary
outcomes, which combine four sub-criteria and take the maximum N. Below is a closed-form
estimate using the simplified rules of thumb (which approximate Riley well for our setting).

### 2.1. Rule of thumb: events per predictor parameter (EPP)

- **Predictor parameters anticipated:** 8–12 (depending on regimen interactions and
  whether subtype is modeled as 4 dummies vs single ordinal).
- **Conservative target:** 12 parameters × 10 events/parameter = **120 ypN0 events minimum**.
- **At expected ypN0 rate of 0.37:** N = 120 / 0.37 ≈ **325 patients**.

### 2.2. Riley criterion 1 — global shrinkage ≤10%

For an anticipated AUC of 0.80 and Cox-Snell R² ≈ 0.15:
- N ≈ P / [(S - 1) · ln(1 - R²/S)]  with S = 0.9 → ~290 patients.

### 2.3. Riley criterion 2 — small absolute difference in apparent vs adjusted R²

- For Cox-Snell R² of 0.15 and difference ≤0.05 → ~310 patients.

### 2.4. Riley criterion 3 — precise estimation of event proportion

- For estimating outcome proportion with 95% CI half-width ≤0.05:
  N = (1.96² × 0.37 × 0.63) / 0.05² ≈ **358 patients**.

### 2.5. Riley criterion 4 — precise estimation of intercept

- Approximately N = (1.96 / 0.05)² × 1 / [0.37(1-0.37)] ≈ **402 patients** (for very
  precise calibration intercept; relaxable to half-width 0.10 → ~100 patients).

### 2.6. Final recommendation for derivation cohort

**Minimum: 325 patients (≥120 events).**
**Target: 400 patients (≥150 events) for robust calibration.**

---

## 3. Sample size for external validation (Riley 2021)

- **Reference:** Riley RD et al. *Stat Med* 2021;40:4230-51. doi:10.1002/sim.9025
- For external validation of a binary outcome model, Riley recommends:
  - **Minimum 100 events and 100 non-events** for stable calibration metrics.
  - **N ≥ 270 patients** (assuming event rate 0.37).
  - For tight 95% CI on AUC (half-width 0.05): N ≈ 250–300 patients.

**Target external validation cohort: 270–350 patients**.

---

## 4. Power calculation for AUC discrimination

### 4.1. Detecting AUC ≥0.75 vs null AUC = 0.50

Using Hanley & McNeil (1982) formula with allocation ratio (events:non-events) = 0.37 : 0.63:

| Target AUC | Required N (alpha=0.05, power=0.90) |
|------------|-------------------------------------|
| 0.70 | ~180 |
| 0.75 | ~110 |
| 0.80 | ~75 |

### 4.2. Detecting difference between two AUCs (Nivel 2 vs Nivel 3)

- Anticipated Nivel 2 AUC: ~0.72 (literature-derived)
- Anticipated Nivel 3 AUC: ~0.80 (institutional + ML)
- Δ AUC: 0.08
- Correlation between predictors (r): ~0.6 (same patient, related models)
- Required N (paired DeLong test, alpha=0.05, power=0.80): **~250 patients**.

### 4.3. 95% CI half-width for AUC ≈ 0.80

| N | Half-width 95% CI |
|---|-------------------|
| 200 | ±0.06 |
| 300 | ±0.05 |
| 400 | ±0.04 |
| 500 | ±0.035 |

→ **N ≈ 300 sufficient** to achieve target precision (±0.05).

---

## 5. Sensitivity analysis under different event rates

| Subtype scenario | Event rate (ypN0) | N required (10 EPP, 12 vars) |
|------------------|-------------------|-------------------------------|
| TNBC-enriched cohort | 0.50 | 240 |
| HER2+-enriched | 0.60 | 200 |
| Pooled (mixed) | 0.37 | 325 |
| HR+/HER2--enriched | 0.20 | 600 |

> **Implication:** if the institutional cohort is HR+-heavy, may need to **enrich enrollment
> for TNBC/HER2+** or extend abstraction to a longer time window.

---

## 6. Adjustment for missing data / loss

- Anticipated complete-case retention: 85% (15% loss to missing key variables).
- **Inflated N target for derivation:** 325 / 0.85 ≈ **385 patients to abstract**.
- For external validation: 270 / 0.85 ≈ **320 patients to request**.

---

## 7. Subgroup analyses — minimum n per subgroup

| Subgroup | Target n (for stable subgroup AUC) |
|----------|-------------------------------------|
| TNBC | ≥80 |
| HER2+ | ≥80 |
| HR+/HER2- | ≥80 |
| cN1 | ≥150 |
| cN2-N3 | ≥75 |
| Pre-IO era (<2020) | ≥150 |
| Post-IO era (≥2020) | ≥100 |

---

## 8. Summary table

| Phase | Target N | Justification |
|-------|----------|---------------|
| Development cohort (institutional) | **≥325 (≥120 events)** | Riley 2019 + 10 EPP rule |
| External validation cohort | **≥270 (≥100 events)** | Riley 2021 |
| Inflated for missing | ~385 to abstract | Assumes 15% loss |

---

## 9. Software for re-calculation

- R package `pmsampsize` (Ensor et al.):
  ```r
  install.packages("pmsampsize")
  library(pmsampsize)
  pmsampsize(type = "b", cstatistic = 0.80, parameters = 12,
             prevalence = 0.37)
  ```
- Online calculator: https://riskcalc.org/pmsampsize/

---

## 10. References

1. Riley RD, Snell KIE, Ensor J, et al. **Minimum sample size for developing a
   multivariable prediction model: PART II - binary and time-to-event outcomes.**
   Stat Med 2019;38:1276-96. doi:10.1002/sim.7992
2. Riley RD, Debray TPA, Collins GS, et al. **Minimum sample size for external
   validation of a clinical prediction model with a binary outcome.** Stat Med
   2021;40:4230-51. doi:10.1002/sim.9025
3. Hanley JA, McNeil BJ. **A method of comparing the areas under receiver operating
   characteristic curves derived from the same cases.** Radiology 1983;148:839-43.
   doi:10.1148/radiology.148.3.6878708
4. Vergouwe Y, Steyerberg EW, Eijkemans MJ, Habbema JD. **Substantial effective sample
   sizes were required for external validation studies of predictive logistic regression
   models.** J Clin Epidemiol 2005;58:475-83. doi:10.1016/j.jclinepi.2004.06.017
