Re: [R] adding linear regression data to plot

From: Peter Ehlers <ehlers_at_ucalgary.ca>
Date: Wed, 16 Mar 2011 11:01:49 -0700

On 2011-03-16 08:47, derek wrote:
> I know I can add line to graph with abline(), but I would like to print
> R-squared, F-test value, Residuals and other statistics from lm() to a
> graph. I don't know how to access the values from summary(), so that I can
> use them in a following code or print them in a graph.

It seems that you need to discover the ever-useful str() function. str(summary(your model)) will show you that you can get:

  summary(model)$r.squared

etc.
For the coefficients, I would use: coef(model).

Peter Ehlers

>
> --
> View this message in context: http://r.789695.n4.nabble.com/adding-linear-regression-data-to-plot-tp3357946p3382135.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Mar 2011 - 18:14:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Mar 2011 - 18:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive