I’d really appreciate it if somebody can help me figure this out. I have a model with random intercepts and slopes, and I’d like to plot the marginal effect of x on y conditional on the level of z, with which x is interacted. Previously I’ve always understood marginal effect to mean exactly this: the instantaneous rate of change (coefficient) of x on y, for different levels of the interactor.

More specifically, my model looks like this: vote ~ imports*concentration + (1 + imports | county)

+ (1 | year) + (1 | state-year), where imports is a continuous predictor and my IV of interest, and concentration is a continuous mediator.

Is there a way to use marginal_effects() to plot the actual marginal effect of imports on vote on the y-axis, and not predicted values of y? If this isn’t possible with marginal_effects, is there a different package that might include this function, or am I left to compute this manually?