Panel Econometrics & Time Series
Pesaran CD Test for Cross-Sectional Dependence in Panels
Compute Pesaran’s (2004) cross-sectional dependence statistic CD = SQRT(2*T / (N*(N-1))) * SUM(rho_ij) and compare it against Breusch-Pagan LM across panel residual columns.
Detect common shocks in short-T panels where Breusch-Pagan LM over-rejects
When panel cross-sections N share unobserved macro, regulatory, or regional shocks, fixed-effects standard errors become severely downward biased. Classic Breusch-Pagan LM = T * SUM_{i<j} rho_ij^2 requires T -> infinity with fixed N and suffers severe size distortion when N is moderate or large relative to T. Pesaran (2004) centered the test directly on signed pairwise residual correlations: CD = SQRT(2 * T / (N * (N - 1))) * SUM_{i<j} rho_ij, which is asymptotically N(0, 1) even for small T!
Build a 4-unit x 6-period residual matrix (N = 4, T = 6 in B2:E7, producing M = 4*3/2 = 6 unique pairs). Because 2 * T / (N * (N - 1)) = 12 / 12 = 1.0000, the scaling factor is exact unity! Across the four residual columns, the six pairwise CORREL values equal 0.90, 0.80, 0.60, 0.90, 0.30, and 0.00 — summing to 3.5000 (mean correlation 0.5833) and giving CD = 3.5000 (> 1.96, rejecting cross-sectional independence at 1%) alongside LM = 6 * 2.71 = 16.2600.
| Panel Dependence Diagnostic | Formula Structure (N = 4, T = 6) | Sample Result |
|---|---|---|
| Sum of M = 6 Pairwise Correlations | r_12 + r_13 + r_14 + r_23 + r_24 + r_34 | 3.5000 (Mean = 0.5833) |
| Pesaran CD Z-Statistic | SQRT(2*T / (N*(N - 1))) * SUM(r_ij) | 3.5000 (Reject H_0 at 5%) |
| Breusch-Pagan LM Chi-Square (df = 6) | T * SUM(r_ij^2) | 16.2600 |
Pesaran CD Statistic Across Panel Residual Columns Formula
Evaluate all six pairwise CORREL values explicitly inside LET and scale by SQRT(2 * T / (N * (N - 1))). Notice Pesaran’s signed-cancellation caveat: flipping signs on half the units (e.g., opposing factor loadings) can drive mean signed correlation near zero even when squared correlations in LM stay positive!
=LET(u_1, B2:B7, u_2, C2:C7, u_3, D2:D7, u_4, E2:E7, t_len, ROWS(u_1), n_units, 4, IF(t_len < 3, "Insufficient Time Periods", LET(r_12, CORREL(u_1, u_2), r_13, CORREL(u_1, u_3), r_14, CORREL(u_1, u_4), r_23, CORREL(u_2, u_3), r_24, CORREL(u_2, u_4), r_34, CORREL(u_3, u_4), sum_r, r_12 + r_13 + r_14 + r_23 + r_24 + r_34, ROUND(SQRT((2 * t_len) / (n_units * (n_units - 1))) * sum_r, 4))))Breusch-Pagan Panel LM = T * SUM(rho_ij^2) Comparison Formula
Pair CD with T * SUM(r_ij^2) so peer reviewers can spot opposing-sign factor loadings that cancel in CD but remain large in squared correlations.
=LET(u_1, B2:B7, u_2, C2:C7, u_3, D2:D7, u_4, E2:E7, t_len, ROWS(u_1), r_12, CORREL(u_1, u_2), r_13, CORREL(u_1, u_3), r_14, CORREL(u_1, u_4), r_23, CORREL(u_2, u_3), r_24, CORREL(u_2, u_4), r_34, CORREL(u_3, u_4), ROUND(t_len * (r_12^2 + r_13^2 + r_14^2 + r_23^2 + r_24^2 + r_34^2), 4))Try the example
Use the original values or change them to test your understanding.