AP Stats Degrees of Freedom Calculator
Degrees of freedom (df) tell a t-distribution or chi-square distribution how spread out to be. Pick the test, enter the sample sizes or table size, and this calculator gives the df — and explains what that df is used for.
Degrees of Freedom Calculator
Interactive visual: Live preview
Press Show live preview to redraw this chart from your calculator inputs.
What Are Degrees of Freedom?
Degrees of freedom is the number of values in a calculation that are free to vary. For a one-sample t-test it is n - 1, because once you know the sample mean, only n - 1 of the values can change freely. The t-distribution and chi-square distribution both change shape with their degrees of freedom.
Interactive visual: See the idea
Example: one-sample t with n = 25 gives df = 25 - 1 = 24.
How to Use This Calculator
Interactive visual: Walk through it
Step 1: Open the AP Stats Degrees of Freedom Calculator calculator at the top and enter the values it asks for.
1. Choose the test you are doing. 2. Only the inputs for that test appear. 3. Enter the sample size, or the number of categories, rows, and columns. 4. Press Calculate. The result shows the formula, the df, and what the df is used for in that test.
How to Calculate Degrees of Freedom
Interactive visual: See it on a chart
Press Update visual to redraw this chart from your calculator inputs.
| Test | Formula |
|---|---|
| One-sample t | df = n − 1 |
| Two-sample t (conservative) | df = smaller of (n1 − 1) and (n2 − 1) |
| Chi-square goodness of fit | df = number of categories − 1 |
| Chi-square independence / homogeneity | df = (rows − 1) × (columns − 1) |
| Linear regression slope test | df = n − 2 |
Worked examples: One-sample t with n = 25 gives df = 25 − 1 = 24. A chi-square test on a 3 × 2 table gives df = (3 − 1) × (2 − 1) = 2. A regression with n = 20 points gives df = 20 − 2 = 18, because two values (slope and intercept) are estimated from the data.
Tips and Common Mistakes
Interactive visual: Mistake vs correct
Mistake: Using n instead of n - 1 for a one-sample test.
- Do not use n for a t-test. A t-test always loses at least one degree of freedom for the estimated mean.
- For two-sample t, the conservative df is the smaller of the two (n − 1) values — it is safe, but not the exact software df.
- For chi-square, count categories, rows, and columns in the table you actually test, not in the raw data list.
- Regression uses n − 2, not n − 1, because both the slope and the intercept are estimated.
- Always report the df with your test statistic, for example t = 2.14 with df = 24.
Frequently Asked Questions
Interactive visual: FAQ
Tap any question below to show or hide its answer.
What are degrees of freedom, in plain language?
They are the number of values that are free to vary after estimates are made. If you estimate a mean from n values, one value is fixed by that mean, so df = n − 1.
Why does df change the t-distribution?
With small df, the t-distribution has heavier tails than the normal distribution, because the standard deviation is estimated. As df grows, the t-distribution gets closer to normal.
Why is two-sample df conservative here?
Exact two-sample df uses a complicated formula. AP Statistics accepts the conservative choice, the smaller of n1 − 1 and n2 − 1, which gives a slightly larger p-value and is safe for the exam.
Does a z-test have degrees of freedom?
No. A z-test uses the normal distribution and a known population standard deviation, so there is no df to look up.
Why does chi-square goodness of fit use categories − 1?
Once the total count is fixed, the last category count is determined by the others, so one degree of freedom is lost.
What df do I use for a paired t-test?
Use the one-sample option with n = number of pairs, so df = number of pairs − 1. A paired test is a one-sample test on the differences.
AP is a trademark of the College Board, which was not involved in this site.
Related Calculators and Guides
Keep exploring AP Statistics with calculators and guides related to this tool.
Related Calculators
Interactive visual: Tool path
Start with this tool, then follow the path through the related calculators.
Degrees of Freedom Calculator → T-Test Calculator → Chi-Square Calculator