Why Permute Residuals?
A genetic predictor may be associated with an outcome for reasons that are not the predictor’s conditional effect of interest. Age, ancestry components, batch, or other measured variables can be related to both the predictor and the outcome. A test that ignores these nuisance covariates can therefore answer the wrong question. The Freedman–Lane procedure constructs a permutation reference distribution for the predictor’s contribution after fitting the nuisance structure.
The method is useful when the covariates should remain fixed while the genetic predictor is tested, but the errors themselves are not directly observed and cannot simply be permuted. Its central idea is to fit the null model, permute its residuals, add them back to the null fitted values, and refit the full model. Because fitted residuals are not generally independent exchangeable observations, this procedure is usually an approximation to the desired null distribution, not an exact test.
Models and the Freedman–Lane Algorithm
Let \(y\) be an \(n\)-vector of outcomes, \(Z\) an \(n\times q\) matrix of nuisance covariates (including an intercept when appropriate), and \(g\) an \(n\)-vector of genetic predictor values. Consider the full linear model
The target is the conditional test \(H_0:\beta=0\) against a specified alternative, commonly \(H_a:\beta\ne0\). The reduced model under \(H_0\) is \(y=Z\gamma+\varepsilon\). Assume \(Z\) has full column rank and that \(g\) adds a linearly independent direction beyond the columns of \(Z\); otherwise \(\beta\) is not separately estimable.
Write \(P_Z=Z(Z'Z)^{-1}Z'\) for projection onto the columns of \(Z\), and \(M_Z=I-P_Z\) for residualization against those columns. The reduced fitted values are \(\hat y_0=P_Zy\), and the reduced residuals are \(e_0=M_Zy\). For a permutation matrix \(P_b\), the permuted response is \(y^{*(b)}=\hat y_0+P_be_0\). Fit the full model to \(y^{*(b)}\), using the same \(Z\) and \(g\), and record the chosen statistic, such as the \(t\)-statistic for \(\beta\).
Regress \(y\) on \(Z\) and save \(\hat y_0\) and \(e_0=y-\hat y_0\).
Apply a permitted permutation to the residuals. If the design imposes valid exchangeability restrictions, use only permutations consistent with them.
Set \(y^*=\hat y_0+Pe_0\), then fit the full model of \(y^*\) on \(Z\) and \(g\).
Repeat for the chosen permutations and compare their full-model statistics with the observed statistic.
For a two-sided test, a common choice is the absolute \(t\)-statistic. With \(B\) randomly sampled permutations and observed statistic \(T_{\mathrm{obs}}\), the add-one Monte Carlo p-value is
The added one counts the observed arrangement in the Monte Carlo reference set and avoids reporting a zero p-value. The p-value describes how often a statistic at least as extreme as the observed one occurs under this constructed reference distribution; it is not the probability that \(H_0\) is true.
Why the Procedure Is Approximate
If the true errors \(\varepsilon\) were known, a permutation test could be based on permuting them when their joint distribution is invariant under the allowed permutations. But under the null, the reduced residuals are \(e_0=M_Z\varepsilon\), not the errors themselves. Projection generally makes residuals dependent and gives them unequal variances, even when the errors have a common variance. Thus permuting \(e_0\) does not generally reproduce the exact distribution obtained by permuting \(\varepsilon\).
The source of the approximation can also be seen from the coefficient estimate. By residualizing the genetic predictor against \(Z\), the full-model estimate is
Under \(H_0\), the numerator is \(g'M_Z\varepsilon\). In a Freedman–Lane replicate it becomes \(g'M_ZP_be_0=g'M_ZP_bM_Z\varepsilon\). These expressions need not have the same distribution. The method can nevertheless be useful when the model is correctly specified, errors are approximately exchangeable under the permitted permutations, and no small number of observations dominates the fitted residuals. It is not a blanket guarantee of exact type I error control.
The linear-model assumptions relevant to this argument are a correctly specified nuisance mean under the null, a meaningful full-model coefficient, and errors whose distribution is sufficiently compatible with the permutation scheme. In the usual model-based justification, errors are independent with mean zero and common variance conditional on the fixed design; stronger distributional symmetry or exchangeability makes permutation reasoning more plausible. Independence alone does not make fitted residuals exchangeable. If observations have related-sample or block structure, permutation units and restrictions must reflect the design, as in the earlier material on restricted permutations.
Worked Example: One Residual Permutation by Hand
Consider four hypothetical observations with an intercept, nuisance covariate \(z=(-1,-1,1,1)\), genetic predictor \(g=(-1,1,-1,1)\), and outcome \(y=(7.5,8.5,9.5,14.5)\). The observed values were constructed as \(y=10+2z+1.5g+e\), where \(e=(1,-1,-1,1)\). The example is for arithmetic illustration, not a real genomic analysis.
First fit the reduced model on the intercept and \(z\). The fitted values are \(\hat y_0=(8,8,12,12)\), so \(e_0=y-\hat y_0=(-0.5,0.5,-2.5,2.5)\). In the full fit, \(g\) is orthogonal to both the intercept and \(z\), and \(g'g=4\). Therefore
The full-model residual is \(e=(1,-1,-1,1)\), so \(SSE=4\). There are \(4-3=1\) residual degrees of freedom, giving \(MSE=4\) and \(SE(\hat\beta)=\sqrt{MSE/(g'g)}=\sqrt{4/4}=1\). The observed statistic is \(t=1.5/1=1.5\).
Now swap the first two reduced residuals. The permuted residual vector is \((0.5,-0.5,-2.5,2.5)\), and the reconstructed response is \(y^*=(8.5,7.5,9.5,14.5)\). Its full-model coefficient is
The component of the permuted response left in the full-model residual direction \(e\) has coefficient \(e'y^*/4=1.5\). Thus \(SSE^*=4(1.5)^2=9\), \(MSE^*=9\), and \(SE(\hat\beta^*)=\sqrt{9/4}=1.5\). This replicate has \(t^*=1/1.5=0.667\). One replicate does not determine a p-value; the statistic must be compared with the full permutation reference distribution.
Interpreting a Permutation Run
Worked Example: A Two-Sided Monte Carlo P-Value
Suppose a hypothetical expression analysis tests one genetic dosage predictor while adjusting for an intercept, age, and two ancestry covariates. The predictor’s full-model estimate is \(0.42\) log-expression units per dosage unit, with \(SE=0.20\) log-expression units per dosage unit. Thus \(T_{\mathrm{obs}}=0.42/0.20=2.10\). Assume the design and residual checks support using unrestricted permutations as a reasonable approximation, and that 999 random Freedman–Lane permutations are run.
Suppose 37 of the 999 permuted absolute \(t\)-statistics are at least 2.10. The add-one estimate is
At \(\alpha=0.05\), this result is evidence against the null of no conditional linear association under the fitted model and the chosen permutation scheme. The estimated coefficient indicates a positive association of 0.42 log-expression units per dosage unit, conditional on the listed covariates. The permutation p-value does not establish a causal effect, and its calibration depends on the validity of the residual-permutation approximation.
A practical analysis should examine whether the nuisance model captures the mean structure and whether residuals show patterns that conflict with the proposed permutation scheme. Residual-versus-fitted plots, residuals against key covariates, and leverage measures can reveal gross problems. A few high-leverage observations can make residual variances markedly unequal and allow those observations to influence many permuted statistics. A failure of these checks is a reason to reconsider the model or inferential method, not a reason to keep permuting and trust the resulting p-value. More detailed diagnosis of variance nonconstancy belongs to the subsequent material on heteroskedasticity.
Worked Example: Checking Whether the Conditional Effect Is Estimable
Suppose a hypothetical data set has four subjects, nuisance design \(Z\) containing an intercept and a binary batch indicator \(z=(0,0,1,1)\), and genetic dosage \(g=(0,0,1,1)\). Here \(g=z\), so the genetic predictor is exactly a column of the nuisance design (apart from the intercept, \(z\) is included as a batch column).
Residualizing the predictor gives \(M_Zg=0\), and hence \(g'M_Zg=0\). The conditional coefficient formula \(\hat\beta=(g'M_Zy)/(g'M_Zg)\) has a zero denominator. No residual permutation can resolve this: the data contain no predictor variation distinct from batch, so the genetic effect cannot be separated from the nuisance effect.
If dosage varies within each batch, then \(g'M_Zg\) may be positive and the coefficient can be estimable. That condition is necessary, not sufficient for a reliable test: very little within-batch variation can produce an unstable estimate and a test with low precision.
Diagnostics, Alternatives, and Limitations
The procedure is most defensible when the reduced model is appropriate under the null, the outcome and design are aligned observation by observation, the genetic predictor has variation remaining after adjustment, and the error structure is compatible with the allowed permutations. If there are exchangeability blocks, permutations must respect them; a free shuffle across subjects from distinct blocks changes the reference distribution in an unjustified way. Restrictions do not remove the projection issue: permuted fitted residuals still need not behave like permuted errors.
A model-based \(t\)- or \(F\)-test uses its reference distribution under the specified linear-model assumptions instead of building a residual-permutation distribution. It may be preferable when those assumptions are credible and a direct regression test is adequate. Freedman–Lane can be attractive when a permutation calibration is desired and errors are plausibly exchangeable, but its approximation can be poor when leverage is high, the mean model is misspecified, or exchangeability restrictions are ignored. The choice is not simply “permutation is assumption-free”: every permutation procedure relies on a defensible invariance or approximation argument.
The method also depends on the statistic. A \(t\)-statistic compares the estimated coefficient with its estimated standard error; a studentized statistic can be more suitable than an unstandardized coefficient when scale varies, but it does not automatically fix an invalid permutation scheme. For a two-sided alternative, compare absolute statistics; for a one-sided alternative, define the direction in advance and compare in that direction. A large permutation count reduces Monte Carlo noise but cannot correct a systematically inappropriate reference distribution.
Common Mistakes
- Permuting the raw outcome. This destroys the fitted nuisance structure. Freedman–Lane keeps \(\hat y_0\) fixed and permutes the reduced-model residuals.
- Calling the test exact because it uses permutations. Reduced-model residuals are projected, generally dependent, and not identically distributed. The usual Freedman–Lane justification is approximate.
- Shuffling across restricted units. Related samples or blocks can invalidate unrestricted permutations. The allowed permutations must follow the design’s exchangeability structure.
- Ignoring estimability. If \(g'M_Zg=0\), no conditional genetic coefficient is identifiable; if it is nearly zero, uncertainty can be large.
- Interpreting a p-value as a probability of the null. A permutation p-value measures extremeness under the constructed null reference distribution, not the probability that \(H_0\) is true.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- In the Freedman–Lane procedure, what is held fixed, and what is permuted?
- With \(B=499\) permutations, 14 absolute permuted statistics are at least as large as the observed absolute statistic. Compute the add-one p-value.
- Why are fitted reduced-model residuals not generally interchangeable with the true errors?
- What does \(g'M_Zg=0\) imply for a conditional test of the genetic coefficient?
Solutions. (1) The nuisance design \(Z\), genetic predictor \(g\), and reduced fitted values \(\hat y_0\) are held fixed; the reduced residuals \(e_0\) are permuted and added back to \(\hat y_0\). (2) \(\hat p=(1+14)/(499+1)=15/500=0.030\). (3) Residuals are obtained by projection, which generally induces dependence and unequal variances; their permutation distribution need not equal the true-error permutation distribution. (4) Since \(g'M_Zg=0\), the predictor has no variation beyond the nuisance covariates, so its conditional coefficient is not estimable.