[R] Putting regression lines on SPLOM

Deepayan Sarkar deepayan at stat.wisc.edu
Thu Sep 4 20:14:31 CEST 2003


You can't do it in that sequence, and whether you can do it at all depends on 
exactly what you mean when you say that the data used for the regressions are 
not the same as those used for the plots. The typical way would be to do 

splom(DF, 
      panel = function(x, y, ...) {
          panel.xyplot(x, y, ...)

          # modify x and y as appropriate (?)
          # whether that can be done depends on whether
          # you have all the information you need 
          # available inside the panel function

          fm <- lm(y ~ x) 
          panel.abline(fm)
      })

Can't think of anything else (other than using a custom superpanel function).

Deepayan

On Thursday 04 September 2003 11:47 am, Ted Harding wrote:
> Sorry Folks,
> I'm sure I could suss out the answer myself but I need it
> soon ... !
>
> 1. Given a set of 4 variables X,Y,Z,W in a dataframe DF, I make
>    a scatter-plot matrix using splom(DF).
>
> 2. I do all regressions of U on V using lm(U~V), where U and V
>    are all 12 different ordered pairs from X,Y,Z,W.
>
> 3. Now I would like to superpose the regression lines from (2)
>    onto the corresponding panels from (1).
>
> (By the way, the data used for the regressions are not quite
>  the same as those used for the plots, since a few observations
>  are omitted from the regressions but appear on  the plots,
>  so (1) and (2) really are separate operations).
>
> With thanks,
> Ted.
>
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
> Fax-to-email: +44 (0)870 167 1972
> Date: 04-Sep-03                                       Time: 17:47:39
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list