13: Degrees of Freedom

woman chasing fish with net

When doing a chi-square goodness of fit test, there is one last wrinkle to iron out, called degrees of freedom.

When I told you that 42 out of 100 sickdays were on Mondays or Fridays, you automatically knew that 58
had to be in the middle of the week, right? I was “free” to specify how many were on Monday/Friday,
but then I was NOT “free” to decide how many were on non-Monday/Friday. So we say that, in this problem,
there is only 1 degree of freedom.

Say you flip a coin 100 times. If we want to do a chi-square test to determine whether a coin is fair (lands equally on heads and tails), how many degrees of freedom would the test have?

 

It is possible to do chi-square tests using more than 2 variables. For example, let’s say I got data
on how many sickdays fell on EACH of the five weekdays:

day observed expected
mon 22 20
tues 19 20
wed 19 20
thurs 20 20
fri 20 20

We could do a chi-square test to check whether the distribution of sickdays matched our expectations for ALL FIVE weekdays

How many degrees of freedom would this test have?