Thin extender over marginaleffects::predictions() for unit-
level or grid-level adjusted predictions.
Arguments
- model
A fitted model object supported by insight / marginaleffects.
- newdata
Optional data frame for which to predict. Defaults to the model frame when
NULL(the marginaleffects default).- ...
Further arguments forwarded to
marginaleffects::predictions().
Examples
if (requireNamespace("marginaleffects", quietly = TRUE)) {
set.seed(1)
df <- data.frame(y = rnorm(60), x = rnorm(60), g = factor(rep(c("a", "b"), 30)))
fit <- stats::lm(y ~ x + g, data = df)
head(morie_effects_predictions(fit))
}
#>
#> Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 %
#> 0.1604 0.325 0.493 0.622 0.7 -0.4770 0.798
#> -0.0206 0.158 -0.130 0.897 0.2 -0.3311 0.290
#> 0.2208 0.174 1.269 0.204 2.3 -0.1202 0.562
#> -0.0230 0.157 -0.146 0.884 0.2 -0.3315 0.286
#> 0.2713 0.186 1.460 0.144 2.8 -0.0928 0.635
#> -0.0286 0.157 -0.183 0.855 0.2 -0.3359 0.279
#>
#> Type: response
#>
