如何更改Interact_plot()中的MOD2标签?

发布于 2025-02-08 23:26:47 字数 500 浏览 4 评论 0原文

我有以下互动:

data(iris)
View(iris)

reg <- lm(Sepal.Length ~ Sepal.Width*Petal.Width*Petal.Length, data = iris)

我想创建一个图:

library(interactions)

interact_plot(reg, pred = Sepal.Width, modx = Petal.Width, mod2 = Petal.Length, data = iris, x.label = "Sepal Width", y.label = "Sepal Length", legend.main = c("Petal Width"), mod2.labels = c("Petal Length"))

问题是我似乎无法将图中的petal.length变量更改为使用mod2.labels函数“花瓣长度”。 。任何指导将不胜感激。

I have the following interaction:

data(iris)
View(iris)

reg <- lm(Sepal.Length ~ Sepal.Width*Petal.Width*Petal.Length, data = iris)

I want to create a plot:

library(interactions)

interact_plot(reg, pred = Sepal.Width, modx = Petal.Width, mod2 = Petal.Length, data = iris, x.label = "Sepal Width", y.label = "Sepal Length", legend.main = c("Petal Width"), mod2.labels = c("Petal Length"))

The problem is that I can't seem to change the Petal.Length variable in my plot to "Petal Length" with the mod2.labels function. Any guidance would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万水千山粽是情ミ 2025-02-15 23:26:47

您需要通过一个完整标签的向量 - 每个方面一个:

interact_plot(reg, pred = Sepal.Width, modx = Petal.Width, 
              mod2 = Petal.Length, data = iris, x.label = "Sepal Width", 
              y.label = "Sepal Length", 
              legend.main = c("Petal Width"),
              mod2.labels = c("Mean of Petal Length - 1 SD",
                              "Mean of Petal Length",
                              "Mean of Petal Length + 1 SD"))

You need to pass a vector of complete labels - one per facet:

interact_plot(reg, pred = Sepal.Width, modx = Petal.Width, 
              mod2 = Petal.Length, data = iris, x.label = "Sepal Width", 
              y.label = "Sepal Length", 
              legend.main = c("Petal Width"),
              mod2.labels = c("Mean of Petal Length - 1 SD",
                              "Mean of Petal Length",
                              "Mean of Petal Length + 1 SD"))

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文