# ANOVA with Two Within-Subject Variables (2 of 3)

Degrees of Freedom
The degrees of freedom for Subjects is equal to the number subjects minus one. In this example, this is N - 1 = 4 -1 = 3 since there are 4 subjects.

The degrees of freedom for each main effect is equal to the number of levels of the variable in question minus one. Therefore, since there are two days, the effect of Days has 2 - 1 = 1 degrees of freedom. There are three trials, so the effect of Trials has 3 - 1 = 2 degrees of freedom.

The degrees of freedom for the interaction of the two variables is equal to the product of the degrees of freedom for the main effects of these variables. Since Days has 1 df and Trials has 2 df, the Days x Trials interaction has 1 x 2 = 2 df. The formulas are summarized below:
df Subjects = N - 1 = 4 - 1 = 3
df Days = d - 1 = 2 - 1 = 1
df error(Days) = (N -1) (d-1) = 3
df Trials = t - 1 = 3 - 1 = 2
df error(Trials)= (N -1) (t-1) = 6
df Days x Trials= (d-1) (t-1) = 2
df error (Days x Trials) = (N-1) (d-1) (t-1) = 6
df total = dtN - 1 = (2)(3)(4) - 1 = 23
d is the number of days; t is the number of trials (each day); and N is the total number of subjects.