Calculate average marginal effects from a fitted model object.
smargins(model, ..., n = 1000)
model | A fitted model object. |
---|---|
... | Further arguments passed to or from other methods. |
n | Number of simulations to run. |
at | A named list of values to set predictor variables to. |
A data.frame containing predictor variables values and expected values of the dependant variable.
library(smargins) lm.out <- lm(Fertility ~ Education, data = swiss) smargins(lm.out, at = list(Education = quantile(swiss$Education, c(.25, .50, .75))))#> Error in sort.list(y): 'x' must be atomic for 'sort.list' #> Have you called 'sort' on a list?