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:> 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??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:> 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ > >-- Ben Bolker bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker 318 Carr Hall/Box 118525 tel: (352) 392-5697 Gainesville, FL 32611-8525 fax: (352) 392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._