简体   繁体   English

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

[英]How to find slopes of multiple regression?

I'm making a plot of several linear regressions and I would like to find the slope of each of them.我正在制作几个线性回归的 plot,我想找到每个线性回归的斜率。 The problem is that I don't find how to do it in my case.问题是在我的案例中我找不到如何去做。 Like you can see on my plot, I'm testing the weight as a function of the temperature, a quality (my two colors) and quantity (my facet wrap).就像您在我的 plot 上看到的那样,我正在测试重量作为温度、质量(我的两种颜色)和数量(我的侧面包裹)的 function。

在此处输入图像描述

My code for this plot is that:我对这个 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

Also, if you have a tips to write them on my plot, I would be really grateful !另外,如果您有提示可以写在我的 plot 上,我将不胜感激! Thank you谢谢

By using the ggpmisc package, I've had these lines to my code and it works !通过使用 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