# Blog post explaining marginal effects/means

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!

3 Likes

That is a completely different approach to what is most of the discussions on this site. The first derivative meaning of marginal effects is from econometrics and to my knowledge is used only there.

1 Like

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).

I am big fan of this post and specially of the R package marginaleffects due to its clarity when defining concepts.

Their marginal effects definition matches the one used in this JAMA Guide to Statistics and Methods paper, “Marginal Effects—Quantifying the Effect of Changes in Risk Factors in Logistic Regression Models” for continuous covariates:

…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.

1 Like

I think in biostat/epi we call the marginal effect procedure as G-computation or standardization. He has a vignette on this though as well showing the connection.

Marginal effect is an average treatment effect if the causal assumptions are satisfied.

I believe that would be the marginal (population-averaged) estimand.

The R package marginaleffects acknowledges this confusion:

1 Like

@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.

They nicely mentioned this property in the paper:

1 Like