Permutation Tests

Context: FIT2086_MOC · W10 · a hypothesis test whose null distribution is simulated rather than derived · the -value sibling of the Bootstrap (contrast table there) · the slope test it replaces ➔ [[Model Selection and Information Criteria (AIC, BIC)| for ]] · same idea powers random-forest %IncMSE ➔ Trees, Forests and kNN in R (rpart, randomForest, kknn) · Studio 10 R workflow ➔ Resampling Inference in R (boot, boot.ci, perm.log.reg) Parent Framework: Hypothesis Testing

Quick Revision

  • 🎯 Objective: shuffle against fixed , times ➔ refit ➔ the form an empirical null distribution of no association ➔ .
  • 📦 Core Components: vs | permutation keeps , breaks the pairing | correction ➔ smallest .
  • ⚡ Key Constraint: permute the targets only, without replacement — that is a shuffle; drawing with replacement is the bootstrap and does not simulate .

📝 How It Works

1. The Usual Test and Its Weak Point

  • Question ➔ pairs : is associated with ? In a linear model ⟹ test the slope, vs .
  • Usual procedure ➔ specify a population distribution ➔ compute a statistic (the least-squares ) ➔ see how likely it is under the derived null distribution.
  • Weak point ➔ the -value depends crucially on the assumed distribution and on deriving the null accurately (often via the CLT).

2. The Algorithm

  1. For to ➔ randomly permute the targets ➔ compute the association statistic .
  2. Observed ➔ compute the statistic on the real data.
  3. Compare ➔ how often the permutation distribution is at least as extreme ⟹ the -value of association.
  • Key idea ➔ under no association the values are exchangeable with respect to the predictors ⟹ permutations show how the estimate varies under the null.
  • Two-sided ➔ compare absolute values , matching .
  • correction ➔ the finite-simulation estimate counts the observed data as one of the arrangements ⟹ is never exactly ; resolution .

3. Strengths and Weaknesses

  • Strengths ➔ few assumptions about the population distribution · potentially more accurate -values for non-normal models (logistic regression, etc.) · easy to code and apply.
  • Weaknesses ➔ resolution set by (smallest ) · slow if each model fit is slow · assumes independent individuals.

4. Studio 10 — Permuting a Logistic Regression

  • Every coefficient at once ➔ shuffle the target column, refit the glm, store all coefficients ➔ one empirical null per coefficient; share of permutations with .
  • Which null is simulated ➔ permuting breaks its link with every predictor together ⟹ the global null “target independent of all predictors”. The glm Wald -values test given the other predictors, via an asymptotic normal ⟹ different hypotheses, so the two sets need not agree (Pima BP vs , AGE vs , SKIN vs ).
  • What it avoids ➔ under an appropriate exchangeability null, no asymptotic approximation; cost ➔ full model fits.
  • Monte Carlo noise ➔ at reruns visibly move a smallish (BP in one run, at ) ⟹ raise until the decision stops changing.
  • Reading the null histogram ➔ INS: sits inside a null spanning ⟹ · BP: lies beyond the null bulk ⟹ .
  • The zero floor in practice ➔ the studio’s perm.log.reg computes and prints for PREG, PLAS, BMI — the form of §2 would give .

🧮 Proof Blueprint

  • Theorem ➔ randomly permuting the observed values against fixed produces datasets distributed as under : no association.
  • Strategy ➔ factorise the joint, impose , then check which marginals a permutation preserves.
  • Derivation Steps:
  • Q.E.D. ➔ a permuted dataset is a draw from — exactly the joint under — so its statistics trace the null distribution with no normality assumption.

⚙️ Core Implementation

🔹 Permutation test for a regression slope

📊 Exam Execution Trace & Applied Exercises

Manual Execution Trace

BP on Age, (Lecture 6 data); observed , -test :

StepData?Running
unpermuted——
permutation 1no
permutation 2no
permutation 3no
centred on , almost all within rare
  • Reading ➔ after 3 permutations cannot go below — resolution, not evidence; at the permutation agrees closely with the normal-theory -test’s ⟹ strong evidence BP is associated with Age.

Applied Exercise

Problem: permutations of a logistic-regression coefficient; have . Find . What if none did?

Final Extracted Output: ⟹ strong evidence against ; with no exceedances report and raise if a smaller must be resolved.

⚠️ Common Mistakes

  • 💡 Shuffling and together ➔ moving whole rows changes nothing; only one side is permuted to break the pairing.
  • 💡 One-sided count for a two-sided test ➔ needs absolute values on both sides of the comparison.
  • 💡 Reporting ➔ with the correction the floor is .
  • 💡 Ignoring dependence ➔ exchangeability needs independent individuals; clustered or time-ordered data break it.

🧠 Active Recall