Skip to content
Prev 4848 / 398506 Next

fittin a regression line

sht103 <sht103 at york.ac.uk> writes:
A simple linear regression line can be added to a plot with abline.
For more complicated models, you should generate a sequence of x
values at which you wish to evaluate the model and use the predict
method to get the y values.

The simple case looks like

 plot( y ~ x )
 fm <- lm( y ~ x)
 abline( fm )
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._