Calculating Degrees of Freedom for Chi-Squared & P Value

Click For Summary

Discussion Overview

The discussion revolves around calculating degrees of freedom in the context of chi-squared tests and p-values, with specific examples provided. Participants explore different methods for determining degrees of freedom based on the structure of data tables and restrictions involved.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant suggests that degrees of freedom can be calculated using the formula dof = (rows - 1) * (columns - 1), resulting in 4 for their data set.
  • Another participant agrees with the first method and provides an alternative approach based on counting restrictions, identifying five restrictions that lead to the same degrees of freedom of 4.
  • A later reply indicates a misunderstanding of the restrictions method but acknowledges the clarification provided by another participant.
  • Two participants pose a similar question regarding a random number generator producing numbers between 0 and 9, questioning if the degrees of freedom would be 9, to which one participant confirms this is correct.
  • Another participant introduces a general formula for degrees of freedom, stating it is a function of independent parameters and observations, suggesting a broader application of the concept.

Areas of Agreement / Disagreement

There is some agreement on the methods for calculating degrees of freedom, particularly the (rows - 1) * (columns - 1) formula. However, there is also a discussion about the counting of restrictions, which may lead to different interpretations. The question regarding the random number generator also indicates a shared understanding, but the overall discussion remains somewhat unresolved regarding the broader application of degrees of freedom.

Contextual Notes

Participants express varying levels of understanding regarding the counting of restrictions and the application of degrees of freedom in different contexts. The discussion highlights the potential for confusion in applying these concepts across different statistical scenarios.

lola2000
Messages
12
Reaction score
0
I am trying to understand how to decide the number of degrees of freedom when calculating a chi-squared and p value.

I have the data:

England:
people with no pets = 665
people with 1 pet = 976
people with 2+ pets = 913

Scotland
people with no pets = 313
people with 1 pet = 527
people with 2+ pets = 506

Wales
people with no pets =302
people with 1 pet = 440
people with 2+ pets = 358

I've calculated the expected frequency and therefore the (observed - expected)^2 / expected for each cell but I am stuck with degrees of freedom

One thing I've found says dof = (rows-1 ) * (col -1 ) which would = 2 * 2 = 4
another thing says dof = number of cells - number of restrictions = 9 - 2 = 7
where number of restrictions is number of things you are categorising by

can someone clarify this please!
 
Physics news on Phys.org
Both methods are correct and give the same answer, which is 4.
To apply the 'number of restrictions' method we need to count the restrictions carefully. There are five restrictions, being:
  • items in column 1 must add to column total 1
  • items in column 2 must add to column total 2
  • items in column 3 must add to column total 3
  • items in row 1 must add to row total 1
  • items in row 2 must add to row total 2
We don't need a restriction on row 3 because it is already implied by the five restrictions above, as
total row 3 = tot col 1 + tot col 2 + tot col 3 - tot row 1 - tot row 2

I suggest sticking with the (r-1) x (c-1) mnemonic, as it's easier to remember.
 
Thanks so much for the help. I see where I went wrong with the number of restrictions now
 
Similar question but how would this hold true for a situation where you have a random number generator producing numbers between 0 and 9 and you are counting their frequency? So you would have a table of one row and 10 columns.

Degrees of freedom is 9?
 
lola2000 said:
Similar question but how would this hold true for a situation where you have a random number generator producing numbers between 0 and 9 and you are counting their frequency? So you would have a table of one row and 10 columns.

Degrees of freedom is 9?
Yes.
 
Hey lola2000.

The degrees of freedom is a function of the number of independent parameters in the model in addition to how many independent observations exist within the sample.

If you can understand this then you will be able to get an arbitrary value for the degrees of freedom of any statistic.

You use D = I - P where I is the number of independent sample points and P is the number of independent parameters being assessed.

Different test statistics use different rules to get it but the idea above is central to that of all statistics.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 7 ·
Replies
7
Views
6K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 22 ·
Replies
22
Views
5K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 5 ·
Replies
5
Views
9K