pcdtest(x, ...)
## S3 method for class 'panelmodel':
pcdtest(x, test = c("cd", "sclm", "lm", "rho", "absrho"),
w = NULL, ...)
## S3 method for class 'formula':
pcdtest(x, data, index = NULL, model = NULL,
test = c("cd", "sclm", "lm", "rho", "absrho"),
w = NULL, ...)
formula
or panelmodel
, describing the model to be testeddata.frame
data
has to be formatted by plm.data
NULL
, the original heterogeneous specification of Pesaran is usedn x n
matrix
describing proximity between observations, 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
plm
, such as e.g. effect
or random.method
"htest"
.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 dataframe
; 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
. 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 supplying a proximity matrix (coercible to logical
) providing information on whether any pair of observations 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 nb2mat
before using.data(Grunfeld, package = "plm")
## test on heterogeneous model (separate time series regressions)
pcdtest(inv ~ value + capital, data=Grunfeld,
index = c("firm","year"))
## test on two-way fixed effects homogeneous model
pcdtest(inv ~ value + capital, data=Grunfeld, model="within",
effect="twoways", , index = c("firm","year"))
## test on model object
g <- plm(inv ~ value + capital, data=Grunfeld, index = c("firm","year"))
pcdtest(g)
## scaled LM test
pcdtest(g,test="sclm")
Run the code above in your browser using DataLab