What Is Being Tested?
A random-slope test asks whether the effect of a predictor varies across clusters, over and above differences in cluster baselines. For example, clinics may differ in their underlying event rates and also in how strongly an exposure is associated with those rates. The test considered here adds a random slope while retaining the random intercept. Its reference distribution needs care: under the null, the slope variance is zero, which lies on the boundary of the permitted parameter space.
The particular mixture reference developed below applies to a specified model: the random intercept and candidate random slope are independent. This is an important modeling condition, not a technical detail to omit. If their covariance is freely estimated, the reference distribution may differ; a simple half-and-half mixture should not be used automatically.
The null hypothesis is about the variance of the cluster-specific slopes, not about the fixed slope coefficient in \(\boldsymbol{\beta}\). Under the null, clusters can still differ in baseline through \(b_{0i}\), and the population-level fixed effect of \(x_{ij}\) is still estimated. The random slope describes additional cluster-to-cluster variation in that effect.
Conditions for the Mixture Reference
Fit both models by maximizing the same marginal likelihood, integrating over the random effects, with the same observations and fixed-effects specification. Let \(\ell_0\) and \(\ell_1\) be the maximized log likelihoods under the null and alternative. The likelihood-ratio statistic is
The alternative includes the null as the boundary case \(\tau^2=0\), so ideally \(T\geq 0\). The usual asymptotic reference for this independent one-variance-component test is a mixture: probability one-half at zero and probability one-half on a chi-square distribution with one degree of freedom. The point mass at zero is written \(\chi^2_0\).
The mixture arises because a variance cannot be negative. A regular one-parameter likelihood calculation would allow local movement in either direction from the null. Here the local estimate is constrained to be nonnegative: if the unconstrained local score points toward a negative variance, the constrained estimate stays at zero; if it points toward a positive variance, it moves into the alternative.
Why the Mixture Has These Weights
A short local argument explains both the boundary mass and the weights. After accounting for regular nuisance parameters, the standardized local score for the variance has an asymptotic standard normal distribution, say \(Z\sim N(0,1)\). In a locally quadratic likelihood, the unconstrained improvement is proportional to \(Z^2\). Constraining the local variance parameter to be nonnegative replaces \(Z\) by its positive part.
If \(Z\leq 0\), which happens with probability \(1/2\) by symmetry, the constrained estimate is zero and \(T=0\). If \(Z>0\), the statistic is \(Z^2\). The positive half of a symmetric standard normal distribution contributes half the probability of the full \(Z^2\) distribution, which is \(\chi^2_1\). Thus the distribution has mass \(1/2\) at zero and weight \(1/2\) on \(\chi^2_1\), as claimed.
For an observed \(T>0\), the mixture-reference upper-tail p-value is therefore
where \(\Phi\) is the standard normal cumulative distribution function. At \(T=0\), the upper-tail probability, including the mass at zero, is 1. A p-value is a tail probability under the null reference model; it is not the probability that the null hypothesis is true.
Worked Example: Testing an Independent Random Slope
Consider hypothetical data from 24 clinics. Each clinic contributes binary outcomes at three exposure values, coded \(-1\), \(0\), and \(1\); across all clinics, the event counts are 18 of 72, 22 of 72, and 31 of 72 at those respective values. A logistic GLMM includes a fixed intercept and exposure effect and a clinic random intercept. The proposed alternative adds an independent clinic random slope for exposure.
The design includes within-clinic variation in exposure, so the slope variation is not being inferred solely by comparing clinics observed at different exposure values. Suppose the fitted marginal log likelihoods are \(\ell_0=-114.30\) and \(\ell_1=-111.88\). The fixed effects and observations are identical across fits. The independence restriction, binomial response model, and adequate number of clusters are assumptions for this analysis; the likelihood-ratio calculation does not itself verify that they are correct.
Calculate the statistic. $$ T=2\{\ell_1-\ell_0\} =2\{-111.88-(-114.30)\} =2(2.42) =4.84. $$
Calculate the p-value. Since \(T>0\), use the positive-tail mixture formula: $$ p=1-\Phi(\sqrt{4.84}) =1-\Phi(2.20) \approx 0.0139. $$
At significance level \(\alpha=0.05\), this p-value is below \(\alpha\). Under the stated model and reference approximation, the data provide evidence against zero random-slope variance. This supports variation in the exposure effect across clinics; it does not establish that the exposure causes the outcome or that every clinic has a different slope.
Worked Checks and a Boundary Outcome
A likelihood-ratio statistic can be zero when adding the random slope does not improve the maximized likelihood. This is a natural result of the null being a boundary point; it is not evidence that the test statistic should be made negative or that a different, ordinary chi-square reference should be substituted.
Worked Example: The Slope-Variance Estimate Is Zero
Suppose a hypothetical study of 18 schools records a binary outcome at several values of a predictor within each school. The fitted null and independent-random-slope models have log likelihoods \(\ell_0=-76.12\) and \(\ell_1=-76.12\), respectively. Assume the same fixed effects are included, and the model and fitting conditions are as specified for the mixture test.
The statistic is $$ T=2\{-76.12-(-76.12)\}=0. $$
At zero, the reference distribution has a point mass of \(1/2\), as well as its continuous \(\chi^2_1\) component. The upper-tail probability including the observed value is 1. Thus the mixture-reference p-value is \(p=1.000\). These results give no evidence against \(H_0:\tau^2=0\) in this test. They do not prove that the true slope variance is exactly zero; limited information can also make a small variance difficult to distinguish from zero.
Worked Example: Applying a Five-Percent Decision Rule
In another hypothetical study, assume an independent random slope, retained random intercept, and the same fixed-effects specification in both fits. The maximized log likelihoods are \(\ell_0=-94.15\) and \(\ell_1=-92.60\). Assume the cluster design supports identification of slope variation and there are enough clusters for the asymptotic reference to be reasonable.
The likelihood-ratio statistic is $$ T=2\{-92.60-(-94.15)\}=2(1.55)=3.10. $$ The mixture-reference p-value is $$ p=1-\Phi(\sqrt{3.10}) =1-\Phi(1.761) \approx 0.0392. $$
Because \(0.0392<0.05\), the test rejects \(H_0\) at the five-percent level. Equivalently, the five-percent upper-tail critical value for this mixture is the 90th percentile of \(\chi^2_1\), approximately \(2.706\): half the mixture mass is already at zero, so the remaining upper-tail probability of \(0.05\) corresponds to a \(\chi^2_1\) tail probability of \(0.10\). Since \(3.10>2.706\), the critical-value decision agrees with the p-value decision.
Model Restrictions, Alternatives, and Diagnostics
The independence assumption matters. If the alternative estimates an intercept–slope covariance, then under a zero-slope-variance null that covariance must also be zero for the random-effects covariance matrix to be valid. The covariance and variance constraints then interact at the boundary. The half-\(\chi^2_0\), half-\(\chi^2_1\) result derived here is not automatically justified for that alternative. Use a reference distribution appropriate to the covariance structure, such as a justified chi-bar-square mixture, or use a parametric bootstrap under the null when its assumptions and computation are suitable.
Other common approaches answer different questions or can fail at the boundary. A Wald test based on an estimated slope variance divided by its standard error relies on an approximately normal estimator and can be unreliable when the estimate is near zero. Comparing the statistic to an ordinary \(\chi^2_1\) reference ignores the boundary mass and generally gives the wrong tail probability. A parametric bootstrap can better reflect finite-sample behavior, but it depends on the null model and the bootstrap procedure being correctly implemented; it is not a way to avoid specifying the model.
Before interpreting the asymptotic test, check that the data and fit support its assumptions:
- Within-cluster predictor spread: if \(x_{ij}\) barely varies within clusters, slope variation may be weakly identified. Check the predictor ranges by cluster.
- Convergence and likelihood ordering: the alternative should attain a likelihood at least as large as the nested null, up to numerical tolerance. A negative \(T\) can signal an optimizer or comparison problem.
- Boundary behavior: inspect whether the fitted slope variance is zero or nearly zero, whether standard errors or Hessian calculations are unstable, and whether the optimizer reports singularity.
- Model specification: check the response distribution, link, fixed-effects structure, and random-effects structure. A mixture reference does not correct misspecification.
- Cluster count: with few clusters, the asymptotic mixture may be poorly calibrated. Consider a parametric bootstrap or another finite-sample method rather than assuming the large-sample reference is exact.
The key limitation is that a non-significant test does not establish absence of meaningful slope heterogeneity. The test may have low power, especially with few clusters or little within-cluster predictor variation. Conversely, a significant result supports a nonzero variance component under the assumed model, but it does not by itself describe the size or practical importance of slope differences.
Check Your Understanding
Answer the questions, then check the brief solutions below.
- In the stated test, what remains in the model under \(H_0\), and what parameter is constrained to zero?
- For \(T=2.25\), calculate the mixture-reference p-value using \(p=1-\Phi(\sqrt{T})\).
- Why is the ordinary \(\chi^2_1\) reference not the reference used in this independent one-variance-component test?
- What additional issue arises if the alternative freely estimates the intercept–slope covariance?
Solutions. (1) The random intercept and fixed effects remain; the random-slope variance \(\tau^2\) is constrained to zero. (2) \(\sqrt{2.25}=1.50\), so \(p=1-\Phi(1.50)\approx 0.0668\). (3) The null value is on the boundary: the constrained estimate is zero when the local score points toward a negative variance, creating a point mass at zero and the half-and-half mixture. (4) The covariance must also satisfy the positive-semidefinite covariance constraint and is zero under the null, so the simple mixture derived for an independent slope is not automatically valid.