Why the Sign Matters Even for a Two-Sided Test
A two-sided test treats \(z\) and \(-z\) as equally extreme under a symmetric null model. But the posterior probability that a result is null, given its magnitude, depends on the alternative distribution too. If the alternative is asymmetric, the density of observing \(Z=t\) can differ substantially from the density of observing \(Z=-t\). Therefore a local false discovery rate based on \(|Z|\) must account for both possibilities.
This tutorial derives that calculation from the signed z-score model. It also clarifies when a magnitude-based local FDR agrees with the signed-score calculation and when it does not. The introductory material on local FDR from p-values gives the related density-based perspective; here the key issue is the transformation from a signed statistic to its absolute value.
Two-Group Model for Signed Z-Scores
Let \(H=0\) denote a null test and \(H=1\) an alternative test. Suppose the prior probabilities of these states are \(P(H=0)=\pi_0\) and \(P(H=1)=\pi_1=1-\pi_0\). Conditional on the state, the signed statistic \(Z\) has density \(f_0(z)\) under the null and \(f_1(z)\) under the alternative. The marginal density is the mixture of these two densities.
These are posterior probabilities at a value of a continuous statistic, understood through the corresponding density model. They are not p-values and are not probabilities that a null hypothesis is true in isolation. The calculation requires a specified or estimated null proportion and valid null and alternative densities. In the common theoretical setup, \(f_0(z)=\phi(z)\), the standard normal density, so that a null z-statistic has distribution \(N(0,1)\). If the null is not standard normal, its appropriate density must be used instead.
Folding the Signed Density
For \(T=|Z|\), a positive magnitude \(t\) can arise from either \(Z=t\) or \(Z=-t\). The density of \(T\) is therefore the sum of the signed densities at those two points. This is not an averaging operation: probabilities from the two disjoint signed intervals contribute to the same interval of magnitudes.
To justify the result, take \(0\leq a<b\). The event \(a<T\leq b\) is the union of \(a<Z\leq b\) and \(-b\leq Z<-a\). These events are disjoint, so their probabilities add:
Thus \(g(t)=f(t)+f(-t)\) is the density on positive magnitudes. The value at the single boundary point \(t=0\) does not affect probabilities under a continuous model. If the null is standard normal, symmetry gives \(g_0(t)=2\phi(t)\) for \(t>0\). No corresponding doubling simplification is valid for an asymmetric alternative unless its density is also symmetric.
Worked Example: Folding an Asymmetric Alternative
Suppose \(H=1\) has the hypothetical density \(f_1(z)=0.75\phi(z-0.5)+0.25\phi(z-2)\), while the null is standard normal. Find the alternative density of \(T=|Z|\) at \(t=1\). This calculation shows why both signs must be included even though the final statistic is two-sided.
At \(z=-1\), the alternative density is $$ f_1(-1)=0.75\phi(-1.5)+0.25\phi(-3) =0.75(0.1295175957)+0.25(0.0044318484) =0.0982461589. $$ At \(z=1\), it is $$ f_1(1)=0.75\phi(0.5)+0.25\phi(-1) =0.75(0.3520653268)+0.25(0.2419707245) =0.3245416762. $$ Therefore the folded alternative density is $$ g_1(1)=f_1(1)+f_1(-1)=0.3245416762+0.0982461589=0.4227878351, $$ or \(0.422788\) to six decimal places. Because the alternative puts different density on the positive and negative sides, doubling \(f_1(1)\) would give the wrong folded density.
Calculating the Magnitude-Based Local FDR
Once both folded densities have been calculated, Bayes' rule gives the posterior null probability for the observed magnitude. In particular, under a standard normal null, the null contribution to the marginal density at \(t\) is \(\pi_0\,2\phi(t)\). The alternative contribution is \(\pi_1\{f_1(t)+f_1(-t)\}\), whether or not the alternative is symmetric.
Worked Example: Local FDR at a Magnitude of Two
Consider a hypothetical two-group model with \(\pi_0=0.8\), a standard normal null, and an alternative \(Z\mid H=1\sim N(1,1)\). Find the local FDR for \(T=|Z|=2\). The alternative is shifted to the positive side, so its density at \(2\) and \(-2\) must both be used.
The folded null density is \(g_0(2)=2\phi(2)=2(0.0539909665)=0.1079819330\). The folded alternative density is $$ g_1(2)=\phi(2-1)+\phi(-2-1)=\phi(1)+\phi(-3) =0.2419707245+0.0044318484=0.2464025729. $$ Weight each density by its state probability: $$ \pi_0g_0(2)=0.8(0.1079819330)=0.0863855464, \qquad \pi_1g_1(2)=0.2(0.2464025729)=0.0492805146. $$ Thus $$ \operatorname{lfdr}_T(2) =\frac{0.0863855464}{0.0863855464+0.0492805146} =0.6367513\approx 0.6368. $$ Under this specified model, among tests with magnitude near \(2\), the posterior probability of a null state is about \(63.68\%\). This value is not the probability that the null hypothesis is true for every individual test with that statistic, independent of the model.
Signed and Magnitude-Based Local FDR
The distinction between \(\operatorname{lfdr}_Z(z)\) and \(\operatorname{lfdr}_T(t)\) is substantive when the alternative is asymmetric. For \(t>0\), the magnitude-based quantity can also be written as a weighted combination of the two signed-score local FDR values:
The weights are the marginal densities at the two possible signed observations. This follows because \(m(z)\operatorname{lfdr}_Z(z)=\pi_0f_0(z)\); adding this identity at \(t\) and \(-t\), then dividing by \(m(t)+m(-t)\), yields the magnitude-based formula. It is generally not the unweighted average of the two signed local FDR values.
Worked Example: When Symmetry Makes the Two Calculations Agree
Suppose \(\pi_0=0.9\), the null is standard normal, and the alternative is the symmetric mixture \(0.5N(2,1)+0.5N(-2,1)\). Compare the local FDR at signed \(z=2\) with the local FDR based on \(T=2\).
At \(z=2\), the alternative density is $$ f_1(2)=0.5\phi(0)+0.5\phi(4) =0.5(0.3989422804)+0.5(0.0001338302)=0.1995380553. $$ By symmetry, \(f_1(-2)=f_1(2)\), so \(g_1(2)=0.3990761106\). The null density is \(f_0(2)=\phi(2)=0.0539909665\), and \(g_0(2)=0.1079819330\). Using the signed densities gives $$ \operatorname{lfdr}_Z(2) =\frac{0.9(0.0539909665)} {0.9(0.0539909665)+0.1(0.1995380553)} \approx 0.7089. $$ Using folded densities doubles both the null and alternative terms in this symmetric example, so the ratio is unchanged: $$ \operatorname{lfdr}_T(2) =\frac{0.9(0.1079819330)} {0.9(0.1079819330)+0.1(0.3990761106)} \approx 0.7089. $$ This agreement follows from symmetry at both state densities; it should not be assumed when the alternative is asymmetric.
Assumptions, Diagnostics, and Alternatives
The formula is a direct consequence of the two-group mixture model and the absolute-value transformation. Its interpretation depends on whether the model describes the tests under consideration. In genomic applications, \(\pi_0\), \(f_0\), and \(f_1\) are often estimated from many tests rather than known. Substituting estimates produces an estimated local FDR, but does not remove the need to assess the fitted null and alternative densities. The derivation concerns marginal densities for a test; dependence among tests does not change the algebra for a correctly specified marginal model, though it can affect estimation and calibration across a collection of tests.
Useful checks include comparing observed signed z-score patterns with the assumed null, checking whether the estimated alternative density captures both tails, and ensuring the folded densities integrate to one on \(t\geq0\). For example, \(\int_0^\infty\{f(t)+f(-t)\}\,dt=1\) for a continuous density \(f\). A folded density that does not normalize indicates an error in the transformation or density estimation.
- Ignoring the negative sign. Using \(f_1(t)\) alone assumes there is no probability contribution from \(Z=-t\). For a two-sided magnitude, use \(f_1(t)+f_1(-t)\).
- Doubling an asymmetric alternative. The expression \(2f_1(t)\) is valid only when \(f_1(t)=f_1(-t)\). Otherwise, evaluate both terms separately.
- Using a misspecified null. If the null z-statistics are shifted or over-dispersed relative to \(N(0,1)\), using \(2\phi(t)\) can distort the posterior null probabilities. Check null calibration before interpreting the resulting local FDR.
- Confusing tail probability with density. A two-sided p-value is a tail area, whereas a local FDR is a density ratio evaluated at an observation. The p-value is not a substitute for either folded density.
A magnitude-based local FDR is appropriate when the decision treats positive and negative effects symmetrically. If the scientific question is directional, retain the sign and use \(\operatorname{lfdr}_Z(z)\); discarding the sign can combine observations with different alternative densities. Another option is to model the two directions separately, but that changes the hypotheses and mixture specification and should be justified by the scientific goal.
Check Your Understanding
Answer each question, then compare with the concise solutions below.
- For a signed statistic with density \(f\), write the density of \(T=|Z|\) at \(t>0\).
- If \(f_1(2)=0.12\) and \(f_1(-2)=0.03\), what is the alternative folded density at \(t=2\), and why is \(2f_1(2)\) incorrect?
- Under a standard normal null with \(\pi_0=0.7\), \(g_0(1)=2\phi(1)\). State the null contribution \(\pi_0g_0(1)\) to the marginal density.
- When will the signed local FDR at \(z=t\) equal the magnitude-based local FDR at \(T=t\)? Give a sufficient symmetry condition.
Solutions. (1) \(g(t)=f(t)+f(-t)\), because either signed value produces the magnitude \(t\). (2) \(g_1(2)=0.12+0.03=0.15\); doubling \(f_1(2)\) incorrectly assumes equal density at \(2\) and \(-2\). (3) \(0.7\{2\phi(1)\}=1.4(0.2419707)\approx0.3388\). (4) If both \(f_0\) and \(f_1\) are symmetric about zero, their signed densities at \(t\) and \(-t\) match, so folding doubles numerator and denominator by the same factor.