簡體   English   中英

如何找到多元回歸的斜率?

[英]How to find slopes of multiple regression?

我正在制作幾個線性回歸的 plot,我想找到每個線性回歸的斜率。 問題是在我的案例中我找不到如何去做。 就像您在我的 plot 上看到的那樣,我正在測試重量作為溫度、質量(我的兩種顏色)和數量(我的側面包裹)的 function。

在此處輸入圖像描述

我對這個 plot 的代碼是:

g = ggplot(donnees_tot, aes(x=temperature, y=weight, col = quality))+
     geom_point(aes(col=quality), size = 3)+
     geom_smooth(method="lm", span = 0.8,aes(col=quality, fill=quality))+
     scale_color_manual(values=c("S" = "aquamarine3",
                              "Y" = "darkgoldenrod3"))+
     scale_fill_manual(values=c("S" = "aquamarine3",
                             "Y" = "darkgoldenrod3"))+
     scale_x_continuous(breaks=c(20,25,28), limits=c(20,28))+
     annotate("text", x= Inf, y = - Inf, label =eqn, parse = T, hjust=1.1, vjust=-.5)+
     facet_wrap(~quantity)
   g

另外,如果您有提示可以寫在我的 plot 上,我將不勝感激! 謝謝

通過使用 ggpmisc package,我已經將這些行添加到我的代碼中並且可以正常工作!

stat_poly_line() +
  stat_poly_eq(aes(label = paste(after_stat(eq.label),
                                 after_stat(rr.label), sep = "*\", \"*"))) +
  

暫無
暫無

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

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