Perform Pesaran CD test¶
Source: man/performPesaranTest.Rd · Help: ?performPesaranTest
Checks for cross-sectional dependence in panel residuals.
Usage¶
Arguments¶
model- an object of class
lm, the pooledlm()of the panel. data- The data frame
modelwas fitted to, holding the panel identifiers named byidandtime, orNULL, the default. The residuals and weights are read from the fit itself, andidandtimefrom the rows ofdatathat hold the observations of the fit. Withoutdatathey are read from the model frame ofmodel, which holds them only when they are variables of the model under their own names (id, notfactor(id)); identifiers the model does not use needdata. Since 0.16.0, data that are given are matched to the observations of the fit: rows with row names of their own by name, in any order; rows that only number themselves (a tibble, a data.table, a data frame whose row names were reset) by the row numbers of the fit, or in the order of the fit when they hold one row per observation. The rows the fit dropped may be there or not. Data whose rows cannot be shown to hold the observations of the fit are refused; seetest_results. id- individual identifier column.
time- time column. Each pair of
idandtimemust hold one observation of the fit: since 0.16.0 a pair that holds more is refused. The units need not be observed at the same periods (Details).
Value¶
An object of class htest.
Details¶
The statistic averages pairwise correlation coefficients of the residuals and is standardized to follow a normal distribution under the null of independence. On a balanced panel of \(N\) units observed at the same \(T\) periods it is
where \(\hat{\rho}_{ij}\) is the correlation of the residuals of units \(i\) and \(j\). On an unbalanced panel, whose units are not all observed at the same periods, it is computed, since 0.16.0, from the periods each pair of units shares (Pesaran 2004, Section 9, equation 31), as plm::pcdtest(test = "cd") computes it:
where \(T_{ij}\) is the number of periods at which units \(i\) and \(j\) are both observed, \(\hat{\rho}_{ij}\) the correlation of their residuals over those periods, each centred at its mean over them, and \(P\) the number of pairs that share at least two periods, the pairs of the sum: \(N(N - 1)/2\) when every pair does. On a balanced panel, where \(T_{ij} = T\), the two are the same statistic. A pair that shares fewer than two periods has no correlation and is left out, with a warning, as plm::pcdtest() leaves it out, and a panel in which no pair shares two periods is refused. A correlation that is not defined, the residuals of a unit constant over the periods of a pair, adds nothing to the sum and the pair stays in the count, as on a balanced panel, with a warning; plm::pcdtest() returns NA there, so the statistic is that of plm::pcdtest() except where a correlation is undefined. Pesaran (2004) states its standard normal limit under the null of independence for \(T_i > k + 1\) and \(T_{ij} > 3\), with \(N\) large, \(T_i\) being the number of periods of unit \(i\) and \(k\) the number of regressors of its own regression.
Supported models¶
It accepts an lm and a glm with the Gaussian family and the identity link, unweighted
or with positive weights, a fitWLS() fit and, since 0.16.0, a rank-deficient fit, which it
tests on the estimable part of its design: it gives the value of the same model fitted without the
aliased columns. It refuses a glm of another family or link, a survey::svyglm() fit, a
fit with a zero weight, a coefficient that is not finite for another reason, and data that
lack rows or variables of the fit. The model is a pooled lm of the panel, with the units and
the periods as columns of data; a plm::plm() fit is not an lm and is refused.
Since 0.16.0 a pair of id and time that holds two observations of the fit is refused.
An unbalanced panel, as that of a fit that dropped some rows of some units, is tested since 0.16.0,
from the periods each pair of units shares (Details), and gives the value of
plm::pcdtest(test = "cd") on the residuals of the fit, except where a correlation is
undefined (Details): before, the test stopped on it, or, when the number of periods of a unit
divided that of the panel, returned a wrong value computed on its residuals recycled over the
periods it lacks. A fit with na.action = na.exclude is tested since 0.17.0 as the same fit
with na.omit, on the observations it kept, its panel balanced or not: before, it was read
by position, its residuals padded with NA at the rows it dropped, against the rows of
data, which had to be in the order of the fit, and an unbalanced panel of those rows was
refused.
Which model each test accepts, and why, is set out in test_results, under
Supported models.
References¶
Pesaran, M. H. (2004). General diagnostic tests for cross section dependence in panels. CESifo Working Paper 1229 (also Cambridge Working Papers in Economics 0435). Section 9, “CD tests in the case of unbalanced panels”, equation 31.
Pesaran, M. H. (2015). Testing weak cross-sectional dependence in large panels. Econometric Reviews 34(6-10), 1089–1117. doi:10.1080/07474938.2014.956623.
Croissant, Y. and Millo, G. (2008). Panel data econometrics in R: the plm package. Journal of Statistical Software 27(2), 1–43. doi:10.18637/jss.v027.i02. The statistic of an unbalanced panel is that of plm::pcdtest(test = "cd") (plm 2.6-6), whose help page says its tests are “suitable also for unbalanced panels”.