leeper / margins

An R Port of Stata's 'margins' Command
https://cloud.r-project.org/package=margins
Other
260 stars 39 forks source link

Contrasts #180

Open lang-benjamin opened 2 years ago

lang-benjamin commented 2 years ago

Please specify whether your issue is about:

It would be nice to have the ability to calculate contrasts. For example, the following calculates average marginal effects of wt at am = 0 and am = 1.

library("margins")
fm <- lm(vs ~ wt * factor(am), data = mtcars)
margins(fm, variables = "wt", at = list(am = c(0, 1)))

It would be nice to have the possibility to compare the marginal effect of wt between the levels of am by calculating a contrast (including SE).