Why Degrees of Freedom Follow the Replicates
A single-cell experiment may contain thousands of measured cells but only a handful of independent donors. When the scientific target is a donor-population quantity, such as the average donor-level expression summary, the independent observations are the donors. The degrees of freedom in a donor-level test therefore come from the number of donor summaries and the model used to compare them, not from the number of cells assayed.
Degrees of freedom determine which reference distribution is used to assess a test statistic. In a t test, for example, the statistic is compared with a t distribution whose shape depends on \(df\). A smaller \(df\) gives heavier tails, reflecting greater uncertainty in estimating variability from a limited number of independent replicates. Degrees of freedom are not a general measure of how much data are available; they are tied to the independent information and constraints in a particular analysis.
Let \(x_i\) denote a summary for donor \(i\), such as a donor-level average for a cell type and gene. The summaries used in a one-sample analysis must represent independent donors drawn from the target donor population. In a two-group analysis, the summaries must also be independent across donors and groups. The relevant \(n\), \(n_1\), and \(n_2\) count donors, not cells.
One-Sample Degrees of Freedom
For a one-sample t test, suppose \(n\) independent donor summaries \(x_1,\ldots,x_n\) come from a normally distributed population with mean \(\mu\) and variance \(\sigma^2\). The test estimates \(\mu\) with \(\bar{x}\) and estimates \(\sigma\) with the sample standard deviation \(s\). The statistic for testing \(H_0:\mu=\mu_0\) is \(t=(\bar{x}-\mu_0)/(s/\sqrt{n})\), with \(df=n-1\) under the null model.
The subtraction of one has a direct explanation. The residuals \(x_i-\bar{x}\) obey the constraint \(\sum_{i=1}^n(x_i-\bar{x})=0\). Once \(n-1\) residuals are known, the final one is fixed by this equation. Thus only \(n-1\) residuals can vary independently, and the sample variance divides their squared sum by \(n-1\).
Worked Example: One-Sample Test Across Six Donors
Suppose six hypothetical donors have donor-level expression summaries \(2, 3, 4, 4, 5,\) and \(6\) log-expression units. The scientific reference value is \(\mu_0=3\) log-expression units. Assume the donor summaries are independent and plausibly sampled from a normal population; this makes the one-sample t reference distribution appropriate for the calculation.
The sample mean is \(\bar{x}=(2+3+4+4+5+6)/6=4\) log-expression units. The sum of squared deviations is \((2-4)^2+(3-4)^2+(4-4)^2+(4-4)^2+(5-4)^2+(6-4)^2=10\). Thus \(s^2=10/(6-1)=2\) squared log-expression units, and \(s=\sqrt{2}\).
The test statistic and degrees of freedom are \(t=(4-3)/(\sqrt{2}/\sqrt{6})=1.732\) and \(df=6-1=5\). There are six independent biological replicates, so there are five degrees of freedom for estimating donor-to-donor variation. The test is not assigned degrees of freedom based on how many cells contributed to each of the six summaries.
Two Independent Groups: Pooled Degrees of Freedom
For two independent groups, a classical pooled t test assumes independent donor summaries in each group, normally distributed outcomes within each group, and a common population variance \(\sigma^2\) in both groups. If there are \(n_1\) and \(n_2\) donors, the pooled estimate combines the two within-group sums of squared deviations. The group means are estimated separately, so each group contributes its donor count minus one residual degree of freedom.
This formula follows from the constraints within the groups. In group one, the deviations from \(\bar{x}\) sum to zero, leaving \(n_1-1\) independent deviations. In group two, deviations from \(\bar{y}\) sum to zero, leaving \(n_2-1\). The groups are independent, so their residual information adds. The pooled variance estimate has \(n_1+n_2-2\) degrees of freedom.
Worked Example: Pooled Test With Unequal Donor Counts
Consider hypothetical donor summaries for two conditions: group one has \(n_1=4\), mean \(\bar{x}=10.0\) units, and variance \(s_x^2=2.00\) squared units; group two has \(n_2=5\), mean \(\bar{y}=6.5\) units, and variance \(s_y^2=2.25\) squared units. Assume independent donors, approximately normal donor-level outcomes, and a common population variance. Test \(H_0:\mu_x-\mu_y=2\) units against a two-sided alternative.
The pooled variance is \(s_p^2=[(4-1)(2.00)+(5-1)(2.25)]/(4+5-2)=(6+9)/7=15/7=2.143\) squared units. The standard error is \(SE=\sqrt{s_p^2(1/n_1+1/n_2)}=\sqrt{(15/7)(1/4+1/5)}=\sqrt{0.9643}=0.9820\) units.
The observed mean difference is \(10.0-6.5=3.5\) units, so \(t=[(3.5)-2]/0.9820=1.527\), with \(df=4+5-2=7\). The two-sided p-value is approximately \(0.1705\). At significance level \(\alpha=0.05\), this is not sufficient evidence against the stated null difference. The degrees of freedom are seven because there are nine independent donors and two group means are estimated—not because of the cells contributing to their summaries.
Unequal Variances: Welch–Satterthwaite Degrees of Freedom
The pooled formula is not appropriate if the group variances differ substantially or if equal variance is not a defensible assumption. Welch’s two-sample t test does not pool the variances. Its standard error is \(\sqrt{s_x^2/n_1+s_y^2/n_2}\), and it uses the Welch–Satterthwaite approximation for degrees of freedom:
This value is generally not an integer. It approximates the reference degrees of freedom by matching the variability of the estimated variance in the Welch standard error. To see the justification, write \(a=s_x^2/n_1\) and \(b=s_y^2/n_2\). Under independent normal samples, the estimated variance contributions are independent, and their variances are estimated by \(2a^2/(n_1-1)\) and \(2b^2/(n_2-1)\). A scaled chi-squared random variable with \(df_{\mathrm{W}}\) degrees of freedom has variance equal to twice the square of its mean divided by \(df_{\mathrm{W}}\). Matching the variance of the sum \(a+b\) to this form gives \((a+b)^2/df_{\mathrm{W}}=a^2/(n_1-1)+b^2/(n_2-1)\), which rearranges to the displayed formula. This is an approximation, not an exact finite-sample t result in general.
Worked Example: Welch Degrees of Freedom
Suppose two hypothetical independent groups contain \(n_1=4\) and \(n_2=5\) donors, with donor-summary variances \(s_x^2=1.00\) and \(s_y^2=4.00\) squared units. Assume independent donors and approximately normal outcomes, but do not assume equal population variances. The Welch variance contributions are \(a=1.00/4=0.250\) and \(b=4.00/5=0.800\) squared units. Here \(1.00/4=0.250\).
Substitution gives \(df_{\mathrm{W}}=(0.250+0.800)^2[(0.250^2/3)+(0.800^2/4)]^{-1}\). The numerator is \(1.05^2=1.1025\). The denominator is \(0.0625/3+0.6400/4=0.02083+0.1600=0.18083\). Therefore \(df_{\mathrm{W}}=1.1025/0.18083=6.097\), approximately \(6.10\). The fractional value is expected: it is an approximation to the reference distribution, not a literal count of people or donors.
More Cells Do Not Create Donor Degrees of Freedom
Cells from the same donor share biological and technical features, so treating every cell as an independent replicate would generally violate the independence assumption for donor-population inference. The earlier material on choosing the unit of inference and pseudoreplication establishes why the donor, rather than each cell, is the relevant independent unit for a donor-level estimand. Once one summary is calculated per donor, the count used in the degrees-of-freedom formula is the number of donors with those summaries.
Increasing the number of cells measured for a donor can make that donor’s summary more stable with respect to cell sampling or measurement noise. It does not add a new independently sampled donor, nor does it remove the constraint that the donor-level residuals sum to zero after estimating a mean. Therefore, if the same \(n\) donors remain in the analysis, a one-sample test still has \(n-1\) degrees of freedom. A two-group pooled test still has \(n_1+n_2-2\), and a Welch test’s degrees of freedom remain functions of the donor counts and donor-level variances.
Worked Example: Adding Cells to Existing Donors
Imagine five hypothetical donors with donor-level summaries \(1, 2, 2, 3,\) and \(4\) normalized units. Assume these are independent, approximately normal donor outcomes, and compare their mean with a reference of zero. The mean is \(\bar{x}=12/5=2.4\) units. The squared deviations sum to \((1-2.4)^2+(2-2.4)^2+(2-2.4)^2+(3-2.4)^2+(4-2.4)^2=5.20\). Thus \(s^2=5.20/(5-1)=1.30\) squared units and \(SE=\sqrt{1.30/5}=0.5099\) units.
The t statistic is \(t=(2.4-0)/0.5099=4.707\), and \(df=5-1=4\). If the laboratory measures many more cells from these same five donors and the donor summaries remain the same, the calculation still uses \(n=5\) and \(df=4\). New independent donors could increase the donor-level degrees of freedom; additional cells from existing donors cannot.
Choosing and Checking the Degrees of Freedom
A reliable calculation begins by identifying what counts as an independent observation and what model is being used. For the simple tests covered here, check the following before interpreting a t statistic:
- Count donors, not cells. Confirm that each input to the test is one donor-level summary and count the independent donors in each group.
- Check the design. The two-group formulas above assume independent groups. If observations are linked or paired, a different analysis is needed; do not apply the independent-groups formula by default.
- Check variance assumptions. The pooled two-group degrees of freedom require a common population variance. If that assumption is doubtful, Welch’s method avoids pooling and uses its approximate degrees of freedom.
- Assess distributional plausibility. The exact small-sample t results rely on normally distributed donor outcomes. Strong skewness or influential donors can make the approximation unreliable, especially with few donors.
- Look for data loss or dependence. A donor excluded for missing or unusable summaries is not part of the analyzed sample. Related donors or repeated observations may not be independent merely because they have different identifiers.
A diagnostic warning is a degrees-of-freedom count that changes when only the number of cells per existing donor changes. That usually signals that cells have been counted as independent observations for a donor-level question. Another warning is reporting \(n-1\) without specifying what \(n\) counts: the formula is meaningless until the observational unit is clear.
Comparison and Limits
| Procedure | Degrees of freedom | Key condition |
|---|---|---|
| One-sample t test | \(n-1\) | Independent donor summaries; normality for exact small-sample inference |
| Pooled two-group t test | \(n_1+n_2-2\) | Independent groups, normal outcomes, common population variance |
| Welch two-group t test | Welch–Satterthwaite approximation | Independent groups; does not require equal population variances |
The pooled test has a simple integer degrees-of-freedom formula but can give misleading uncertainty if the common-variance assumption is poor. Welch’s test is often a useful alternative when variances or group sizes differ; its noninteger degrees of freedom reflect the approximation to the test’s reference distribution. Neither method repairs dependence among donors, severe departures from the assumed distribution with very few donors, or a mismatch between the donor-level test and the scientific estimand.
Degrees of freedom do not tell the whole story about precision. Donor heterogeneity, the spread of donor summaries, imbalance between groups, and the quality of each donor-level summary also matter. Nor should degrees of freedom be interpreted as the number of cells, genes, or total measurements. They describe the residual information available under a specified model for the independent units.
Check Your Understanding
Answer each question using donors as the observational units whenever the target is a donor-population quantity. Solutions follow the questions.
- A one-sample test uses summaries from 12 independent donors. What are its degrees of freedom?
- A pooled two-group test has 7 donors in one group and 9 in the other. Find its degrees of freedom and state the key variance assumption.
- Five donors are measured at 100 cells each, then at 1,000 cells each, with the same five donor summaries. Does the one-sample degrees of freedom change?
- Why can Welch degrees of freedom be noninteger, and what does the approximation match?
Solutions. (1) \(df=12-1=11\). (2) \(df=7+9-2=14\); the pooled test assumes a common population variance across the independent groups. (3) No. There are still five independent donor summaries, so \(df=5-1=4\). (4) Welch–Satterthwaite degrees of freedom approximate a t reference distribution by matching the variance of the estimated variance contributions to that of a scaled chi-squared quantity; the result need not be an integer.