Pesaran CD Test: Cross-Sectional Dependence Diagnostic for Panel Data

Econometrics
Introduced by
M. Hashem Pesaran
Year
2021
Type
Non-parametric diagnostic test
Family
Cross-sectional dependence

What does it do?

The Pesaran CD test is a diagnostic for cross-sectional dependence in panel data, developed by M. Hashem Pesaran.

The reference for this page is Pesaran (2021), Empirical Economics 60(1), 13–50 (DOI 10.1007/s00181-020-01875-7). It is intended for balanced and unbalanced panels and is usually run on the residuals of a fitted model, as a check before choosing estimators or unit-root tests that assume cross-sectional independence.

The intuition behind the method

In panel data, observations from different cross-sectional units—countries, firms, or regions—are often not independent. A global shock such as a financial crisis, oil price change, or policy spillover tends to affect multiple units simultaneously. The CD test formalizes this intuition by measuring average pairwise correlation among residuals across all unit pairs. If units truly were independent, these correlations would average near zero. A large absolute CD statistic signals that dependence is present and that standard estimators assuming cross-sectional independence may produce misleading inference.

History

The test is set out in Pesaran (2021), published in Empirical Economics 60(1), 13–50 (DOI 10.1007/s00181-020-01875-7), which is the reference for this page; the database record dates the article to 2020, reflecting online publication. The Breusch–Pagan LM test is the natural comparison among earlier pairwise-correlation tests.

When to use it

Apply the Pesaran CD test as a diagnostic on the residuals of a panel model before estimating, or before performing panel unit-root and cointegration tests that assume cross-sectional independence. It is suited to panels where common shocks, global factors or spatial spillovers between units are plausible. The test relies on asymptotics, so it is less reliable when the time dimension is short. If dependence is found, consider second-generation unit-root tests such as CIPS and cross-sectionally robust estimators such as CCE or AMG. The test is usually applied to stationary residuals; non-stationary residuals can inflate pairwise correlations, so check stationarity before interpreting a rejection. Report the test both with and without time effects, since time effects absorb common shocks.

Limitations and considerations

  • Because the statistic sums signed correlations, positive and negative pairwise correlations can cancel, so the test can show little evidence of dependence even when it is present.
  • When N is very large and each pairwise correlation is small, the contribution of each pair to the average is small and power may be low.
  • The residuals must come from a consistently estimated model; a misspecified conditional mean can leave systematic patterns in the residuals that the test reads as cross-sectional dependence.
  • The test detects whether dependence is present but not its source or structure, so further modelling such as an explicit factor structure is needed.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Designed for large-N and large-T asymptotics, so it can be applied to panels with long time series as well as panels with many units.
  • Operates on the residuals of whichever specification is fitted, whether fixed-effects, random-effects or pooled OLS.
  • Requires only the residuals and standard normal critical values, so it can be added to an existing panel workflow with little extra estimation.

Applications

  • Testing for cross-country income spillovers and global business-cycle synchronization in international macroeconomics panels.
  • Detecting spatial or network linkages among firm-level panels before applying cross-sectionally robust financial econometrics estimators.
  • Pre-testing regional price or wage panels for the presence of common monetary or labor-market shocks.
  • Validating the assumption of cross-sectional independence required by first-generation panel unit-root tests such as IPS and LLC.
  • Screening environmental and energy economics panels for the influence of global commodity price shocks prior to cointegration analysis.

How it works

How it works

1

The researcher obtains residuals either from a panel model of interest (pooled OLS, fixed-effects or random-effects) or from separate time-series regressions for each unit, as in a mean-groups specification with heterogeneous slopes. The original pairwise-correlation tests use unit-by-unit regressions, and this is the default in the R function pcdtest. Residuals are the part of the outcome not explained by the regressors and are the input to the dependence calculation. State which form was used when reporting the result.

Formula
\text{Estimate the panel regression model and obtain OLS residuals } \hat{u}_{it} \text{ for each unit } i = 1, \ldots, N \text{ and time period } t = 1, \ldots, T.
2

For every distinct pair of units (i, j), the formula normalises the cross-product of their two residual series by the product of their norms, giving a correlation-type measure. With N units there are N(N−1)/2 such pairs. A large value for a pair means the two units deviate from their fitted values in a similar way over time, which is consistent with shared unobserved shocks or linkages between them.

Formula
\hat{\rho}_{ij} = \hat{\rho}_{ji} = \frac{\sum_{t=1}^{T} \hat{u}_{it}\hat{u}_{jt}}{\left(\sum_{t=1}^{T} \hat{u}_{it}^{2}\right)^{1/2} \left(\sum_{t=1}^{T} \hat{u}_{jt}^{2}\right)^{1/2}}
3

The CD statistic is the sum of all pairwise correlations, scaled by sqrt(2T/(N(N−1))). Under the null of no cross-sectional dependence in the residuals this scaled sum is asymptotically standard normal. The test is two-sided: large positive values indicate positive dependence and large negative values indicate negative dependence.

Formula
CD = \sqrt{\frac{2T}{N(N-1)}} \left(\sum_{i=1}^{N-1} \sum_{j=i+1}^{N} \hat{\rho}_{ij}\right) \xrightarrow{d} N(0,1) \text{ as } N, T \to \infty
4

The computed CD statistic is compared with standard normal critical values. If its absolute value exceeds the critical value at the chosen significance level (commonly 5%), the null of no cross-sectional dependence in the residuals is rejected. Rejection means the residuals are cross-sectionally dependent, which should be addressed in the subsequent analysis. The exact formulation of the null should be checked against Pesaran (2021).

Formula
\text{Reject } H_0: \rho_{ij} = 0 \text{ for all } i \neq j \text{ if } |CD| > z_{\alpha/2}, \text{ where } z_{\alpha/2} \text{ is the standard normal critical value at significance level } \alpha.

Common pitfalls

  • Applying the test to raw outcome variables rather than to regression residuals. The CD statistic must be built from the residuals of the fitted model.
  • Ignoring a rejection and proceeding with first-generation panel estimators or unit-root tests that assume cross-sectional independence.
  • Interpreting a rejection without checking residual stationarity. Non-stationary residuals can produce large correlations, so a rejection may reflect non-stationarity rather than cross-sectional dependence.
  • Reading a rejection as evidence about which units are linked. The statistic is a sum over all pairs and does not show which pairs drive the result; the individual pairwise correlations should be inspected.
  • Concluding that dependence is absent because the test is insignificant after adding time fixed effects (for example effect = 'twoways'). Time effects remove common shocks, so non-rejection then shows that common-shock dependence was absorbed, not that the original specification was free of cross-sectional dependence. Report results with and without time effects.

Frequently asked questions

How does the CD test differ from the Breusch–Pagan LM test?

The Breusch–Pagan LM statistic sums squared pairwise correlations, and that sum grows with N, which makes it a poor choice when N is large relative to T. The CD statistic instead sums the signed correlations and scales them by sqrt(2T/(N(N−1))). Under the null of no cross-sectional dependence this scaled sum has a standard normal limit, so the CD test is preferred when N is substantial.

What should I do if the CD test rejects cross-sectional independence?

Rejection indicates that first-generation estimators and unit-root tests (LLC, IPS) that assume cross-sectional independence may be invalid. Researchers should consider second-generation procedures: CIPS or CADF for unit-root testing, and CCE (Common Correlated Effects) or AMG (Augmented Mean Group) estimators for slope estimation. Factor-augmented or spatial panel models can also be used to model the dependence structure explicitly. Alternatively, robust covariance matrices can be used for inference on the parameters.

Can the CD test be used with unbalanced panels?

Yes, the test is listed as applicable to balanced and unbalanced panels. The formula shown is written with a common number of periods T; with unbalanced data each pairwise correlation is computed over the periods that both units observe. Check Pesaran (2021) for the exact treatment and conditions.

Related methods

Sources

  1. Pesaran, M. H. (2021). General diagnostic tests for cross-sectional dependence in panels. Empirical Economics, 60(1), 13–50.

    Open DOI reference