Monday, March 02, 2015

Panel cross section dependence tests in STATA and R

STATA example 

Using the Grunfeld investment data:

        use ""
        xtset firm year
        xtreg i f c,fe
        xtcsd, pesaran

Output of the xtcsd command only:
Pesaran's test of cross sectional independence =     1.098, Pr = 0.2722

R example

Using the same data: 
library(foreign) # To import STATA .dta files
grunfeld <- font="""">"")

pcdtest(i ~ f + c, data=grunfeld, model = "within", effect = "individual", index = c("firm","year"))
Ouput of the pcdtest command:
    Pesaran CD test for cross-sectional dependence in panels

data:  formula
z = 1.0979, p-value = 0.2722
alternative hypothesis: cross-sectional dependence

No comments: