I'd like to know the appropriate command to run a random-effect model under the software R.
I tried :
library(plm)
Model=plm(df$IndVar ~ df$densite + df$sexe + df$age_cat + df$production, data=df, index=c("village"), model="random")
But I got this answer :
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases
In addition: Warning message:
In Ops.factor(e1, e2) : ‘-’ not meaningful for factors
I also tried :
library(nlme)
Model=lme(df$IndVar ~ df$densite + df$sexe + df$age_cat + df$production, random=~1|village)
And I got :
Error in eval(predvars, data, env) : object 'IndVar' not found
What to do ? Need your help.