linearmodels.panel.results.FamaMacBethResults.pesaran_cd

property FamaMacBethResults.pesaran_cd : InapplicableTestStatistic | NormalTestStatistic

Pesaran CD test of residual cross-sectional dependence.

Returns:

Statistic value, distribution and p-value. If the test is not valid for the model, an InapplicableTestStatistic that explains why in its reason.

Return type:

linearmodels.shared.hypotheses.NormalTestStatistic or linearmodels.shared.hypotheses.InapplicableTestStatistic

Notes

Tests the null hypothesis that the model’s idiosyncratic shocks are cross-sectionally independent [1]. Let \(\hat{\rho}_{ij}\) denote the sample correlation of the estimated idiosyncratic shocks for entities \(i\) and \(j\), computed using their common time observations, and let \(T_{ij}\) denote the number of overlapping observations. The statistic is

\[CD = \frac{1}{\sqrt{M}}\sum_{i<j}\sqrt{T_{ij}}\hat{\rho}_{ij},\]

where \(M\) is the number of entity pairs with at least two overlapping observations and finite pairwise correlation estimates. Under the null, the statistic is asymptotically standard normal.

The shocks are the model’s idiosyncratic values, so the weights of a weighted model are not applied to them. The exception is FirstDifferenceOLS, which uses resids, the residuals of the differenced equation, as plm::pcdtest does for a pooled regression of the differenced data. Its idiosyncratic values are in levels, and are persistent when the errors are, for example a random walk, which is when first differences are used. Since the correlations are computed over time, the test assumes that the shocks are not serially correlated, and it over-rejects if they are persistent. Conversely, if the errors in levels are serially uncorrelated, the residuals of FirstDifferenceOLS are negatively autocorrelated (an MA(1) with autocorrelation -0.5) and the test over-rejects, with a size of about 11% at the nominal 5% level in large panels. The test is then better applied to a PanelOLS model with entity effects.

The test is not valid for every model and an InapplicableTestStatistic is returned for the following.

  • BetweenOLS. The model is fitted to the entity means, so it has no time-varying residuals, and the series implied by its coefficients is not the model’s error.

  • FamaMacBeth. The model’s errors are the residuals of the period-by-period cross-sectional regressions. The series implied by the averaged coefficients contains the common, time-varying term \((\beta_t - \bar{\beta})^{\prime}x_{it}\), so it is cross-sectionally dependent by construction. Fama-MacBeth inference is also already robust to cross-sectional dependence.

  • Models with time effects, and models with other effects that change over time for some entity and have a group of several entities that is missing from some periods, such as period, industry-by-period or decade effects. These effects demean the residuals across entities that are observed in the same periods, which makes the residuals negatively correlated across entities and biases the statistic downwards. For example, when the model has time effects and the errors are independent, the statistic is centered at about \(-\sqrt{T/2}\) and its standard deviation is far below 1, so it is not standard normal [2]. Other effects that do not change over time for an entity, or that are present in every period, are not affected.

Time dummy variables (for example C(year)) among the regressors have the same effect on the residuals as time effects, and make the test invalid in the same way. The code cannot reliably detect such regressors, so that the test is returned without a warning and should not be used for a model that has them.

The statistic is computed from dense N by N matrices of pairwise correlations and numbers of overlapping observations, where N is the number of entities. Computing them takes about 450 MB of memory when N is 4,000, and the memory use is proportional to the square of N.

References