Hi Everyone.
I am running a panel regression and keep getting the following error whenever I try to run a fixed effects estimator:
Error in class(x) <- setdiff(class(x), "pseries") : invalid to set the class to matrix unless the dimension attribute is of length 2 (was 0).
The pooling, firstdiff and between works fine. Just wondering what I could do to correct this one.
this is the script:
getwd()
mydata <- read.csv("paneldata.csv",TRUE,";")
class(mydata)
install.packages(plm)
library(plm)
attach(mydata)
Y <- cbind(fertility)
X <- cbind(GDP,educ,health,wgap,chrst,jud,islm,nonrelig,west,east,south,north,mid)
#udelat z dat panel
pdata <- pdata.frame(mydata, index=c("ID","year"))
#statistika
summary(Y)
summary(X)
#pooled OLS
pooling <- plm(Y~X,data=pdata,model="pooling")
summary(pooling)
#between
between <- plm(Y~X,data=pdata,model="between")
summary(between)
#firstdiff
firstdiff <- plm(Y~X,data=pdata,model="fd")
summary(firstdiff)
#fixed
fixed <- plm(Y~X,data=pdata,model="within",index=c("ID","year"))