Closed ahnm2002 closed 3 years ago
No issue here. plm
and lmer
use different estimation techniques so one cannot expect identical results. You may read up on the methods used, e.g., in plm's Vignette as a starter https://cran.r-project.org/web/packages/plm/vignettes/A_plmPackage.html , section "plm versus nlme and lme4".
This has been asked before on SO (https://stackoverflow.com/questions/68801350/estimating-a-two-way-random-effect-model-in-r-using-lmer-and-plm), likely by the same poster; a comment there under the post already gave a similar response.
I am using lmer to estimate a two-way random effect model like this y ~ x1 + x2 + (1|country) + (1|year).
When I use plm(y ~ x1 + x2, index = c("country", "year"), model = "random", effect = "twoways") I get totally different estimates. Here is a reproducible example: