0
$\begingroup$

I'm a Master student researching for his thesis.

In a panel data analysis, I have a sample of 141 observations related to airports. First lines are:

   Airport       Date Year PH.tot.seats Seat.year Seasonality
1      OLB 22/08/2014 2014         2534   2751080      2.6000
2      OLB 23/08/2015 2015         2449   2798846      2.5700
3      MAH 03/08/2014 2014         2460   2987482      2.5500
4      OLB 02/08/2013 2013         1740   2516710      2.5300
5      MAH 17/08/2015 2015         3686   3431666      2.5000
6      MAH 20/08/2012 2012         2681   2758799      2.4600
7      WMI 04/11/2012 2012         1863   1320165      2.4400
8      OLB 20/08/2012 2012         1932   2326278      2.4200
9      MAH 01/08/2011 2011         2344   2860084      2.3800
10     IBZ 03/08/2014 2014         3801   7170858      2.3700 
11     IBZ 06/08/2015 2015         3956   7465915      2.3500 
12     IBZ 13/08/2012 2012         3561   6345849      2.3400 
13     IBZ 03/08/2011 2011         3297   6616744      2.3100 
14     RHO 25/08/2015 2015         2703   3850181      2.3000 
15     IBZ 02/08/2013 2013         3438   6711774      2.2800 

The panel is unbalanced, with every unit between 1 and 7 times in the panel. After I find out that the fixed effect model is the most suitable and I run it, I test the usual assumptions. I followed this document as a guideline: http://www.princeton.edu/~otorres/Panel101R.pdf This is the code of the bit that does not work as I expected:

#panel regression-fixed effects n entity specific intercepts
fixed = plm(log(PH.tot.seats)~log(Seat.year)+log(Seasonality),data=db, 
index=c("Airport", "Year"),model="within")
summary(fixed)
fixef(fixed)
#tests for cross sectional dependence in panels
pcdtest(fixed,test=c("lm"))
pcdtest(fixed,test=c("cd"))

And this is the output for both the Pesaran and the BP test.

X-sectional tests output

Is there any problems with the dataset or the code? Any suggestion would be highly appreciated.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

It seems that pcdtest is no implemented for unbalanced panels. Weird enough it works with tiny unbalancedness but not with larger ones...

Here a reproducible example:

library(plm)

#in a data.frame like this:
testData <- data.frame(id=c(rep(1:200,each=20)),time=rep(1991:2010,200),
                   var1=rnorm(4000,10)/1000,var2=rnorm(4000,123))
#pcdtest will work:
pcdtest(var1 ~ var2, data=testData,
    model="within")

#even with slight unbalancedness:
testData1 <- testData[-(3:4),] 
pcdtest(var1 ~ var2, data=testData1,
    model="within")

#but not with slightly larger ones:
testData2 <- testData[-(3:30),] 
pcdtest(var1 ~ var2, data=testData2,
    model="within")

I do not know where the treshold is exactly or why it does not work.

To be honest, I'm starting to loose my faith in real world applications of plm which is a pity because it implements exactly what is usually needed. However, it performs quite badly with many fixed effects and often times even breaks down (just compare a large panel dataset where you do the within transformations yourself followed by lm() with an model=within,effects=twoways plm attempt). It also has troubles with unbalanced panels many times from my experience... Maybe pglm is better?

$\endgroup$
1
  • 1
    $\begingroup$ This has been correct in newer version of plm. $\endgroup$
    – Helix123
    Commented Aug 26, 2018 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.