I've calculated the following ANOVA table for a linear regression in R:
anova(lm(mpg ~ drat, mtcars))
Analysis of Variance Table
Response: mpg
Df Sum Sq Mean Sq F value Pr(>F)
drat 1 522.48 522.48 25.97 1.776e-05 ***
Residuals 30 603.57 20.12
---
I'm wondering how the degrees of freedom for the residuals are calculated. I can see it is n-2, but why minus 2?