I know the "formula" is (# rows - 1) * (# columns -1). However, shouldn't the design of the experiment or observational study being conducted make a difference?

The only experimental design I can think of where 1 d.f. makes sense to me is for a 2x2 table when both margins are fixed - such as in Fisher's famous "lady tasting tea" experiment. Since both margins are fixed, we only need to know 1 of the 4 values within the 2x2 table to fill in the rest of the table, so only 1 value within the table is "free to vary" and therefore 1 d.f.

But what if instead we have an observational study, where only the total number in the sample is known? Now we need to know 3 of the 4 values in the 2x2 table before we can fill in the last value. So in this case, 3 values are "free to vary" and therefore 3 d.f.?

And finally, if we have 2 separate samples where the number in each sample is fixed by design, we need to know 2 values in the table before we can fill in the remaining 2 values; 2 are "free to vary" so 2 d.f.?

Apologies if above betrays a naive/incorrect understanding of how degrees of freedom actually work. As I have attempted to research the topic, this idea of values that are "free to vary" made some intuitive sense to me, so I became curious as to why it wouldn't work as described above for chi-square tests.


As far as I know, degrees of freedom in Chi Square distribution are related to the number of classes a population can be classified minus the linear restrictions used to estimate the parameters.

Originally, Karl Pearson provided Chi Square statistic to compare observed versus expected values in a contingency table, where you have a sample of size $n$ (this is always fixed) in $k$ different classes. He was based in the multinomial distribution, where sample size is fixed, and arrived at the expression used today of the sum of the squared difference between observed values and the expected, divided by the expected. At this point, we have $k$ classes and only $k-1$ of them "vary freely".

In a 2 by 2 table, we have 2 variables (or two samples) with 2 levels and in each one we have $(k-1)=1$ that vary freely. The total number of cells that vary freely then is $(k-1)(k-1)=1$ again.

If you think of one single variable with 4 levels, that wouldn't fit in a contingency table: it's just one factor, and in that case it is correct that applying a Chi Square test to assess goodness of fit will have 3 df.

  • $\begingroup$ Thanks for your answer. When you say "linear restrictions" is it correct to say that for your first case of a multinomial, the linear restriction is that the overall sample size is fixed, and in the case of the of the 2 variable case (two separate samples which is a product of binomials instead of a multinomial) the restriction for each binomial variable to add up their predetermined individual sample sizes? the 3 d.f. for the goodness of fit example you provided is intuitively easiest to think about. $\endgroup$ – user221943 Jun 19 '16 at 20:30
  • $\begingroup$ Yes, even if you're interested in measuring only one variable but you're considering two groups, those groups act as another variable and they are also constrained to sum up to the sample size. $\endgroup$ – Camila Burne Jun 19 '16 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.