LRT vs Wald in DESeq2 for time course RNA-seq: why the interaction LRT misses a constant group shift, which reduced model to use and why p-values repeat.
You ran DESeq2 on a time course with test = "LRT", and now every coefficient you pass to results() gives the same p-values. Or the likelihood ratio test (LRT) reports far more genes than a Wald test did, and you wonder which of the two is broken. Neither is. The Wald test and the LRT in DESeq2 test different null hypotheses, and for the LRT the reduced model decides which one. The standard time-course LRT, the full design ~ group + time + group:time against the reduced design ~ group + time, asks whether the difference between the groups changes over time. It does not ask whether the groups differ. In the simulation below it calls 1.5% of the genes that the treatment shifts by the same amount at every time point, close to its rate among genes with no effect at all (1.2%). Against the reduced design ~ time, the LRT calls 97% of them.
Two tests, two null hypotheses
DESeq2 fits a negative binomial generalised linear model to the counts of each gene (Love et al. 2014). The coefficients of that model are on the log2 scale, so each one apart from the intercept is a log2 fold change between two conditions, or a difference between such fold changes. The two tests use the fit in different ways.
The Wald test takes one coefficient, or one linear combination of coefficients (a contrast), divides the estimate by its standard error and compares the ratio with a normal distribution. Its null hypothesis is that this one number is zero. It is the test DESeq() runs by default, and the one results(dds, name = ...) and results(dds, contrast = ...) report after it.
The LRT fits the model twice, once with the full design and once with a reduced design that leaves some terms out. If the left-out terms matter, the full model fits the counts clearly better. The test compares the improvement in fit (the drop in deviance) with a chi-squared distribution whose degrees of freedom are the number of coefficients left out. Its null hypothesis is that all the left-out coefficients are zero at once, and it gives one p-value per gene however many coefficients were dropped.
For two groups measured at four time points, the full design has these coefficients:
cd <-data.frame(group =factor(rep(c("ctrl", "trt"), each =12)),time =factor(rep(rep(paste0("t", 0:3), each =3), 2)))table(cd$group, cd$time)
t0 t1 t2 t3
ctrl 3 3 3 3
trt 3 3 3 3
X <-model.matrix(~ group + time + group:time, cd)colnames(X)
With ctrl and t0 as the reference levels (the first level of each factor), grouptrt is the treated-minus-control difference at t0. It is not an average over time. timet1 to timet3 are the changes from t0 in the control group. Each interaction coefficient, such as grouptrt:timet1, is how much the treated-minus-control difference at that time point differs from the one at t0. The post on interaction terms reads this kind of coefficient in more detail.
The usual reduced design, ~ group + time, drops the 3 interaction coefficients. Its LRT asks whether the treated-minus-control difference is the same at all four time points. A gene whose expression doubles with treatment at every time point has interaction coefficients of zero and is, for this test, a null gene. The time-series section of the DESeq2 vignette says that this LRT tests whether the condition induces a change in gene expression at any time point after the reference level time point (time 0). Read “a change” as a change relative to the difference at time 0: a treatment effect that is already there at t0 and stays the same is not one. To ask whether the groups differ at any time point, the reduced design has to drop group as well. That design is ~ time, and the LRT then drops 4 coefficients.
The simulation
Each simulated gene is measured in 24 samples: a control and a treated group at four time points (t0 to t3), three replicates each. Counts are negative binomial, the usual model for RNA-seq read counts, with more scatter for weakly expressed genes. Every gene has its own time course, shared by both groups, so time on its own changes almost every gene. The 3,000 genes are of four kinds: 1,800 with no treatment effect, 400 with the same treatment effect at every time point, 400 with an effect at t2 only, and 400 that go up at t1 and down by the same amount at t3. The size of each effect is drawn between 0.7 and 1.5 on the log2 scale, with a random sign.
G <-3000n_pat <-c(null =1800, shift =400, single =400, updown =400)pat <-factor(rep(names(n_pat), n_pat), levels =names(n_pat))# true group effect (trt minus ctrl, log2 scale) at t0, t1, t2, t3 for an effect of size 1prof <-rbind(null =c(0, 0, 0, 0),shift =c(1, 1, 1, 1),single =c(0, 0, 1, 0),updown =c(0, 1, 0, -1))lfc_range <-c(0.7, 1.5)set.seed(2026)mu0 <-exp(rnorm(G, log(150), 1.3)) # baseline mean countphi <-0.03+0.3/sqrt(mu0) # NB dispersion, higher for low countssize <-runif(G, lfc_range[1], lfc_range[2]) *sample(c(-1, 1), G, TRUE)tcourse <-cbind(0, matrix(rnorm(G *3, 0, 0.5), G, 3)) # time course shared by both groupseff <- prof[as.character(pat), ] * size # G x 4 group effectsti <-as.integer(cd$time); is_trt <- cd$group =="trt"lf <- tcourse[, ti] + eff[, ti] *rep(is_trt, each = G)mu <- mu0 *2^lf *rep(runif(24, 0.8, 1.25), each = G)cts <-matrix(rnbinom(G *24, mu = mu, size =1/ phi), G, 24)storage.mode(cts) <-"integer"
Figure 1: The four kinds of gene in the simulation, drawn for one illustrative gene each. Both groups share the same time course; the kinds differ only in the treatment effect at each time point.
The detection rates below depend on the effect sizes and on three replicates per group and time point; larger effects or more replicates raise them all. Which test sees which kind of gene does not depend on power. It follows from the null hypothesis of each test. Time is a factor with four levels here, as it usually is for a handful of time points.
Five tests on the same data
alpha <-0.05dds <-DESeqDataSetFromMatrix(cts, cd, design =~ group + time + group:time)# LRT 1: drop the interaction. Does the group difference change over time?dds_lrt <-DESeq(dds, test ="LRT", reduced =~ group + time, quiet =TRUE)res_int <-results(dds_lrt, alpha = alpha)# LRT 2: drop group and the interaction. Is there a group difference at any time?dds_any <-nbinomLRT(dds_lrt, reduced =~ time, quiet =TRUE)res_any <-results(dds_any, alpha = alpha)
The LRT for the interaction is one call to DESeq(). The second LRT needs no new dispersion estimates: nbinomLRT() refits the two models with another reduced design and, as its help page says, uses the size factors and dispersion estimates already stored in the object.
The Wald tests come from the standard workflow. group_trt_vs_ctrl is the name DESeq2 gives the grouptrt coefficient. The treated-minus-control difference at a later time point is that coefficient plus the time point’s interaction, which results() takes as a list contrast. Every test uses a false discovery rate (FDR) of 5%, with the alpha argument of results() set to match.
dds_wald <-DESeq(dds, quiet =TRUE) # standard workflow, Wald testres_t0 <-results(dds_wald, name ="group_trt_vs_ctrl", alpha = alpha)# trt vs ctrl at t1, t2, t3: the t0 difference plus that time's interactionres_tk <-lapply(c(t1 =1, t2 =2, t3 =3), function(k)results(dds_wald, alpha = alpha,contrast =list(c("group_trt_vs_ctrl", paste0("grouptrt.timet", k)))))
test_lab <-c(LRT_int ="LRT, reduced ~ group + time", LRT_any ="LRT, reduced ~ time",Wald_t0 ="Wald, group_trt_vs_ctrl", Wald_t2 ="Wald, trt vs ctrl at t2",Wald_union ="Wald, any of the 4 times")hm <-expand.grid(test =names(test_lab), pattern =colnames(rt), stringsAsFactors =FALSE)hm$rate <- rt[cbind(hm$test, hm$pattern)]hm$test <-factor(test_lab[hm$test], levels =rev(test_lab))hm$pattern <-factor(pat_lab[hm$pattern], levels = pat_lab)ggplot(hm, aes(pattern, test, fill = rate)) +geom_tile(colour ="white", linewidth =1) +geom_text(aes(label =pct(rate), colour = rate >0.5), size =3.8, show.legend =FALSE) +scale_fill_gradient(low ="#f1eefa", high = violet, limits =c(0, 1), guide ="none") +scale_colour_manual(values =c("TRUE"="white", "FALSE"="grey20")) +scale_x_discrete(position ="top") +labs(x =NULL, y =NULL) + theme_pc +theme(panel.grid =element_blank())
Figure 2: Share of genes of each kind called at the chosen FDR by five tests on the same simulated time course. Rows are tests, columns are the kinds of gene from the first figure.
The LRT against ~ group + time finds 53% of the t2-only genes and 84% of the up-then-down genes, but only 1.5% of the constant-shift genes, close to its 1.2% among genes with no effect. That is not a lack of power: for this test a constant shift is not an effect. Against ~ time, the LRT finds 97% of the constant-shift genes, and the other two kinds as well.
The Wald test of group_trt_vs_ctrl finds 72% of the constant-shift genes and almost none of the others (1.2% of the t2-only genes, 1.0% of the up-then-down genes). It tests the difference at t0, because t0 is the reference level of time; change the reference level and the same name refers to another time point. It is not the average effect of treatment.
A question about one time point is best answered by a test of that time point. The Wald contrast at t2 finds 76% of the t2-only genes, more than the LRT against ~ group + time (53%) or against ~ time (66%). An LRT spreads its evidence over several coefficients, and the interaction LRT sees only the part of an effect that differs between time points: its reduced design can absorb part of a t2 effect into the group coefficient.
The number of genes called differs just as much. The Wald test of group_trt_vs_ctrl calls 311 genes, the interaction LRT 577 and the LRT against ~ time 1,034. A large gap between a Wald count and an LRT count is what two different questions look like, not a sign that one of the tests is broken.
Same p-value, different fold change
After DESeq(dds, test = "LRT", reduced = ...), results() still accepts name and contrast and returns a table with a log2FoldChange column for the coefficient you name. The p-value column does not follow the name. The chunk below extracts a table for every coefficient and compares its p-values with those of the default table:
[1] "log2 fold change (MLE): group trt vs ctrl"
[2] "LRT p-value: '~ group + time + group:time' vs '~ group + time'"
The p-values are identical whichever name is used; the fold changes are not. The results() help page says so: for the LRT, the p-values are determined solely by the difference in deviance between the full and reduced design, and a single log2 fold change is printed for consistency with other results tables. By default that is the coefficient named last by resultsNames(), here grouptrt.timet3. The table header, mcols(res)$description (also printed above the table), records both halves: the fold change is group trt vs ctrl, the p-value is '~ group + time + group:time' vs '~ group + time'. The FAQ at the end of the DESeq2 vignette gives the same answer.
Figure 3: The results table for the name group_trt_vs_ctrl after the interaction LRT, split by kind of gene. The horizontal position is the t0 treatment log2 fold change printed in the table; the vertical position is the LRT p-value in the same row, which is about the interaction.
Counting the mismatches
shift_big <- pat =="shift"&abs(by_name$group_trt_vs_ctrl$log2FoldChange) >1n_shift_big <-sum(shift_big)n_shift_big_called <-sum(sig(by_name$group_trt_vs_ctrl$padj)[shift_big])called_dyn <-sig(res_int$padj) & pat %in%c("single", "updown")med_lfc_dyn <-median(abs(by_name$group_trt_vs_ctrl$log2FoldChange[called_dyn]))c(n_shift_big = n_shift_big, n_shift_big_called = n_shift_big_called,med_lfc_dyn = med_lfc_dyn)
Read row by row, such a table misleads. Of the 245 constant-shift genes with an estimated fold change beyond twofold in it, 3 have an adjusted p-value below the cut-off. The t2-only and up-then-down genes it calls have a median absolute log2 fold change of 0.20 in the same table. Sorted by adjusted p-value, it shows large changes that are “not significant” next to significant genes that barely change at t0.
When you want per-coefficient p-values from an LRT fit, ask for them. The help page of results() says that after nbinomLRT(), setting test = "Wald" generates Wald statistics and Wald p-values:
w_t0 <-results(dds_lrt, name ="group_trt_vs_ctrl", test ="Wald", alpha = alpha)w_t2 <-results(dds_lrt, test ="Wald", alpha = alpha,contrast =list(c("group_trt_vs_ctrl", "grouptrt.timet2")))max_diff_wald <-max(abs(c(w_t0$pvalue - res_t0$pvalue, w_t2$pvalue - res_tk$t2$pvalue, w_t0$log2FoldChange - res_t0$log2FoldChange)), na.rm =TRUE)mcols(w_t0)$description[5]
[1] "Wald test p-value: group trt vs ctrl"
max_diff_wald
[1] 0
The header now reads Wald test p-value, and p-values and fold changes equal those of the separate Wald fit above (largest absolute difference 0). One LRT fit gives both kinds of table, as long as the Wald test is requested explicitly.
Significant at any time point
A common way to ask whether the groups differ at any time point is to run the Wald contrast at each time point and keep every gene that is significant in at least one of the four lists. That finds about as many genes as the LRT against ~ time (1,113 against 1,034), but not at the FDR you set. Each list gets its own Benjamini-Hochberg adjustment (Benjamini and Hochberg 1995), which holds the expected share of false calls in that list at or below 5%. The union collects the false calls of all four lists. In this simulation 7.7% of the genes in the union have no treatment effect at any time point, against 4.4% for the LRT against ~ time. The LRT makes one test per gene and is adjusted once, so it stays much closer to the error rate you asked for. It is not exact: among the genes with no effect, 5.9% have an LRT p-value below 0.05 (for the Wald test of group_trt_vs_ctrl, 5.2%), so with 24 samples the chi-squared approximation behind the LRT is slightly liberal. The per-time contrasts can then describe where the difference is, but not as a second round of significance calls.
The same questions in edgeR
edgeR’s quasi-likelihood pipeline makes the same distinction (Chen et al. 2025). Its help page describes the coef argument of glmQLFTest() as the coefficients to be tested equal to zero: one coefficient gives a test of that coefficient, several give an F-test that they are all zero, the counterpart of the DESeq2 LRT. The recipe is filterByExpr(), normLibSizes(), glmQLFit() and glmQLFTest(). Pass legacy = FALSE to glmQLFit() explicitly: it selects the newer quasi-likelihood method, which is the default in recent edgeR releases but not in older ones such as edgeR 4.0.
y <-DGEList(cts, group =interaction(cd$group, cd$time))keep <-filterByExpr(y, design = X)y <-normLibSizes(y[keep, , keep.lib.sizes =FALSE])fit <-glmQLFit(y, X, legacy =FALSE)inter <-grep(":", colnames(X), value =TRUE) # the three interaction columnsql_int <-glmQLFTest(fit, coef = inter) # like the LRT against ~ group + timeql_any <-glmQLFTest(fit, coef =c("grouptrt", inter)) # like the LRT against ~ time
Detection rates for the edgeR tests
ql_call <-function(q) { # genes removed by filterByExpr count as not called s <-rep(FALSE, G); s[keep] <-p.adjust(q$table$PValue, "BH") < alpha; s}rt_ql <-rbind(QL_int =tapply(ql_call(ql_int), pat, mean),QL_any =tapply(ql_call(ql_any), pat, mean))ql_int_shift <- rt_ql["QL_int", "shift"]; ql_int_single <- rt_ql["QL_int", "single"]ql_any_shift <- rt_ql["QL_any", "shift"]round(rt_ql, 3)
Testing the three interaction coefficients finds 0.8% of the constant-shift genes and 50% of the t2-only genes; adding grouptrt to coef finds 98% of the constant-shift genes. That is close to the two DESeq2 LRTs, and the same rule applies: the coefficients in coef decide the question.
What to do in practice
Decide the question first and choose the test that answers it; the number of genes a test returns is not a reason to prefer it. For a two-group time course:
dds <-DESeqDataSetFromMatrix(counts, samples, design =~ group + time + group:time)dds$group <-relevel(dds$group, "ctrl") # set reference levels before DESeq()dds$time <-relevel(dds$time, "t0")# Does the treatment effect change over time?dds_lrt <-DESeq(dds, test ="LRT", reduced =~ group + time)res_change <-results(dds_lrt, alpha =0.05)# Is there a treatment effect at any time point?res_any <-results(nbinomLRT(dds_lrt, reduced =~ time), alpha =0.05)# Is there a treatment effect at t2? A Wald test from the same fitres_t2 <-results(dds_lrt, test ="Wald", alpha =0.05,contrast =list(c("group_trt_vs_ctrl", "grouptrt.timet2")))
Before reading the log2FoldChange column of an LRT table next to its p-values, check its header with mcols(res)$description. When you report genes from an LRT, show the per-time fold changes from the Wald contrasts beside them, so that a reader can see when and in which direction a gene responds; they describe the response and are not a second round of significance calls. In this design a Wald test of group_trt_vs_ctrl is a statement about the reference time point, not about the treatment in general. A gene list for “different at any time” built by merging per-time lists carries more false calls than the FDR you set; the LRT against ~ time answers that question with one test per gene.
The R file runs the post top to bottom in a fresh session. Spotted an error, a broken number or code that no longer runs? The report link opens an email to contact@pseudocount.com.