Hi I would like to display the trendline and the R-square value in a xy scatter in R. For example if I want to plot f vs g I add the trendline using the commands below>library(quantreg) >plot(f,g) >abline(rq(g~f))however I don't know how to display the R2 in the graph. Thank you in advance. Kind regards Maria [[alternative HTML version deleted]]
Maria, Does rq() provide an R2? Anyway, have a look at ?text. -Peter Ehlers Lathouri, Maria wrote:> Hi > > I would like to display the trendline and the R-square value in a xy scatter in R. For example if I want to plot f vs g I add the trendline using the commands below > >> library(quantreg) >> plot(f,g) >> abline(rq(g~f)) > > however I don't know how to display the R2 in the graph. > > Thank you in advance. > > Kind regards > Maria > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > >
On Sep 28, 2009, at 6:36 AM, Lathouri, Maria wrote:> Hi > > I would like to display the trendline and the R-square value in a xy > scatter in R. For example if I want to plot f vs g I add the > trendline using the commands below > >> library(quantreg) >> plot(f,g) >> abline(rq(g~f)) >> plot(f,g) Error in plot(f, g) : object 'f' not found > abline(rq(g~f)) Error in eval(expr, envir, enclos) : object 'g' not found Anyway, there is a worked example in the help page for rq.> however I don't know how to display the R2 in the graph. > > Thank you in advance. > > Kind regards > MariaDavid Winsemius, MD Heritage Laboratories West Hartford, CT