绘制一个变量变化而其他变量不变的模型的函数

Function to plot model with one variable varying and others constant

很简单,但我不记得这个过程是如何调用的,因此我找不到调用它的函数。我想通过一次绘制一个变量的响应来探索简单 lm() 模型的效果和梯度,其他变量保持不变。

谁能告诉我使用哪个函数来做到这一点?我似乎记得它是一个生成多个图的函数,或者类似的东西。这可能类似于敏感性分析...抱歉初学者问题。

提前致谢!

car package has a lot of utilities for analyzing regression models. This sounds like a component+residual plot (or partial residuals plot).

library(car)   # for avPlots(...)
fit <- lm(mpg~wt+hp+disp, mtcars)
crPlots(fit)

如评论中所述,termplot(...) 做的事情基本相同。