Degrees of Freedom Calculator
This degrees of freedom calculator gives you the df you need for t, chi-square and F tables. Example: a one-sample t-test with n = 20 has df = 19 degrees of freedom.
Example: Which test: t-test, one sample or paired · Sample size n 20 → Result: Degrees of freedom df = 19 (one-sample t-test, n = 20). Source: NIST/SEMATECH e-Handbook – Two-sample t-test. Updated: .
How it is calculated
Degrees of freedom (df) tell you how many values in a calculation are still free to vary once parameters such as the mean are fixed. They set the shape of the t, chi-square and F distributions and therefore the critical value and the p-value.
Formulas by test
A one-sample t-test and paired data use df = n − 1. Two independent samples with equal variance have df = n₁ + n₂ − 2. The Welch test uses a weighted approximation in which s₁²/n₁ and s₂²/n₂ appear. For a chi-square test on a contingency table df = (rows − 1) · (columns − 1), and one-way ANOVA has df₁ = k − 1 between and df₂ = N − k within the groups.
Worked examples
With n = 20 observations the one-sample t-test has 19 degrees of freedom. Two groups of 12 and 15 people give 12 + 15 − 2 = 25. A table with 3 rows and 4 columns gives 2 · 3 = 6. With three groups and 30 observations in total, ANOVA has 2 and 27 degrees of freedom, together 29 = N − 1. For the Welch test with n₁ = 12, s₁ = 4, n₂ = 15 and s₂ = 5 you get df ≈ 24.998.
- More degrees of freedom make the t distribution narrower; from about 30 on it is close to the normal distribution.
- If you cannot be sure the group variances are equal, the Welch test is the safer choice.
Frequently asked questions
What are degrees of freedom?
The number of values that can vary freely once sums or means are fixed. With n values and a known mean only n − 1 are free; the last one is determined.
How many degrees of freedom does a two-sample t-test have?
With equal variances n₁ + n₂ − 2, so 25 for groups of 12 and 15. The Welch test computes a fractional value from the variances.
How do you find degrees of freedom for a chi-square test?
Multiply the number of rows minus 1 by the number of columns minus 1. A table with 3 rows and 4 columns has 2 · 3 = 6 degrees of freedom.
Sources and legal basis
As of: · Editorial policy
Related tools
- Confidence Interval CalculatorConfidence interval calculator for a mean (t or z) and a proportion (Wilson): with margin of error, critical value, steps and a 90, 95 or 99 percent level.
- P-Value CalculatorP-value calculator from a z-score, t-score or chi-square, or straight from a t-test with means, SDs and n – plus critical value and confidence interval.
- Chi Square Test CalculatorChi square test calculator for contingency tables and goodness of fit: chi², degrees of freedom, p-value, expected counts and Cramér’s V, with all steps.
- Standard Error CalculatorStandard error calculator for raw data or for standard deviation and sample size: SE = s / √n with steps, mean and variance shown for every result.
- Sample size calculatorSample size calculator for surveys: required number of respondents from confidence level, margin of error and proportion – with finite population correction.
- Standard deviation calculatorStandard deviation calculator for a list or frequency table: switch between sample (s) and population (σ), see every step in a table, plus a box plot.
- Online CalculatorCalculator online, free and instant: type or tap and see the answer as you go – order of operations, brackets, percent, square root, steps and a history list.
- Degree classification calculator (UK)Degree classification calculator for UK honours degrees: enter your year averages and their weighting to see your class and the final-year mark you need.
- LM317 calculator: output voltage, R2 and constant currentLM317 calculator: output voltage from R1 and R2, R2 for a target voltage or the resistor for a constant current source, using the TI data sheet formula.