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 2,1,3,0,4. Run a paired t-test of "no difference" at 5% (the two-sided critical value for 4 degrees of freedom is 2.776). 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 di, and test whether their mean is zero: t=dˉsd/n with n−1 degrees of freedom.

Steps

  1. The differences are d=(2,1,3,0,4). Pairing removes fold-to-fold difficulty, because both models see the same fold.
  2. The mean is dˉ=10/5=2.
  3. The sample variance is sd2=(0)2+(−1)2+(1)2+(−2)2+(2)24=104=2.5, so sd=1.581.
  4. The standard error is sd/5=0.5=0.707, so t=2/0.707=2.83.
  5. With 4 degrees of freedom, 2.83>2.776, so reject at 5% (the p-value is about 0.047). It is only just significant.
  6. The caveat: the training sets of different folds overlap, so the di are not independent. The variance is underestimated and the test rejects too often. Corrected tests, such as repeated 5×2 cross-validation, exist.

Common mistakes

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 3.84. 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 p=0.003, independently, and it scores n=1000 transactions. How do you approximate the probability of at most 2 false flags, and why does the approximation work?