Why Test for Cross-Sectional Dependence?
Panel errors may move together across units in the same period. For example, firms can be exposed to a common change in demand, or regions to a shared policy shock. Even after fitting a regression, such shared movements can remain in its residuals. This matters because several panel inference procedures rely on assumptions about how errors co-vary across units. A dependence test can flag a problem with that assumption; it does not, by itself, identify the source of the dependence or prescribe a correction.
Two widely used residual-based tests summarize the pairwise correlations among units: the Breusch–Pagan Lagrange multiplier (LM) test and Pesaran’s cross-sectional dependence (CD) test. Both ask whether residuals appear correlated across units, but they aggregate correlations differently and have different reference distributions and asymptotic justifications.
Model, Residual Correlations, and Null Hypothesis
Suppose a balanced panel has \(N\) units observed for \(T\) periods, and a regression has been fitted for each unit using a specified panel model. Write the residual for unit \(i\) in period \(t\) as \(\hat e_{it}\). The sample correlation between the residual series for units \(i\) and \(j\) is
where \(\bar{\hat e}_i=T^{-1}\sum_{t=1}^{T}\hat e_{it}\). There are \(M=N(N-1)/2\) distinct unit pairs. These are correlations across time between two units’ residual series, not correlations over time within one unit.
Zero pairwise correlation is weaker than mutual independence in general. If errors are jointly Gaussian, zero correlations imply independence, but without such a distributional condition the test is specifically about pairwise linear correlation. The residual-based tests also assess dependence left after the chosen regression has been fitted; changing the model can change the residual correlations.
Two Statistics, Two Ways to Aggregate Correlation
The Breusch–Pagan LM statistic adds squared correlations. Under its conventional fixed-\(N\), large-\(T\) null approximation, it is compared with a chi-square distribution having \(M\) degrees of freedom:
Squaring prevents positive and negative correlations from cancelling. In return, the statistic has \(M\) components, so the usual chi-square approximation is most straightforward when \(N\) is fixed and \(T\) grows.
Pesaran’s CD statistic instead adds the signed correlations and standardizes their sum:
The standard normal reference gives a two-sided p-value for the joint null. A large positive or negative statistic indicates that the signed sum is unusually far from zero. Because the sum is signed, substantial positive and negative correlations can offset one another. Thus, a non-rejection by CD does not establish that every pair is uncorrelated.
Why the Reference Distributions Arise
The approximations rely on conditions such as a correctly specified residual calculation under the null, sufficiently informative observations over time, and regularity conditions that make the pairwise sample correlations behave approximately as expected. Estimating regression parameters affects the residuals, so the exact finite-sample distribution is generally not the displayed reference distribution. These are asymptotic tests, not exact tests for arbitrary panels.
The core normalization can be seen under a simple null approximation in which each pairwise residual correlation has mean zero and variance about \(1/T\), and the pair-correlation terms contribute approximately additively. There are \(M=N(N-1)/2\) terms, so the variance of their sum is approximately \(M/T\). Dividing the sum by its approximate standard deviation gives
This is the CD scaling. For the LM statistic, when \(N\) is fixed and \(T\) grows, the standardized pairwise correlations are approximately standard normal under the null. The sum of their \(M\) squares then has an approximate chi-square distribution with \(M\) degrees of freedom. These arguments describe the null approximations; they do not guarantee accurate size in every finite panel.
Worked Example: Weak Correlations in a Three-Unit Panel
Consider a hypothetical balanced panel with \(N=3\) units and \(T=20\) periods. Suppose the fitted regression gives residual correlations \(\hat\rho_{12}=0.10\), \(\hat\rho_{13}=-0.05\), and \(\hat\rho_{23}=0.20\). There are \(M=3\) pairs.
For CD, the signed sum is \(0.10-0.05+0.20=0.25\), and the scaling factor is \(\sqrt{2(20)/(3(2))}=\sqrt{40/6}\approx2.582\). Therefore,
The two-sided standard normal p-value is approximately \(0.519\). At the 5% significance level, this is not sufficient evidence to reject the null of zero pairwise residual correlations.
For LM, the sum of squared correlations is \(0.10^2+(-0.05)^2+0.20^2=0.0525\). Thus,
The chi-square upper-tail p-value is approximately \(0.789\). The LM test also does not reject at 5%. Neither result proves independence; both say that these data do not provide strong evidence against the specified null under the tests’ approximations.
Worked Example: Opposite Signs Can Separate the Tests
In another hypothetical three-unit panel with \(T=20\), suppose the three residual correlations are \(0.50\), \(0.30\), and \(-0.10\). Their signed sum is \(0.70\), while their squared sum is \(0.25+0.09+0.01=0.35\).
The CD statistic is
Its two-sided standard normal p-value is approximately \(0.0708\), so CD does not reject at 5%.
For LM,
The chi-square upper-tail p-value is approximately \(0.0719\), which also exceeds 0.05. The example illustrates how to calculate each aggregation: signed correlations enter CD, while squared correlations enter LM. Here both conclusions happen to agree, but they need not agree in general.
Worked Example: Strong Pairwise Evidence and Correct Tail Areas
Suppose a hypothetical balanced panel again has \(N=3\), now with \(T=20\), and residual correlations \(0.80\), \(0.50\), and approximately \(0.4210\). The squared sum is approximately \(0.80^2+0.50^2+0.4210^2=1.0672\). The signed sum is \(1.721\).
The LM statistic and its reference degrees of freedom are
The chi-square upper-tail probability is approximately \(0.0000893\). This is below 0.05, so the LM test rejects the joint null at the 5% level. This p-value is the probability, under the null approximation, of obtaining a chi-square statistic at least as large as 21.345; it is not the probability that the null hypothesis is true.
For comparison, CD is
The two-sided standard normal p-value is approximately \(0.0000089\), also leading to rejection at 5%. The evidence is strong against zero pairwise residual correlations under both tests’ respective null approximations.
Panel Dimensions, Size, and Practical Limits
Here, size means the probability of rejecting the null when it is true. In finite samples, an asymptotic reference distribution may not deliver the nominal rejection probability. The panel dimensions affect which approximation is credible:
- Fixed \(N\), increasing \(T\): The conventional LM chi-square approximation is motivated by a fixed number of pairwise correlations becoming better estimated over time. With very short \(T\), those estimates can be noisy, and the nominal chi-square p-value may be poorly calibrated.
- Large \(N\): The number of LM terms and its degrees of freedom grow as \(N(N-1)/2\). When \(N\) is large relative to \(T\), the conventional fixed-\(N\) approximation can be unreliable and may have size distortions. CD was developed to provide a standardized statistic with a normal null approximation under suitable panel asymptotics, but that is not a guarantee of accurate size in every design.
- Cancellation and dependence patterns: CD may have limited power when positive and negative correlations cancel in the signed sum. LM avoids this particular cancellation through squaring, but its large-\(N\) calibration is a concern. Results can also depend on the regression used to obtain residuals and on whether every unit is observed in every period.
The formulas above define the balanced-panel versions. With missing observations or different time spans by pair, correlations are based on different numbers of common periods; an appropriate unbalanced-panel implementation is needed rather than mechanically applying a single \(T\). Report the sample dimensions, the residual model, the statistic, the reference distribution, and the p-value so readers can assess the calculation.
Common Mistakes
- Using the wrong tail or degrees of freedom. LM uses an upper-tail chi-square probability with \(N(N-1)/2\) degrees of freedom. For example, \(LM=7\) with \(df=3\) has p-value about \(0.0719\), not the tail area for four degrees of freedom.
- Squaring correlations in the CD statistic. CD sums signed correlations; LM sums their squares. Substituting one formula for the other changes the test.
- Treating non-rejection as proof of independence. A large p-value means the test did not find sufficient evidence against its null. It does not show that all forms of dependence are absent.
- Reading a p-value as the probability the null is true. A p-value is calculated assuming the null and reference approximation; it is a tail probability for a statistic at least as extreme as the observed one.
- Assuming rejection identifies a mechanism. Rejection signals residual pairwise dependence, not whether it arose from common shocks, spatial links, misspecification, or another source.
Check Your Understanding
Use the definitions and assumptions above to answer the following.
- For \(N=5\), how many pairwise residual correlations enter the LM statistic, and what are its conventional chi-square degrees of freedom?
- Why can positive and negative pairwise correlations offset one another in Pesaran CD but not in the Breusch–Pagan LM statistic?
- A panel has \(N=4\), \(T=12\), and the sum of squared pairwise residual correlations is \(0.40\). Calculate the LM statistic and its degrees of freedom.
- What does a 5% rejection by either test establish, and what does it not establish about the source of dependence?
- Why should the conventional LM chi-square approximation be treated cautiously when \(N\) is large relative to \(T\)?