F statistic for 3 nested models Given models M1 and M2, the first with q parameters and the second with p>q parameters, and assuming that M1 is nested in M2, then we can test the hypothesis that the smaller model is adequate by computing an F statistic:
$$
F_1 = \frac{(D_1 - D_2)/(p-q)}{D_1/ (n-p)}
$$
where $D_i$ is the deviance of model $i$, and which under the null hypotheses follows an $F(p-q, n-p)$ distribution.
Now, given a third model M3 such that M2 is nested in M3, and suppose that M3 has $g>p$ parameters. What does the following statistic test?
$$
F_2 = \frac{(D_1 - D_2)/(p-q)}{(D_2-D_3)/ (g-p)}
$$
When should we use $F_2$ instead of $F_1$ ?
 A: You could see this intuitively with ANOVA.
Normally you can split up the total variance in multiple sources/components of variance. Often you make a single split into two levels (within groups variance and between groups variance), but now you have an extra level.
For example say you make a comparison of exam results where each single student makes several exams and you have a level for different schools
$$\text{total variance} = D3 = \overbrace{\text{within students}}^{D_1} +  \overbrace{\text{between students}}^{ (D_2-D_1)} +\overbrace{\text{between schools}}^{ (D_3-D_2)}$$
An F-test relating to the latter two components can be used to test whether the contribution of the variance for these two is equal or not.
If the student has an effect then the measurements will be correlated and using $\frac{(D_2- D_3)/(q-g)}{(D_1-D_2)/ (p-q)}$ is better than using $\frac{(D_2-D_3)/(q-g)}{D_2/ (n-q)}$.
The effect of using $\frac{(D_2- D_3)/(q-g)}{(D_1-D_2)/ (p-q)}$ instead of $\frac{(D_2-D_3)/(q-g)}{D_2/ (n-q)}$ may be explained with the images example below.

Here we simulated a sample of 2 schools, 10 students in each school and each student 10 measurements.
The true difference between schools in the model was zero, but due to variation in the students the fitted difference is 0.25 which is not that much if you consider that the students have a variance around 1 (so the variance in the mean of ten students will be around 0.1 and 0.2 for the difference of the two classes/groups).
So the result should not be significant. You can see this also in the image where the scatter between the students is much larger than the difference between the classes. However, the analysis that uses $\frac{(D_2-D_3)/(q-g)}{D_2/ (n-q)}$ will assume that all the residuals within the same student are independent measurements as if it is a sample that measured 100 individual students per class (instead of 10 students per class with repetition per student). For very large samples a small difference between means can become significant (because the measurement is more precise if the sample is larger), but assuming a sample size of 100 is overestimating the precision of the measurement in this case.
set.seed(1)
X = rep(1:10, times = 100)
Y = rep(0:1, each = 500)
Xnoise = rnorm(20,0,1)
noise = rnorm(100,0,0.1)
Z = 0 * X + Xnoise[X+Y*10] + noise

plot( X+Y*10,Z , col = 1+Y,
     xlab = "student id",
     ylab = "result")
legend(1,-1.5, c("class 1","class 2"), col = c(1,2), pch = 1)

mod = lm(Z~0+Y)
anova(mod)

