# How can I calculate degrees of freedom for factorial ANOVA?

I've run a factorial ANOVA investigating the effects of depth and breakage on length but also including species as a factor for control. It's given me 1 for the degrees of freedom and I don't understand how to find the 'within' and 'between' degrees of freedom. Can I work these out manually from the variables I've put in? (Would be a lot easier than trying to go back into R).

Here's the code I used:

> model<-lm(Length~Breakage+Depth+Species,data=pond2)
> Anova(model,type="II")
Anova Table (Type II tests)
Response: Length
Sum Sq       Df   F value      Pr(>F)
Breakage        5134        1    21.9780     5.097e-06 ***
Depth          3          1    0.0112         0.916
Species         27273       1   116.7572    < 2.2e-16 ***
Residuals  46718 200
---


We were looking at shells - there were 204 shells in total. Each shell was categorised as broken - yes or no - and by depth - buried or surface. There were 2 different species. No interaction terms were included (a lot of the explanations I've been looking at include interaction dfs - I don't know whether this applies with no interaction terms in the model?).

What df should I quote in my results? So far my best guess is 3 (the sum of the factors' df) and 201 (the total sample size minus the sum of the factors' df).

Thank you very much for any help!

• Which "results" are you quoting, given that there are three tests reported in this output? – whuber Apr 18 '18 at 18:35
• I was told that this is how you do a factorial anova - we're reporting the results for breakage and depth. – Rose Apr 18 '18 at 19:33
• Short answer, n - 4. Longer answer, the df for each factor is the number of categories or levels of the factor minus 1. Thus, each of your factors above has two levels. The residual df is N minus the sum of the degrees of freedom for each factor (and interactions, etc.) plus 1 for the grand mean. Thus, in your above example, it would be N - 4. – dbwilson Apr 18 '18 at 20:59