First of all I build the following dataframe (country_Id as factor variable and year as numeric):
mydata = pdata.frame(mydata, index = c("country_Id","year"),row.names = TRUE)
Then I check it with:
index(mydata)
pdim(mydata)
is.pconsecutive(mydata)
class(mydata)
Everything seems to be fine but I want to include country-dummies in the fixed-effects model it does not work
femodel_1 <- plm(y~x + ldvx + factor(country_Id) , data= mydata, model = "within")
And another problem is that my random model shows that the individual variance is 0
remodel_1 <- plm(y~x + ldvx , data= mydata, model = "random")
Unfortunately I can not find the problem.