When estimating the pooled model using the plm package using this syntax I get an R2 that is nearly 0.8.
library(plm)
data <- employmentsez
data$lfirms2 <- data$lfirms*data$lfirms
data$sezname <- as.factor(data$sezname)
data <- plm.data(data, index=c("code", "year"))
fit1 <- plm(lemployment ~ lfirms + lfirms2 + lfirmsfor + lwages + nuts51 + lgovgrants + leusubs + agrishare, data=data, model="pooling")
R-Squared: 0.7972
Adj. R-Squared: 0.79679
With the exact same specification and again with plm but now this syntax I get an R2 that is less than 0.1 and R2 adjusted is negative.
library(plm)
data <- employmentsez
data$lfirms2 <- data$lfirms*data$lfirms
data$sezname <- as.factor(data$sezname)
data <- plm.data(data, index=c("code", "year"))
fit1 <- plm(lemployment ~ lfirms + lfirms2 + lfirmsfor + lwages + nuts51 + lgovgrants + leusubs + agrishare, data=data, model="within", effect="individual")
summary(fit1)
R-Squared: 0.085873
Adj. R-Squared: -0.039652
I think the difference is too big and in Stata you get a higher R2 for the within model using the exact same specifications. Also ought the within model not give a higher R2 when using the exact same specification and adding the fixed effects?
Does anyone know how to fix this problem, is there an alternative way to get the correct R2 with the plm package?