[R] add a linear regression line to the plot

ep ekkehardt.peters at lugv.brandenburg.de
Thu Jan 13 17:09:48 CET 2011


Hi, 

if it should be "lines" so you can do that

xy.lm <- lm(y~x)
lines(x, xy.lm$coeff[1] + x*xy.lm$coeff[2], col="blue", lwd=3)

Regards

ep

-- 
View this message in context: http://r.789695.n4.nabble.com/add-a-linear-regression-line-to-the-plot-tp3215455p3216099.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list