Get all marginal effects of variables in the fit

marginal_effects(fit, variable = "all", data = NA, size = NA, trim = 0.05)

Arguments

fit

model fitted by qs()

variable

which variable to calculate marginal effects on

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. By default, marginal effects will calculate marginal effects for all variables.