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: .

For paired data: the number of pairs.
My ToolboxYour inputs are saved in this browser only.

Result

Result
Degrees of freedom df = 19 (one-sample t-test, n = 20)
Calculation steps
  • df = n − 1 = 20 − 1 = 19.
One degree of freedom is lost for every estimated parameter: the mean costs one, hence n − 1.

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.

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