# What are my degrees of freedom?

Finds the degrees of freedom for a one-sample, paired, pooled or Welch t test, a chi-square goodness-of-fit or independence test, or a one-way ANOVA.

- Page: https://www.acalculator.org/statistics/degrees-of-freedom-calculator
- JSON spec: https://www.acalculator.org/statistics/degrees-of-freedom-calculator.json
- Version: 2240ea130d23

## Default answer

Example with the default inputs (Test One-sample t test, Sample size (n) 10): A one-sample t test with n = 10 has 9 degrees of freedom.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| test | Test | The statistical test you are running. |
| n | Sample size (n) | How many values (or pairs, for a paired test) there are. |
| n1 | Sample 1 size (n₁) | How many values are in sample 1. |
| n2 | Sample 2 size (n₂) | How many values are in sample 2. |
| s1 | Sample 1 standard deviation | The sample 1 standard deviation, greater than 0. |
| s2 | Sample 2 standard deviation | The sample 2 standard deviation, greater than 0. |
| k | Categories (k) | How many non-empty categories (cells) there are. |
| m | Estimated parameters | How many parameters of the expected distribution you estimated from the data (0 when it was given in advance). |
| r | Rows (r) | How many rows the contingency table has. |
| c | Columns (c) | How many columns the contingency table has. |
| groups | Groups (k) | How many groups are compared. |
| total | Total values (N) | How many values there are in all groups together. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| df | Degrees of freedom | The degrees of freedom of the test statistic (between groups, for ANOVA). |
| within | df within groups | N − k, the second degrees of freedom of the ANOVA F statistic. |
| totalDf | df total | N − 1 for the ANOVA. |
| pooled | Pooled df (equal variances) | n₁ + n₂ − 2, for comparison with Welch’s value. |
| formula | Formula | The formula with your numbers in it. |
| summary | In words | The test and its degrees of freedom. |

## Method

t: n − 1; pooled: n₁ + n₂ − 2; Welch: (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]; goodness of fit: k − (parameters + 1); table: (r − 1)(c − 1); ANOVA: k − 1 and N − k.

## Assumptions

- Welch’s degrees of freedom are not rounded; tables and some software round them down.
- For goodness of fit, k counts the non-empty categories, and the parameters are those estimated from the data.
- For a paired t test, n is the number of pairs.

## Worked examples

1. test = one, n = 10 gives df = 9. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.2 Confidence Limits for the Mean (t with N − 1 degrees of freedom), https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm (retrieved 2026-10-02).
2. test = pooled, n1 = 249, n2 = 79 gives df = 326. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3 Two-Sample t-Test for Equal Means (ν = N₁ + N₂ − 2 for equal variances; the Welch–Satterthwaite ν otherwise; N₁ = 249, N₂ = 79 gives ν = 326), https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm (retrieved 2026-10-02).
3. test = welch, n1 = 249, n2 = 79, s1 = 6.4147, s2 = 6.10771 gives df = 136.87499, pooled = 326. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3 Two-Sample t-Test for Equal Means (ν = N₁ + N₂ − 2 for equal variances; the Welch–Satterthwaite ν otherwise; N₁ = 249, N₂ = 79 gives ν = 326), https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm (retrieved 2026-10-02).
4. test = gof, k = 6, m = 2 gives df = 3. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.15 Chi-Square Goodness-of-Fit Test (k − c degrees of freedom, k non-empty cells, c = estimated parameters + 1), https://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm (retrieved 2026-10-02).
5. test = table, r = 3, c = 4 gives df = 6. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §7.4.5 How can we compare the results of classifying according to several categories? ((r − 1)(c − 1) for r rows and c columns), https://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm (retrieved 2026-10-02).
6. test = anova, groups = 3, total = 15 gives df = 2, within = 12, totalDf = 14. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §7.4.3.4 One-way ANOVA calculations (k − 1 for treatments, N − k for error), https://www.itl.nist.gov/div898/handbook/prc/section4/prc434.htm (retrieved 2026-10-02).

## FAQ

### What are degrees of freedom?

The number of values that are free to vary once the estimates a statistic uses are fixed. A sample of n values has n − 1 degrees of freedom around its mean, because the deviations from the mean must add to 0.

### How do I find the degrees of freedom for a t test?

One-sample or paired: n − 1 (n pairs for a paired test). Two samples with equal variances: n₁ + n₂ − 2. Two samples with unequal variances: Welch’s formula, which usually gives a decimal between the smaller n − 1 and n₁ + n₂ − 2.

### What is the Welch–Satterthwaite formula?

ν = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]. NIST gives it for the two-sample t test when the variances are not assumed equal. For NIST’s car data (249 and 79 cars, s = 6.4147 and 6.10771) it is 136.87, against 326 when pooled.

### How many degrees of freedom does a chi-square test have?

Goodness of fit: k − c, where k is the number of non-empty categories and c is the number of estimated parameters plus 1, so k − 1 when nothing is estimated. Independence in an r × c table: (r − 1)(c − 1).

### What are the degrees of freedom in a one-way ANOVA?

Two numbers: k − 1 between the groups and N − k within them, for k groups and N values. The F statistic uses both, written F(k − 1, N − k). With 3 groups of 5, that is F(2, 12).

### Should I round Welch’s degrees of freedom?

Software uses the decimal value with the t distribution directly. Printed t tables list whole degrees of freedom, so with a table round down, which gives a slightly larger, more cautious critical value.

## Sources

- NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.2 Confidence Limits for the Mean (the t distribution with N − 1 degrees of freedom). https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm (retrieved 2026-10-02)
- NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3 Two-Sample t-Test for Equal Means (ν = N₁ + N₂ − 2 for equal variances, the Welch–Satterthwaite ν for unequal ones; the car example with N₁ = 249, N₂ = 79 and ν = 326). https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm (retrieved 2026-10-02)
- NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.15 Chi-Square Goodness-of-Fit Test (k − c degrees of freedom). https://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm (retrieved 2026-10-02)
- NIST/SEMATECH e-Handbook of Statistical Methods, §7.4.5 How can we compare the results of classifying according to several categories? ((r − 1)(c − 1) for a contingency table). https://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm (retrieved 2026-10-02)
- NIST/SEMATECH e-Handbook of Statistical Methods, §7.4.3.4 One-way ANOVA calculations (k − 1 and N − k degrees of freedom). https://www.itl.nist.gov/div898/handbook/prc/section4/prc434.htm (retrieved 2026-10-02)
