Get marginal effects at a set of levels for the covariates

me_by_variable(fit, variable, data = NA, size = NA, trim = 0.05)

Arguments

fit

A fitted model from the qs function

variable

variable to calculate marginal effects over

data

optional data.frame that specifies level of data to calculate marginal effects

size

What bin size to use when varying the variable of interest

trim

What to trim the variable of interest at, 0 < trim < 0.5

Details

This function defaults to using the average defaults to average for all coefficients except variable chosen. If you want to vary a covariate but keep everything else fixed at a certain level, you can specify the data argument. The size argument defaults to a bin size of 1/3 of the standard deviation of the variable, and the trim defaults to using the 95th percentile instead of the max because there may be large outliers. You can over-ride by setting trim to 0, which will use the min and max.