Calculating Degrees of Freedom for Chi-Squared & P Value

In summary, the conversation is discussing how to calculate the degrees of freedom for a chi-squared and p value. The data includes the number of people with no pets, 1 pet, and 2+ pets in England, Scotland, and Wales. The two methods for calculating degrees of freedom give the same answer of 4. The conversation also discusses applying the "number of restrictions" method and clarifies that there are five restrictions in this scenario. Finally, the conversation mentions applying this concept to a situation involving a random number generator and a table of one row and 10 columns, which would result in 9 degrees of freedom.
  • #1
lola2000
13
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
  • #2
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.
 
  • #3
Thanks so much for the help. I see where I went wrong with the number of restrictions now
 
  • #4
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?
 
  • #5
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.
 
  • #6
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.
 

1. What is the formula for calculating degrees of freedom for chi-squared?

The formula for calculating degrees of freedom for chi-squared is (r-1)(c-1), where r is the number of rows and c is the number of columns in the contingency table.

2. How is the chi-squared test used to determine the significance of a relationship between two variables?

The chi-squared test is used to determine if there is a significant relationship between two categorical variables. It does this by comparing the observed frequencies in a contingency table to the expected frequencies, assuming there is no relationship between the variables. The resulting chi-squared value is then compared to a critical value to determine if the relationship is statistically significant.

3. How do you calculate the p-value for a chi-squared test?

The p-value for a chi-squared test is calculated by finding the area under the chi-squared distribution curve that is greater than or equal to the observed chi-squared value. This can be done using a table of critical values or a statistical software program.

4. What is considered a statistically significant p-value for a chi-squared test?

A p-value of less than 0.05 is generally considered statistically significant for a chi-squared test. This means that there is less than a 5% chance that the observed relationship between the variables is due to chance alone.

5. Can the degrees of freedom for a chi-squared test be negative?

No, the degrees of freedom for a chi-squared test cannot be negative. It is always a positive number and is equal to (r-1)(c-1), where r is the number of rows and c is the number of columns in the contingency table.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
20
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
22
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
7K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
3K
Back
Top