I am trying to run very simple fixed effect model on a small data set. Sample data set is rather small. I loaded the data via a csv file and then ran plm command. But i am running into an error and i am not able to figure out reason. My csv file looks like this:
country,year,y,x1
A,2000,6.0,7.8
A,2001,4.6,0.6
A,2002,9.4,2.1
Following is the set of commands i ran on console:
>test<-read.table("test.csv",sep=",",header=TRUE)
head(test)
fixed <- plm(y ~ x1,data=test,index=c("country","year"),model="within")
series country is constant and has been removed
Error in pdata.frame(data, index) : variable country does not exist
I am using this as a reference to understand how to work with fixed and random effect model in R. When i followed the instruction mentioned in this ppt and ran plm()
using there data set, i was able to get correct results.
Thanks!
country year y x1
1 A 2000 6.0 7.8
2 A 2001 4.6 0.6
3 A 2002 9.4 2.1 – harshul gandhi Mar 25 '15 at 12:05