How to use this calculator
Free Chi-square degrees of freedom calculator. Find degrees of freedom for common chi-square tests from categories or a contingency table.
- Enter Test type, Rows or categories, Columns (independence only), Estimated parameters (goodness of fit). Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Degrees of freedom depend on the test design
A chi-square reference distribution is selected by its degrees of freedom. This page covers two different designs: a goodness-of-fit test for one categorical variable and an independence test for a two-way table.
Inputs for this calculation
- Test type: Choose goodness-of-fit when comparing category counts with a specified distribution; choose independence for a rows-by-columns table.
- Rows or categories: For goodness-of-fit, this is the number of nonempty categories. For independence, it is the table row count.
- Columns (independence only): Enter the table column count; the independence calculation needs at least two rows and two columns.
- Estimated parameters (goodness of fit): Count distribution parameters estimated from the same observations. This is not the number of expected cells.
Formula and method
For goodness-of-fit, df = k − 1 − p, where k is the number of categories and p is the number of parameters estimated from the sample. For independence, df = (r − 1)(c − 1). These formulas represent different null models, so use the test type that matches how the expected counts were formed.
Worked example
Suppose a five-category goodness-of-fit model estimates two parameters from the observed data. The remaining degrees of freedom are 5 − 1 − 2 = 2. If instead a table has 3 rows and 4 columns, its independence test has (3 − 1)(4 − 1) = 6 degrees of freedom.
Reading the result
Degrees of freedom determine which chi-square reference curve is used when a separate test statistic is converted to a p-value or critical value. They are not a measure of sample size or effect strength.
Assumptions and limits
The parameter adjustment applies only to parameters fitted from the data used in the goodness-of-fit test. A parameter fixed in advance is not subtracted. The resulting degrees of freedom must be positive.
Frequently asked questions
When do I subtract estimated parameters?
Subtract parameters only when they were estimated from the same sample to build the expected distribution. A fully specified distribution has p = 0.
Why are there two formulas here?
A one-way goodness-of-fit model has one total-count constraint; an independence table has row and column constraints, giving (r − 1)(c − 1).
How do I use the Chi-square degrees of freedom calculator?
Enter Test type, Rows or categories, Columns (independence only), Estimated parameters (goodness of fit). Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Chi-square degrees of freedom?
Suppose a five-category goodness-of-fit model estimates two parameters from the observed data. The remaining degrees of freedom are 5 − 1 − 2 = 2. If instead a table has 3 rows and 4 columns, its independence test has (3 − 1)(4 − 1) = 6 degrees of freedom.
What does the Chi-square degrees of freedom calculator calculate?
Free Chi-square degrees of freedom calculator. Find degrees of freedom for common chi-square tests from categories or a contingency table.