[R] Putting regression lines on SPLOM

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Fri Sep 5 11:06:39 CEST 2003


Thanks, Deepayan and Andy, for suggesting solutions.

Deepayan's solution seems to work beautifully, producing exactly
what is wanted, as it stands:

On 05-Sep-03 Deepayan Sarkar wrote:
> 
  splom(log(1 + DF),
        panel = function(x, y, ...) {
            panel.xyplot(x, y, ...)
            ok <- (x > 0) & (y > 0)
            fm <- lm(  log(exp(y[ok]) - 1) ~  log(exp(x[ok]) - 1) )
            panel.abline(fm, ...)
        }) 

However, there seems to be a problem with Andy Liaw's, applied to the
same data:

  df.trans <- lapply(DF, function(x) log(1+x))  ## Do the transformation.
  splom(df.trans, panel = function(x, y, ..) {
        panel.xyplot(x, y, ...)
        fit <- lm(log(exp(y)-1) ~ log(exp(x)-1), subset = x>0 & y>0)
                panel.abline(fit)
        })

  Error in panel(x = as.numeric(z[subscripts, j]),
                 y = as.numeric(z[subscripts,  : 
                     ... used in an incorrect context

(which is the same error as I got trying an earlier suggestion of
Deepayan's).

Anyway, much obliged for all the help!

Best wishes,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 05-Sep-03                                       Time: 10:06:39
------------------------------ XFMail ------------------------------




More information about the R-help mailing list