Model A and model B are compared on the same 5 cross-validation folds. A's accuracy minus B's accuracy, in percentage points, is . Run a paired t-test of "no difference" at 5% (the two-sided critical value for 4 degrees of freedom is ). Why should you be careful with this test?
Probability and statistics, Hypothesis testing
Level L2 Elementary. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you can run a paired t-test by hand and know why fold-based tests are only approximate.
Key idea
Pair the results, form differences , and test whether their mean is zero: with degrees of freedom.
Steps
- The differences are . Pairing removes fold-to-fold difficulty, because both models see the same fold.
- The mean is .
- The sample variance is , so .
- The standard error is , so .
- With 4 degrees of freedom, , so reject at 5% (the p-value is about ). It is only just significant.
- The caveat: the training sets of different folds overlap, so the are not independent. The variance is underestimated and the test rejects too often. Corrected tests, such as repeated cross-validation, exist.
Common mistakes
- Using an unpaired test, which throws away the pairing and has less power.
- Using 5 degrees of freedom instead of 4. That gives the wrong critical value ( instead of ) and a different decision at the margin.
- Treating the p-value of 0.047 as strong evidence. It sits right at the threshold, and the independence assumption is broken.
How long your answer should be
Half a page, 4 minutes.
Read this
Previous in Probability and statistics: In a sample of 100 emails, a rule fires on 40 of them. Of the 50 emails that are spam, the rule fires on 30. The 50 non-spam emails give the other 10 firings. The critical value for 1 degree of freedom at 5% is . According to a chi-squared test of independence, are the rule and the spam label independent?
Next in Probability and statistics: A classifier wrongly flags a transaction with probability , independently, and it scores transactions. How do you approximate the probability of at most 2 false flags, and why does the approximation work?