margins icon indicating copy to clipboard operation
margins copied to clipboard

Contrasts

Open lang-benjamin opened this issue 4 years ago • 0 comments

Please specify whether your issue is about:

  • [ ] a possible bug
  • [ ] a question about package functionality
  • [X] a suggested code or documentation change, improvement to the code, or feature request

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

lang-benjamin avatar Jan 05 '22 13:01 lang-benjamin