I recently stumbled on this blog post describing and explaining what (average/conditional) marginal effects and marginal effects at the mean actually calculate. The author uses the R packages marginaleffects and emmeans which by default calculate the average marginal effect (AME) and the marginal effect at the mean (MEM), respectively.
I haven’t read it in its entirety yet, nor can I speak to whether it is completely correct, but I think many users will find it very helpful for their understanding. The author gives a definition of marginal effect:
Formally defined, a marginal effect is a partial derivative from a regression equation. It’s the instantaneous slope of one of the explanatory variables in a model, with all the other variables held constant.
The author ends the post with a table summarizing different effects and their representative R code. I hope others find this enlightening!
Thanks for the clarification. Would you say that the author’s definition/interpretation/approach is different enough from the approach in biostatistics (or medical statistics in general) that it could be detrimental to the “average reader” of the forum? I can certainly edit my post to include a note mentioning that the author is viewing things differently (or I could add a biostats-focused link if appropriate/helpful).
…the marginal effect, which is the change in the probability that the outcome occurs as the risk factor changes by 1 unit while holding all the other explanatory variables constant. When the risk factor is continuous (eg, age), the change in the probability that the outcome occurs that is associated with a 1-unit change in the risk factor has been called a marginal effect.
Of note, while the paper uses the term “marginal effect” for both continuous and discrete covariates, the R package marginaleffects used the term “contrast” for the latter.
@cwatson I didn’t want to imply that it’s detrimental. It’s just estimating a different thing. The good thing about the first derivative is that it must involves settings of other covariates if the model is nonlinear, something that proponents of the epi definition of marginal effects forget to do. An effect of changing a covariate by one unit is not the same as a first derivative, but it also is other-covariate-dependent.