I'm using pairs() to generate a scatterplot matrix;
pairs(~ Fuzzy.gray.white.ratio+Fuzzy.gw.t.score+AgeWhenTested+signal_mean.noise,
data=datam,subset=status=="control",main="Controls",
labels=c("G/W","Peak
Separation","Age","S/N"))
How can I add regression lines to the plots?
Hi Alan, There is a good, ready made, way of doing this, with additional options, in Professor Fox's car package. See:--- require(car) ?scatterplot.matrix Cheers, Mark. Alan S Barnett-2 wrote:> > I'm using pairs() to generate a scatterplot matrix; > > pairs(~ > Fuzzy.gray.white.ratio+Fuzzy.gw.t.score+AgeWhenTested+signal_mean.noise, > data=datam,subset=status=="control",main="Controls", > labels=c("G/W","Peak Separation","Age","S/N")) > > > How can I add regression lines to the plots? > > ______________________________________________ > R-help at stat.math.ethz.ch 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. > >-- View this message in context: http://www.nabble.com/Trend-lines-on-a-scatterplot-matrix-tf4113952.html#a11704499 Sent from the R help mailing list archive at Nabble.com.
Start with something like this:
pairs(iris, panel= function(x,y,...){
points(x,y);
abline(lm(y~x))})
Then substitute in your data and extra args and any other enhancements
you want.
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Alan S Barnett
> Sent: Thursday, July 19, 2007 3:51 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Trend lines on a scatterplot matrix
>
> I'm using pairs() to generate a scatterplot matrix;
>
> pairs(~
> Fuzzy.gray.white.ratio+Fuzzy.gw.t.score+AgeWhenTested+signal_m
> ean.noise,
> data=datam,subset=status=="control",main="Controls",
> labels=c("G/W","Peak
Separation","Age","S/N"))
>
>
> How can I add regression lines to the plots?
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>