# NOT RUN {
mod <- glm(am ~ hp * wt, data = mtcars, family = binomial)
mfx <- marginaleffects(mod)
summary(mfx)
tidy(mfx)
head(mfx)
plot(mfx)
# typical marginal effects
marginaleffects(mod,
newdata = typical(hp = c(100, 110)))
# counterfactual average marginal effects
marginaleffects(mod,
newdata = counterfactual(hp = c(100, 110)))
# heteroskedasticity robust standard errors
marginaleffects(mod, vcov = sandwich::vcovHC(mod))
# }
Run the code above in your browser using DataLab