Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Degrees of Freedom

  1. Jun 14, 2017 #1
    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:

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

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

    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 im stuck with degrees of freedom

    One thing ive 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!
  2. jcsd
  3. Jun 14, 2017 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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.
  4. Jun 14, 2017 #3
    Thanks so much for the help. I see where I went wrong with the number of restrictions now
  5. Jun 18, 2017 #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?
  6. Jun 18, 2017 #5


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

  7. Jun 20, 2017 #6


    User Avatar
    Science Advisor

    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.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted