简体   繁体   中英

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

在此处输入图像描述

My code for this plot is that:

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 ! Thank you

By using the ggpmisc package, I've had these lines to my code and it works !

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM