Degrees of Freedom Calculator
Calculate degrees of freedom for one-sample and two-sample t-tests, Welch t-test, chi-square, and ANOVA from sample sizes and table dimensions.
What Are Degrees of Freedom?
Degrees of freedom (df) count how many independent values can vary when you compute a statistic. Sample size alone is not enough: constraints such as estimating a mean or matching row and column totals reduce the free pieces of information.
Formulas by Test
- 1-sample t-test: $df = N - 1$
- 2-sample t-test (equal variances): $df = N_1 + N_2 - 2$
- Welch t-test (unequal variances): Welch–Satterthwaite approximation using both sample sizes and variances
- Chi-square independence: $df = (rows - 1)(columns - 1)$
- ANOVA: $df_{\text{between}} = k - 1$, $df_{\text{within}} = N - k$, $df_{\text{total}} = N - 1$
How to Use This Calculator
Choose the test type, enter the required sample sizes or table dimensions, and read df instantly. After you know df, use the Critical Value Calculator or Chi Square Test Calculator for critical values and p-values.
Example
For a one-sample t-test with $N = 30$, $df = 29$. For a $3 \times 2$ contingency table, $df = (3-1)(2-1) = 2$. For ANOVA with $k = 4$ groups and $N = 40$ observations, $df_{\text{between}} = 3$ and $df_{\text{within}} = 36$.
Frequently Asked Questions
Why subtract 1 from sample size?
Estimating the mean uses one constraint. Once the mean is fixed, only $N - 1$ values can vary freely.
Can degrees of freedom be a decimal?
Yes for Welch's t-test. The Welch–Satterthwaite formula often yields a non-integer df that is used with the t distribution.
Can df be zero?
Theoretically yes, but a statistical test with df = 0 is not useful in practice. Increase sample size or reduce model constraints.
Which ANOVA df should I report?
Report both between-groups and within-groups df with the F statistic, for example F(3, 36). Total df is $N - 1$.
How does df affect critical values?
Larger df makes t and chi-square critical values closer to their large-sample limits. Small df requires larger test statistics to reach the same significance level.
Related Tools
Explore related statistics tools: