1

I came across 2 packages to calculate marginal effect for a logistic regression model in R with some interaction terms.

margins package https://cran.r-project.org/web/packages/margins/vignettes/Introduction.html and mfx pacakge https://cran.r-project.org/web/packages/mfx/mfx.pdf

I want to calculate the average marginal effect and don't know which package is appropriate. For some reason, I cannot use the first one. So I have tried

install.packages("margins-package")
library(margins) ## Library not found
margins(logit)    ## Logit is my glm model but that function is not found

The author of the margins package criticised mfx package and other packages used to calculate marginal effect as they do not account for interaction term properly. Does anyone have experience with one of the packages or both? I'd like to hear your feedback.

Thank you!

NAN
  • 11
  • 3
  • I think this might be better suited to https://stats.stackexchange.com/ as this is more of a statistics question than it is a problem with programming. I've voted for this question to be moved across on that basis. You're probably having problems installing margins as your first command is wrong. It should be `install.packages("margins")` – r.bot Apr 24 '18 at 08:08
  • Thank you for the suggestion. I'll post my question on stackexchange then. – NAN Apr 24 '18 at 08:15
  • This question is probably to broad as written, but the main issue is you have a typo in your first code line: `install.packages("margins")` is what you need. Then do `library("margins")` and try looking at the help in `? margins` to figure out how to use the package. It definitely works for logistic regression models. – Thomas Aug 03 '18 at 10:31

0 Answers0