I am using PLM Package to run 6 mixed models (random effects). If you would compare, I am using the xtreg command from STATA.
Besides getting two way different R2 (STATA I get ~.28 and R I am getting ~.57), in Stata I can run the margins command and plot the results, which is very handy. I have installed the package "Margins" in R and I could not proceed with the analysis. Could I get any help please? Thank you!
Hi jasonford,
The simple answer is that the plm model output object is not supported by the margins::cplot() function. Check out the examples for both packages.
Also note that R is case-sensitive: PLM != plm, and Margins != margins.
HTH
Hi Jason,
I'm afraid I dont have any STATA background, so it may be that things that seem obvious I just wont get. I'm just thinking that the xtreg command seems to support 6 different model types, and the PLM also supports many. Can we be specific about the models you need ? I just glanced at the margins package demo page, and they show examples of fitting all kinds of models (without PLM) and plotting the marginal info you seem to need, maybe there is a better analog the PLM something that is closer to one of their examples ?
Let me share my code from Stata and from R. The code that I am running on STATA, after running the mixed models random effect, I can get the margins and plot it. It is perfect. In R, the model runs but I cant get the margins.