Pesaran's CD or Breusch–Pagan's LM (local or global) tests for cross sectional dependence in panel models
pcdtest(x, ...)
# S3 method for class 'formula'
pcdtest(
x,
data,
index = NULL,
model = NULL,
test = c("cd", "sclm", "bcsclm", "lm", "rho", "absrho"),
w = NULL,
...
)
# S3 method for class 'panelmodel'
pcdtest(
x,
test = c("cd", "sclm", "bcsclm", "lm", "rho", "absrho"),
w = NULL,
...
)
# S3 method for class 'pseries'
pcdtest(
x,
test = c("cd", "sclm", "bcsclm", "lm", "rho", "absrho"),
w = NULL,
...
)an object of class formula, panelmodel, or pseries
(depending on the respective interface) describing the model to
be tested,
further arguments to be passed on for model estimation to plm,
such as effect or random.method.
a data.frame,
an optional numerical index, if NULL, the first two
columns of the data.frame provided in argument data are
assumed to be the index variables; for further details see
pdata.frame(),
an optional character string indicating which type of
model to estimate; if left to NULL, the original
heterogeneous specification of Pesaran is used,
the type of test statistic to be returned. One of
"cd" for Pesaran's CD statistic,
"lm"
for Breusch and Pagan's original LM statistic,
"sclm"
for the scaled version of Breusch and Pagan's LM statistic,
"bcsclm" for the bias-corrected scaled version of
Breusch and Pagan's LM statistic,
"rho" for the average
correlation coefficient,
"absrho" for the average
absolute correlation coefficient,
either NULL (default) for the global tests or – for the
local versions of the statistics – a n x n matrix
describing proximity between individuals, with \(w_ij = a\)
where \(a\) is any number such that as.logical(a)==TRUE, if
\(i,j\) are neighbours, \(0\) or any number \(b\) such
that as.logical(b)==FALSE elsewhere. Only the lower
triangular part (without diagonal) of w after coercing by
as.logical() is evaluated for neighbouring information (but
w can be symmetric). See also Details and
Examples,
An object of class "htest".
These tests are originally meant to use the residuals of separate
estimation of one time–series regression for each cross-sectional
unit in order to check for cross–sectional dependence (model = NULL).
If a different model specification (model = "within", "random",
...) is assumed consistent, one can resort to its residuals for
testing (which is common, e.g., when the time dimension's length is
insufficient for estimating the heterogeneous model).
If the time
dimension is insufficient and model = NULL, the function defaults
to estimation of a within model and issues a warning. The main
argument of this function may be either a model of class
panelmodel or a formula and data frame; in the second case,
unless model is set to NULL, all usual parameters relative to
the estimation of a plm model may be passed on. The test is
compatible with any consistent panelmodel for the data at hand,
with any specification of effect (except for test = "bcsclm" which
requires a within model with either individual or two-ways effect).
E.g., specifying effect = "time" or effect = "twoways" allows
to test for residual cross-sectional dependence after the introduction
of time fixed effects to account for common shocks.
A local version of either test can be computed by supplying a
proximity matrix (elements coercible to logical) with argument
w which provides information on whether any pair of individuals
are neighbours or not. If w is supplied, only neighbouring pairs
will be used in computing the test; else, w will default to
NULL and all observations will be used. The matrix need not be
binary, so commonly used "row–standardized" matrices can be
employed as well. nb objects from spdep must instead be
transformed into matrices by spdep's function nb2mat
before using.
The methods implemented are suitable also for unbalanced panels.
Pesaran's CD test (test="cd"), Breusch and Pagan's LM test
(test="lm"), and its scaled version (test="sclm") are all
described in Pesaran (2004)
(and complemented by
Pesaran (2005)). The bias-corrected scaled test (test="bcsclm")
is due to (Baltagi et al. 2012)
and only valid for
within models including the individual effect (it's unbalanced
version uses max(Tij) for T) in the bias-correction term).
Breusch and Pagan (1980)
is the original source for
the LM test.
The test on a pseries is the same as a test on a pooled
regression model of that variable on a constant, i.e.,
pcdtest(some_pseries) is equivalent to pcdtest(plm(some_var ~ 1, data = some_pdata.frame, model = "pooling") and also equivalent to
pcdtest(some_var ~ 1, data = some_data), where some_var is
the variable name in the data which corresponds to some_pseries.
Baltagi BH, Feng Q, Kao C (2012). “A Lagrange Multiplier test for cross-sectional dependence in a fixed effects panel data model.” Journal of Econometrics, 170(1), 164 - 177. ISSN 0304-4076, https://doi.org/10.1016/j.jeconom.2012.04.004.
Breusch TS, Pagan AR (1980). “The Lagrange Multiplier Test and Its Applications to Model Specification in Econometrics.” Review of Economic Studies, 47, 239–253.
Pesaran MH (2004). “General Diagnostic Tests for Cross Section Dependence in Panels.” CESifo Working Paper Series, 1229.
Pesaran MH (2015). “Testing Weak Cross-Sectional Dependence in Large Panels.” Econometric Reviews, 34(6-10), 1089-1117. doi:10.1080/07474938.2014.956623 , https://doi.org/10.1080/07474938.2014.956623.
data("Grunfeld", package = "plm")
## test on heterogeneous model (separate time series regressions)
pcdtest(inv ~ value + capital, data = Grunfeld,
index = c("firm", "year"))
#>
#> Pesaran CD test for cross-sectional dependence in panels
#>
#> data: inv ~ value + capital
#> z = 5.3401, p-value = 9.292e-08
#> alternative hypothesis: cross-sectional dependence
#>
## test on two-way fixed effects homogeneous model
pcdtest(inv ~ value + capital, data = Grunfeld, model = "within",
effect = "twoways", index = c("firm", "year"))
#>
#> Pesaran CD test for cross-sectional dependence in panels
#>
#> data: inv ~ value + capital
#> z = 0.1162, p-value = 0.9075
#> alternative hypothesis: cross-sectional dependence
#>
## test on panelmodel object
g <- plm(inv ~ value + capital, data = Grunfeld, index = c("firm", "year"))
pcdtest(g)
#>
#> Pesaran CD test for cross-sectional dependence in panels
#>
#> data: inv ~ value + capital
#> z = 4.6612, p-value = 3.144e-06
#> alternative hypothesis: cross-sectional dependence
#>
## scaled LM test
pcdtest(g, test = "sclm")
#>
#> Scaled LM test for cross-sectional dependence in panels
#>
#> data: inv ~ value + capital
#> z = 21.222, p-value < 2.2e-16
#> alternative hypothesis: cross-sectional dependence
#>
## test on pseries
pGrunfeld <- pdata.frame(Grunfeld)
pcdtest(pGrunfeld$value)
#>
#> Pesaran CD test for cross-sectional dependence in panels
#>
#> data: pGrunfeld$value
#> z = 13.843, p-value < 2.2e-16
#> alternative hypothesis: cross-sectional dependence
#>
## local test
## define neighbours for individual 2: 1, 3, 4, 5 in lower triangular matrix
w <- matrix(0, ncol= 10, nrow=10)
w[2,1] <- w[3,2] <- w[4,2] <- w[5,2] <- 1
pcdtest(g, w = w)
#>
#> Pesaran CD test for local cross-sectional dependence in panels
#>
#> data: inv ~ value + capital
#> z = -0.87759, p-value = 0.3802
#> alternative hypothesis: cross-sectional dependence
#>