If you are doing one-way ANOVA to test if there is a significant difference between groups, then implicitly you are comparing two nested models (so there is only one level of nesting, but it is still nesting).
Those two models are:
- Model 0: The values $y_{ij}$ (with $i$ the sample number and $j$ the group number) are modeled by the estimated mean, $\hat{\beta}_0$ of the entire sample.
$$ y_{ij} = \hat{\beta}_0 + \epsilon_i $$
Model 1: The values are modeled by the estimated means of the groups.
(and if we represent the the model by the between group variations,
$\hat{\beta_j}$ , then model 0 is nested inside model 1)
$$ y_i = \hat{\beta}_0 + \hat{\beta}_j + \epsilon_i $$
An example of comparing means and equivalence to nested models: let's take the sepal length (cm) from the iris data set (if we use all four variables we actually could be doing LDA or MANOVA as Fisher did in 1936)
The observed total and group means are:
$$\begin{array} \\
\mu_{total} &= 5.83\\
\mu_{setosa} &= 5.01\\
\mu_{versicolor} &= 5.94\\
\mu_{virginica} &= 6.59\\
\end{array}$$
Which is in model form:
$$\begin{array}\\
\text{model 1: }& y_{ij} = 5.83 + \epsilon_i\\
\text{model 2: }& y_{ij} = 5.01 + \begin{bmatrix} 0 \\ 0.93 \\ 1.58 \end{bmatrix}_j + \epsilon_i\\
\end{array}$$
The $\sum{\epsilon_i^2} = 102.1683$ in model 1 represents the total sum of squares.
The $\sum{\epsilon_i^2} = 38.9562$ in model 2 represents the within group sum of squares.
And the ANOVA table will be like (and implicitly calculate the difference which is the between group sum of squares which is the 63.212 in the table with 2 degrees of freedom):
> model1 <- lm(Sepal.Length ~ 1 + Species, data=iris)
> model0 <- lm(Sepal.Length ~ 1, data=iris)
> anova(model0, model1)
Analysis of Variance Table
Model 1: Sepal.Length ~ 1
Model 2: Sepal.Length ~ 1 + Species
Res.Df RSS Df Sum of Sq F Pr(>F)
1 149 102.168
2 147 38.956 2 63.212 119.26 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
with $$F = \frac{\frac{RSS_{difference}}{DF_{difference}}}{\frac{RSS_{new}}{DF_{new}}} = \frac{\frac{63.212}{2}}{\frac{38.956}{147}} = 119.26$$
data set used in the example:
petal length (cm) for three different species of Iris flowers
Iris setosa Iris versicolor Iris virginica
5.1 7.0 6.3
4.9 6.4 5.8
4.7 6.9 7.1
4.6 5.5 6.3
5.0 6.5 6.5
5.4 5.7 7.6
4.6 6.3 4.9
5.0 4.9 7.3
4.4 6.6 6.7
4.9 5.2 7.2
5.4 5.0 6.5
4.8 5.9 6.4
4.8 6.0 6.8
4.3 6.1 5.7
5.8 5.6 5.8
5.7 6.7 6.4
5.4 5.6 6.5
5.1 5.8 7.7
5.7 6.2 7.7
5.1 5.6 6.0
5.4 5.9 6.9
5.1 6.1 5.6
4.6 6.3 7.7
5.1 6.1 6.3
4.8 6.4 6.7
5.0 6.6 7.2
5.0 6.8 6.2
5.2 6.7 6.1
5.2 6.0 6.4
4.7 5.7 7.2
4.8 5.5 7.4
5.4 5.5 7.9
5.2 5.8 6.4
5.5 6.0 6.3
4.9 5.4 6.1
5.0 6.0 7.7
5.5 6.7 6.3
4.9 6.3 6.4
4.4 5.6 6.0
5.1 5.5 6.9
5.0 5.5 6.7
4.5 6.1 6.9
4.4 5.8 5.8
5.0 5.0 6.8
5.1 5.6 6.7
4.8 5.7 6.7
5.1 5.7 6.3
4.6 6.2 6.5
5.3 5.1 6.2
5.0 5.7 5.9
anova()
function, because the first, real, ANOVA is also using an F-test. This leads to terminology confusion. $\endgroup$anova()
function may do more than just ANOVA. This post supports your conclusion: stackoverflow.com/questions/20128781/f-test-for-two-models-in-r $\endgroup$