dat <- mtcars
dat$cyl <- as.factor(dat$cyl)
dat$am <- as.logical(dat$am)
dat$carb <- as.factor(dat$carb)
mod <- lm(mpg ~ hp + cyl + am+carb, data = dat)
mm_dat <- marginaleffects::comparisons(mod,variables = list(carb="pairwise"),
by="am",cross = T)
modelsummary(mm_dat,
title = "Estimated Marginal Means",
estimate = "{estimate} [{conf.low}, {conf.high}]",
statistic = NULL,
group = term ~ am)
Any idea how I can retrieve the results from marginaleffects into a summary with the estimates from mm_dat? I only get the length of the individual vectors
With version 1.2.0.9001 of
modelsummary
(only available from Github at the time of writing), you can do this: