How to plot marginal effects of mfx package?

I'm using the logitmfx function to find marginal effects of a logistic regression, where gives the regression summary with dF/dx instead of the co-efficients.

I want to plot these marginal effects, so it would look like the plot of the margins function (for example) . How would I go about this?

library(margins)
# from help(cplot)
m <- glm(am ~ wt*drat, data = mtcars, family = binomial)
cplot(m, x = "wt") # prediction
#>       xvals       yvals      upper       lower
#> 1  1.513000 0.927274748 1.25767803  0.59687146
#> 2  1.675958 0.896156250 1.31282164  0.47949086
#> 3  1.838917 0.853821492 1.36083558  0.34680740
#> 4  2.001875 0.798115859 1.38729030  0.20894142
#> 5  2.164833 0.727945940 1.37431347  0.08157841
#> 6  2.327792 0.644257693 1.30643930 -0.01792391
#> 7  2.490750 0.550714595 1.17940279 -0.07797360
#> 8  2.653708 0.453441410 1.00638808 -0.09950526
#> 9  2.816667 0.359598025 0.81514131 -0.09594526
#> 10 2.979625 0.275390447 0.63577343 -0.08499254
#> 11 3.142583 0.204601856 0.48756886 -0.07836515
#> 12 3.305542 0.148285654 0.37415646 -0.07758515
#> 13 3.468500 0.105415989 0.28892829 -0.07809631
#> 14 3.631458 0.073865178 0.22356331 -0.07583296
#> 15 3.794417 0.051216829 0.17224934 -0.06981569
#> 16 3.957375 0.035248556 0.13162443 -0.06112732
#> 17 4.120333 0.024132208 0.09961556 -0.05135115
#> 18 4.283292 0.016461806 0.07467832 -0.04175471
#> 19 4.446250 0.011201450 0.05550126 -0.03309836
#> 20 4.609208 0.007609032 0.04093572 -0.02571766

Created on 2020-04-08 by the reprex package (v0.3.0)

Thanks. Not quite what I'm looking for though.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.