Tutorials › High-Dimensional Genomic Data Analysis › Deriving the Moderated t-Statistic

Linear Models for Expression Microarrays · Tutorial 394 of 795

Deriving the Moderated t-Statistic

See how posterior variance shrinkage changes a gene-wise standard error and produces a moderated t-statistic with an increased reference degrees of freedom.

Intermediate 11 min read

What You'll Learn

  • Derive the moderated standard error from a posterior variance estimate.
  • Form a moderated t-statistic for a coefficient or contrast.
  • Explain why the reference degrees of freedom combine residual and prior degrees of freedom.
  • Check the normal-model and variance-prior assumptions behind the reference distribution.
  • Compare moderated and ordinary t-statistics and recognize their limitations.

Why Moderate a Gene-Wise t-Statistic?

In an expression microarray, a linear model is fitted separately for each gene. The estimated coefficient or contrast describes the expression difference of interest, while the residual variance describes the gene’s unexplained variability. With few samples, that variance estimate can be unstable. A very small residual variance can produce an unusually small standard error and a large t-statistic; a very large one can do the reverse.

The moderated t-statistic retains the gene’s estimated effect but replaces its ordinary residual variance with a posterior variance estimate. This estimate combines information from that gene with a variance prior shared across genes. The resulting standard error is moderated, and the reference degrees of freedom include both the gene’s residual degrees of freedom and the prior degrees of freedom. The derivation below treats the prior parameters as fixed; estimating them across genes is a separate step.

Definition: For gene \(g\), let \(s_g^2\) be its residual variance estimate with \(d_g\) residual degrees of freedom. Let \(s_0^2\) and \(d_0\) be the scale and degrees of freedom of a scaled inverse-chi-squared prior for the gene’s variance. Its posterior variance estimate and moderated degrees of freedom are $$ s_{g,\mathrm{post}}^2=\frac{d_0s_0^2+d_gs_g^2}{d_0+d_g}, \qquad d_{g,\mathrm{total}}=d_0+d_g. $$ For a contrast \(c^\top\beta_g\), the moderated t-statistic for testing \(H_0:c^\top\beta_g=0\) is $$ t_{g,\mathrm{mod}}= \frac{c^\top\hat{\beta}_g} {\sqrt{s_{g,\mathrm{post}}^2v_g}}, $$ where \(\hat{\beta}_g\) is the gene’s coefficient estimate and \(v_g\) is the design-dependent variance factor for that contrast.

Model, Assumptions, and the Test Statistic

For clarity, consider an unweighted gene-wise linear model with \(n\) observations:

$$ y_g=X\beta_g+\varepsilon_g,\qquad \varepsilon_g\mid\sigma_g^2\sim N(0,\sigma_g^2I). $$

Here \(y_g\) is the expression vector for gene \(g\), \(X\) is a full-column-rank design matrix, and \(\beta_g\) is the vector of gene-specific coefficients. The errors are assumed independent, normally distributed, and of common variance \(\sigma_g^2\) within a gene. If \(X\) has \(p\) columns, the residual degrees of freedom are \(d_g=n-p\), and \(s_g^2=\mathrm{RSS}_g/d_g\). For a contrast \(c\), the ordinary least-squares estimate has variance \(\sigma_g^2v_g\), where \(v_g=c^\top(X^\top X)^{-1}c\). Thus \(v_g\) captures the design and contrast; it is not another estimate of residual variance.

The variance prior is parameterized as \(\sigma_g^2\sim\) scaled inverse-chi-squared with scale \(s_0^2\) and degrees of freedom \(d_0\). It is a prior distribution for the gene-wise variance, not for the coefficient being tested. Under this parameterization, its mean is \(d_0s_0^2/(d_0-2)\) when \(d_0>2\); the posterior variance formula itself is defined for positive degrees of freedom. The conjugate update weights the prior scale and the observed residual variance by their respective degrees of freedom.

For a general null value \(\theta_0\), test \(H_0:c^\top\beta_g=\theta_0\) with

$$ t_{g,\mathrm{mod}}= \frac{c^\top\hat{\beta}_g-\theta_0} {\sqrt{s_{g,\mathrm{post}}^2v_g}}. $$

The estimated contrast in the numerator stays the same as in the ordinary linear-model analysis. The variance estimate in the denominator changes, and the reference degrees of freedom become \(d_0+d_g\), rather than \(d_g\).

Why the Reference Distribution Is a t Distribution

The reference distribution follows from the normal linear model and the scaled inverse-chi-squared variance prior, assuming the prior parameters \(d_0\) and \(s_0^2\) are fixed. The key facts are that the contrast estimate is independent of the residual sum of squares under the normal model, and that the prior contributes an additional chi-squared term to the variance estimate.

To see this, represent the prior variance as \(\sigma_g^2=d_0s_0^2/U\), where \(U\sim\chi^2_{d_0}\). Under the model, the residual sum of squares divided by \(\sigma_g^2\) is \(V=d_gs_g^2/\sigma_g^2\sim\chi^2_{d_g}\), independently of the standardized contrast estimate. Under \(H_0\), write \(Z=(c^\top\hat{\beta}_g-\theta_0)/\sqrt{\sigma_g^2v_g}\); then \(Z\sim N(0,1)\). With the prior and model independence assumptions, \(Z\) is independent of \(U\) and \(V\), and \(U+V\sim\chi^2_{d_0+d_g}\).

$$ s_{g,\mathrm{post}}^2 =\frac{\sigma_g^2U+\sigma_g^2V}{d_0+d_g} =\sigma_g^2\frac{U+V}{d_0+d_g}, \qquad t_{g,\mathrm{mod}} =\frac{Z}{\sqrt{(U+V)/(d_0+d_g)}}. $$

The final expression is a standard Student t ratio: a standard normal divided by the square root of an independent chi-squared variable divided by its degrees of freedom. Therefore, under \(H_0\) and these assumptions, \(t_{g,\mathrm{mod}}\sim t_{d_0+d_g}\). This justifies using that distribution to calculate a p-value for the specified contrast.

In practice, the prior parameters are often estimated from many genes. If they are then treated as fixed when calculating a gene’s p-value, the stated t reference is conditional on those estimates; it does not account for uncertainty in estimating the prior. The exact reference result above applies when the hyperparameters are fixed under the model.

Worked Example: Calculating a Moderated t-Statistic

Suppose a hypothetical gene has an estimated contrast of \(0.25\) log-expression units, \(s_g^2=0.0400\) squared log-expression units, and \(d_g=4\). Let the fixed prior parameters be \(s_0^2=0.0650\) squared log-expression units and \(d_0=8\). The design variance factor for the contrast is \(v_g=0.25\). Test \(H_0:c^\top\beta_g=0\) against a two-sided alternative at \(\alpha=0.05\).

First calculate the posterior variance: $$ s_{g,\mathrm{post}}^2 =\frac{8(0.0650)+4(0.0400)}{8+4} =\frac{0.520+0.160}{12} =0.05667. $$ Its units are squared log-expression units. The moderated standard error is $$ SE_{\mathrm{mod}}=\sqrt{0.05667(0.25)} =\sqrt{0.0141675} =0.1190 $$ log-expression units. Thus $$ t_{g,\mathrm{mod}}=\frac{0.25}{0.1190}=2.100, \qquad df=8+4=12. $$

The two-sided p-value from a \(t_{12}\) reference distribution is approximately \(0.05751\). Since \(0.05751>0.05\), this test does not reject \(H_0\) at the 5% level. The result is not a 5% test’s evidence that the null is true; it says that this statistic is not sufficiently extreme under the specified reference test. The estimated contrast remains \(0.25\) log-expression units.

Further Examples and Comparisons

Worked Example: Moderation Compared With the Ordinary t-Statistic

For a second hypothetical gene, suppose the estimated contrast is \(0.20\) log-expression units, \(s_g^2=0.0900\), \(d_g=4\), and \(v_g=0.16\). Use prior parameters \(s_0^2=0.0400\) and \(d_0=6\). The model and prior assumptions are as above.

The posterior variance and moderated standard error are $$ s_{g,\mathrm{post}}^2 =\frac{6(0.0400)+4(0.0900)}{10} =\frac{0.240+0.360}{10} =0.0600, \qquad SE_{\mathrm{mod}}=\sqrt{0.0600(0.16)}=\sqrt{0.0096}=0.09798. $$ Therefore \(t_{g,\mathrm{mod}}=0.20/0.09798=2.041\), with \(df=10\). The two-sided 5% critical value is approximately \(2.228\), so this moderated test does not reject \(H_0\).

For comparison, the ordinary standard error is \(\sqrt{0.0900(0.16)}=0.1200\), giving \(t_{\mathrm{ordinary}}=0.20/0.1200=1.667\) with \(df=4\). The posterior variance is smaller than this gene’s observed residual variance because the prior scale is smaller, so moderation reduces the standard error. This example illustrates the calculation, not a general guarantee that moderation increases a statistic: if a gene’s residual variance is below the prior scale, the posterior variance can instead increase it.

Worked Example: Testing a Nonzero Contrast Value

Suppose a third hypothetical gene has an estimated contrast of \(0.70\) log-expression units. The scientific null is \(H_0:c^\top\beta_g=0.20\), rather than zero. Let \(s_g^2=0.0500\), \(d_g=5\), \(s_0^2=0.0350\), \(d_0=10\), and \(v_g=0.0900\). Assume the same normal model and fixed-prior conditions.

The posterior variance is $$ s_{g,\mathrm{post}}^2 =\frac{10(0.0350)+5(0.0500)}{15} =\frac{0.350+0.250}{15} =0.0400. $$ The moderated standard error is \(\sqrt{0.0400(0.0900)}=0.0600\) log-expression units. Centering the numerator at the null value gives $$ t_{g,\mathrm{mod}} =\frac{0.70-0.20}{0.0600} =8.333, \qquad df=10+5=15. $$ This statistic is far beyond the two-sided 5% critical value \(t_{0.975,15}\approx2.131\), so the test rejects the specified null value. The conclusion concerns evidence against a contrast of \(0.20\) log-expression units, not merely whether the contrast is nonzero.

Assumptions, Diagnostics, and Alternatives

The t reference is justified when the within-gene errors follow the stated normal linear model, the design has full column rank, the residual variance estimate has the stated chi-squared behavior, and the scaled inverse-chi-squared prior is appropriate with fixed hyperparameters. Independent samples and correctly specified variance structure matter: correlation or heteroscedasticity not represented in the model can invalidate the usual residual degrees of freedom and variance calculation. A zero or otherwise invalid contrast variance factor also signals a design or contrast problem; for an estimable contrast under a full-rank design, \(v_g>0\).

Useful checks include inspecting residuals for strong departures from the model, confirming that the contrast is estimable, checking that \(s_g^2\), \(s_0^2\), and \(v_g\) are positive, and verifying the degrees of freedom used in the reference distribution. Extreme gene-wise variance estimates deserve attention: shrinkage can stabilize noisy estimates, but marked outliers may not be well represented by a common prior. The variance-prior fit and genes with unusual variability require additional assessment; shrinkage does not make a misspecified model correct.

ApproachVariance in the standard errorReference degrees of freedomMain implication
Ordinary gene-wise t-testGene’s residual variance \(s_g^2\)\(d_g\)Uses only that gene’s variance estimate; it can be unstable with few observations.
Moderated t-testPosterior variance \(s_{g,\mathrm{post}}^2\)\(d_g+d_0\)Combines gene-specific and prior information under the variance model.
Pooled-variance analysisA single pooled varianceDepends on the pooled modelCan be efficient when a common variance is appropriate, but does not preserve gene-specific variance differences in the same way.

The ordinary test is a direct alternative when each gene has enough residual degrees of freedom for a stable variance estimate or when the variance prior is not credible. Moderation is useful when gene-wise estimates are noisy and the prior is suitable, but it does not alter the fitted effect, correct confounding, repair an incorrect design, or by itself account for testing many genes. Its t-distribution reference describes a single test under its assumptions; genome-wide conclusions also need appropriate treatment of multiplicity.

Common Mistakes

  • Using the ordinary residual variance in the moderated denominator. The moderated standard error uses \(s_{g,\mathrm{post}}^2\), multiplied by the contrast variance factor \(v_g\).
  • Changing the estimated effect as though it were shrunk. In this statistic, \(c^\top\hat{\beta}_g\) is unchanged; it is the variance estimate and reference degrees of freedom that are moderated.
  • Using only the residual degrees of freedom. Under the fixed-prior model, the reference degrees of freedom are \(d_g+d_0\), not \(d_g\) alone.
  • Interpreting a p-value as the probability that the null is true. A p-value is a tail probability under the null model and reference distribution, not a posterior probability of \(H_0\).
  • Assuming moderation always makes the statistic larger. The posterior variance can be above or below \(s_g^2\), depending on the prior scale relative to the gene’s residual variance.
Key takeaway: The moderated t-statistic divides the unchanged estimated contrast by a standard error built from the posterior variance estimate and the design’s contrast variance factor. Under the normal linear model and a fixed scaled inverse-chi-squared variance prior, its null reference distribution is \(t_{d_g+d_0}\).

Check Your Understanding

Use the definitions and assumptions above. Solutions are included after the questions.

  1. A gene has \(d_g=6\) and the variance prior has \(d_0=4\). What reference degrees of freedom are used for its moderated t-statistic?
  2. If \(s_g^2\) is larger than \(s_0^2\), must the posterior variance exceed \(s_g^2\)? Explain using the weighting formula.
  3. For a contrast estimate \(0.30\), posterior variance \(0.0500\), and \(v_g=0.20\), calculate the moderated standard error and statistic for a zero null.
  4. State two assumptions needed for the stated \(t_{d_g+d_0}\) reference distribution.

Solutions. (1) The reference degrees of freedom are \(d_g+d_0=6+4=10\). (2) No. The posterior variance is a weighted average of \(s_g^2\) and \(s_0^2\), with positive weights \(d_g\) and \(d_0\). If \(s_g^2>s_0^2\), that weighted average is less than \(s_g^2\), so it shrinks downward toward the prior scale. (3) \(SE_{\mathrm{mod}}=\sqrt{0.0500(0.20)}=\sqrt{0.0100}=0.100\); the statistic is \(0.30/0.100=3.00\). (4) Examples include independent normal errors with common within-gene variance and a correctly specified scaled inverse-chi-squared variance prior with fixed hyperparameters. Full column rank and an estimable contrast are also required for the stated linear-model variance calculation.

Clinical Biostats