簡體   English   中英

如何更改 interact_plot() 中的 mod2 標簽?

[英]How do I change the mod2 labels in interact_plot()?

我有以下交互:

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"))

問題是我似乎無法使用mod2.labels函數將繪圖中的 Petal.Length 變量更改為“Petal Length”。 任何指導將不勝感激。

您需要傳遞一個完整標簽的向量 - 每個方面一個:

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"))

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM