Skip to content

fittin a regression line

3 messages · sht103, Douglas Bates, Ben Bolker

#
Dear sirs,

I have tried to find a command to fit(plot) a regression line but I
haven't found any command on the html.help. 
My question is if I am using a regression for instance reg<-lm(y~x) and
I would like to make a regression line, to see how well my data is fit.
Can you please help me with this??
Yours Sincerely
Soheila Zad
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
If you already have your data plotted, abline(reg) will add the
regression line to the plot.
On Tue, 14 Mar 2000, sht103 wrote: