79423895

Date: 2025-02-08 20:54:54
Score: 2
Natty:
Report link

There are lots of ways to do this but one of the easiest is with the effects package.

m1 <- lm(mpg ~ hp + disp, data = mtcars)
library(effects)
plot(allEffects(m1))

an effects plot for the model above, showing decreasing mpg with both hp and disp

You can also do this with the sjPlot package, the ggeffects package, the marginaleffects package, or the emmeans package: see also How do I plot a single numerical covariate using emmeans (or other package) from a model? ...

Reasons:
  • Blacklisted phrase (1): How do I
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-2):
Posted by: Ben Bolker