Tutorials › High-Dimensional Genomic Data Analysis › Likelihood-Ratio Tests For Nested Designs

Count-Based Differential Expression for RNA-seq · Tutorial 440 of 795

Likelihood-Ratio Tests For Nested Designs

You will learn to set up nested negative binomial models, calculate a likelihood-ratio statistic, and determine its degrees of freedom from the difference in model parameters.

Intermediate 12 min read

What You'll Learn

  • Define reduced and full negative binomial models for the same count data.
  • Calculate the likelihood-ratio statistic from maximized log likelihoods.
  • Determine degrees of freedom from the difference in model ranks.
  • Interpret a likelihood-ratio p-value in the context of a gene-expression test.
  • Recognize assumptions, diagnostics, and common failures of the chi-square approximation.
  • Distinguish a likelihood-ratio test from a Wald test of selected coefficients.

Why Compare Nested Models?

A count-model analysis often asks whether a set of predictors improves the description of a gene’s expression after accounting for library size and other design variables. A likelihood-ratio test answers this by comparing two models fitted to the same observations: a reduced model that imposes the null restriction and a full model that allows the effect being tested. The central calculation is a difference in maximized log likelihoods, not a comparison of raw counts or fitted means alone.

For example, to test whether expression differs by condition while adjusting for batch, the reduced model includes batch but omits condition; the full model includes both. This is a test of the condition term as a group, and it can extend naturally to multi-level factors or several coefficients tested together.

Definition: Two models are nested when every distribution allowed by the reduced model is also allowed by the full model. The reduced model is obtained by imposing restrictions on parameters in the full model. A likelihood-ratio test compares their maximized log likelihoods to assess whether the additional parameters improve fit more than expected from sampling variation.

Negative Binomial Models and the Test Statistic

For one gene, let \(Y_i\) be the observed count in sample \(i\), with mean \(\mu_i\) and dispersion \(\alpha\). The negative binomial model used here has \(\operatorname{Var}(Y_i)=\mu_i+\alpha\mu_i^2\), where \(\alpha\geq 0\). A log-link model with a library-size offset is \(\log(\mu_i)=o_i+x_i^\mathsf{T}\beta\), where \(o_i\) is the known offset and \(x_i\) is the design row. The reduced and full models use the same counts and offsets; their design matrices differ in the predictors under test.

$$ \ell(\beta,\alpha)=\sum_{i=1}^{n}\left[ \log\Gamma(Y_i+1/\alpha)-\log\Gamma(1/\alpha)-\log\Gamma(Y_i+1) +\frac{1}{\alpha}\log\left(\frac{1/\alpha}{1/\alpha+\mu_i}\right) +Y_i\log\left(\frac{\mu_i}{1/\alpha+\mu_i}\right) \right]. $$

This is the log likelihood for independent negative binomial observations under the stated parameterization. When \(\alpha=0\), the limiting model is Poisson; the negative binomial likelihood expression above is for \(\alpha>0\). Write \(\widehat{\ell}_R\) and \(\widehat{\ell}_F\) for the maximized log likelihoods under the reduced and full models, respectively. If dispersion is estimated rather than fixed, each maximization includes that nuisance parameter according to the analysis procedure; the same dispersion treatment must be used in both fits.

$$ \Lambda=2(\widehat{\ell}_F-\widehat{\ell}_R). $$

Because the reduced model is contained in the full model, maximizing over the larger parameter space cannot produce a smaller log likelihood: \(\widehat{\ell}_F\geq\widehat{\ell}_R\). Thus \(\Lambda\geq0\). Small numerical negatives can occur from optimization tolerances; a substantial negative value signals a fitting, data, or model-comparison problem.

Degrees of Freedom and the Chi-Square Reference

Let \(r_F\) and \(r_R\) be the ranks of the full and reduced design matrices. If the models differ only in regression terms and share the same nuisance parameters, the number of added independent coefficients is \(q=r_F-r_R\). More generally, \(q\) is the difference in the number of independently estimated parameters in the full and reduced models. Under regularity conditions, the null distribution of \(\Lambda\) is approximately chi-square with \(q\) degrees of freedom.

Theorem: Under the null hypothesis that the reduced model is adequate, and under regularity conditions for likelihood inference, \(\Lambda=2(\widehat{\ell}_F-\widehat{\ell}_R)\) is approximately distributed as \(\chi^2_q\), where \(q\) is the number of independent restrictions imposed by the reduced model. The p-value is the upper-tail probability \(P(\chi^2_q\geq\Lambda_{\mathrm{obs}})\).

The degrees of freedom count independent parameter directions, not samples, genes, or the total number of columns as written before checking for redundancy. If a categorical condition has three levels and the model uses two independent contrasts, testing the entire condition effect against a model with no condition term has \(q=2\). Testing one particular contrast instead has \(q=1\).

The approximation relies on a correctly specified likelihood, independent observations conditional on the model, identifiable parameters, and a sufficiently regular setting for large-sample likelihood theory. The null parameter must not lie on a problematic boundary, and the models must be fitted comparably. In RNA-seq workflows, dispersion may be estimated or stabilized using information across genes; when a dispersion estimate is plugged in rather than jointly maximized, the usual chi-square calibration is an approximation under that procedure, not an exact finite-sample guarantee.

Worked Comparisons

Worked Example: Testing a Two-Condition Effect

Suppose a hypothetical experiment has six samples, three per condition, with counts for one gene of 10, 12, and 9 in the control samples and 14, 16, and 12 in the treated samples. Library-size offsets are included in both fits, and a common dispersion estimate is used. The reduced model has an intercept only; the full model adds a two-condition indicator. The design ranks are 1 and 2, and an illustrative fit reports maximized log likelihoods \(\widehat{\ell}_R=-24.310\) and \(\widehat{\ell}_F=-22.995\).

The full model adds one independent coefficient, so \(q=2-1=1\). Substituting the fit outputs gives

$$ \Lambda=2[-22.995-(-24.310)] =2(1.315)=2.630. $$

For a chi-square distribution with 1 degree of freedom, the upper-tail p-value is approximately 0.1049. At significance level \(\alpha=0.05\), this result does not provide sufficient evidence against the reduced model. It is not evidence that the condition effect is exactly zero; it says the observed improvement is not unusually large under this test’s null reference distribution.

Worked Example: Testing a Three-Level Condition

In a hypothetical experiment, three conditions each have four samples, with gene counts \((8,10,9,11)\), \((12,15,13,14)\), and \((18,16,20,19)\). Assume the same specified offsets and dispersion treatment in both models. The reduced model has an intercept; the full model adds a three-level condition represented by two independent contrasts. Suppose the fitted log likelihoods are \(\widehat{\ell}_R=-57.2863\) and \(\widehat{\ell}_F=-55.4517\).

The full model has two more independent coefficients, so \(q=2\). Using the unrounded log-likelihood outputs for the subtraction,

$$ \Lambda=2[-55.4517-(-57.2863)] =2(1.8346)=3.6692. $$

For \(q=2\), the chi-square upper-tail probability is \(P(\chi^2_2\geq3.6692)=\exp(-3.6692/2)\approx0.1597\). At the 0.05 level, the test does not reject the null that the condition coefficients are jointly zero. This is a single omnibus test; it does not separately identify which pair of conditions might differ.

Worked Example: Testing an Effect While Adjusting for Batch

Consider a hypothetical four-sample experiment with two batches and two conditions. The question is whether condition contributes information after accounting for batch. The reduced model contains an intercept and a batch indicator; the full model adds a condition indicator. If the design columns are independent, the ranks are 2 and 3, giving \(q=1\), even though the full model has three coefficients including the intercept.

Suppose the negative binomial fits report \(\widehat{\ell}_R=-18.420\) and \(\widehat{\ell}_F=-16.5855\). Then

$$ \Lambda=2[-16.5855-(-18.420)] =2(1.8345)=3.669. $$

The one-degree-of-freedom upper-tail p-value is approximately 0.0555. At \(\alpha=0.05\), the result falls just above the threshold and does not reject the reduced model. The test concerns the condition term conditional on batch; it should not be interpreted as an unadjusted comparison or as evidence of a causal effect.

Why the Reference Distribution Is Appropriate

The likelihood-ratio statistic measures the loss in fit when the parameter restrictions of the reduced model are imposed. To see why a chi-square reference appears, consider a regular model near the null parameter value. A second-order Taylor expansion of the log likelihood around its maximum makes the local log-likelihood loss approximately a quadratic form in parameter differences. Under the null, the \(q\) directions freed in the full model contribute approximately \(q\) independent squared standard-normal components. Their sum has a chi-square distribution with \(q\) degrees of freedom.

This is an asymptotic justification: the approximation improves as the information for the gene’s parameters grows, but a small number of samples or very sparse counts may make it less reliable. It also explains why counting the extra independent coefficients matters. Counting a redundant design column as an extra parameter would use the wrong reference distribution.

Assumptions, Diagnostics, and Alternatives

Before interpreting an LRT, confirm that the models use the same gene-level observations, offsets, response scale, and dispersion convention. Check that the full model is genuinely nested in the reduced one and that the design matrices are identifiable. A condition perfectly confounded with batch, for example, cannot be separated from batch by adding both terms; the intended coefficient directions are not estimable.

Inspect fit warnings, convergence status, extreme fitted means, and whether the fitted model is compatible with the count structure. A model that fails to converge does not provide trustworthy maximized likelihoods. A large apparent improvement driven by one unusual sample can also be fragile; the LRT itself does not diagnose that observation. Such checks complement the test rather than changing its definition. Very low counts may provide little information, and sparse data can weaken the large-sample chi-square approximation.

A Wald test, covered in the earlier material on Wald tests for count-model coefficients, evaluates an estimated coefficient or contrast relative to its estimated standard error. It is convenient for a single specified contrast. The LRT instead compares fitted likelihoods and is particularly natural for a joint test of several coefficients, such as all contrasts for a multi-level condition. In large regular samples the methods often give similar conclusions, but they need not agree in small or weakly informative samples. Neither method removes the need to specify the scientific hypothesis and design correctly.

Common Pitfalls and Limitations

  • Using the wrong degrees of freedom. The difference in parameter counts is the number of independent added directions, not the number of labels or raw design columns. Check design rank.
  • Subtracting rounded likelihoods. Compute \(2(\widehat{\ell}_F-\widehat{\ell}_R)\) from full-precision fit values and round only the final statistic. Early rounding can change a reported statistic and p-value.
  • Comparing non-nested fits. The standard nested-model chi-square result does not apply just because two models have different predictors. Verify that the reduced model is obtained by restrictions on the full model.
  • Treating a non-significant result as proof of no effect. A large p-value can reflect limited information. It is not the probability that the null is true.
  • Forgetting the scope of the test. A joint condition test asks whether the added condition terms collectively improve fit. It does not show which contrast is responsible, nor does it establish causation.

The likelihood-ratio test is a per-gene test statistic and p-value. When many genes are tested, the resulting collection of p-values requires appropriate multiplicity handling before making genome-wide claims; the single-gene chi-square reference does not itself control the overall false-positive rate.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. A reduced model has design rank 3 and a nested full model has rank 6. What is the LRT degrees of freedom if the models share the same nuisance parameters?
  2. The reduced and full maximized log likelihoods are \(-42.80\) and \(-40.25\). Calculate \(\Lambda\).
  3. Why is a three-level condition usually tested with two degrees of freedom when all condition contrasts are tested jointly against an intercept-only condition structure?
  4. Can two models with different response observations be compared using the usual nested-model LRT? Explain.
  5. A one-degree-of-freedom LRT has p-value 0.08. State an appropriate conclusion at significance level 0.05.

Solutions: (1) \(q=6-3=3\). (2) \(\Lambda=2[-40.25-(-42.80)]=2(2.55)=5.10\). (3) A three-level factor needs two independent contrasts relative to a reference level, so removing the entire factor imposes two independent restrictions. (4) No: the likelihoods must describe the same observed data under nested models for the standard comparison to apply. (5) Do not reject the reduced model at 0.05; the result is not sufficient evidence against it, but does not prove the effect is absent.

Clinical Biostats