margins
margins copied to clipboard
Contrasts
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).