New Tips from the RCS Stats Team

December 7, 2018

We are often asked about how to calculate marginal effects in R, especially from Stata users who use Stata's margins and marginsplot commands after regression models. These two packages in R have similar functions to Stata's margins and marginsplot commands, which are used to calculate marginal effects after a regression model and graph them:

ggeffects

and

margins

These packages are easy to use and have most of the functionalities we are looking for.  However, they are not as powerful as Stata's margins and marginsplot commands, in the sense R's commands are mostly for linear models, while Stata has implemented it for almost all regression commands.