[R] plot.formula

About this list Date view Thread view Subject view Author view Attachment view

From: Adrian Baddeley (adrian@asteridia.maths.uwa.edu.au)
Date: Tue 17 Jun 2003 - 20:55:11 EST


Message-id: <16110.62351.704257.863527@asteridia.maths.uwa.edu.au>


Thanks to Andy Liaw and Baz
for alternatives to tinkering with plot.formula
to get
        plot(cbind(y1,y2) ~ x, ...)
to work.

However...

> From: "Liaw, Andy" <andy_liaw@merck.com>
    matplot(x, cbind(y1, y2), ...)

> From: Barry Rowlingson <B.Rowlingson@lancaster.ac.uk>
   xyplot(y1+y2~x,data=xyy,allow.multiple=T)

The former requires separate code for the case of multiple response variables.

The latter does provide a formula interface, but the interpretation
of the formulae is inconvenient.
For example

   - if y1 is an expression containing "+"
      then it would have to be protected by I() to prevent the
      summands in the expression being plotted separately.
      
   - you can't replace one of the response variables by a constant,
   as this will be evaluated as a vector of length 1.

It's a lot easier with cbind() , for example

     plot(cbind(z1 -zhat + bias, 0) ~ x)

gets you a plot of (z1-zhat+bias) versus x
together with a horizontal line at y=0.

The idea of using cbind() was indeed modelled on the glm() usage.

----
Adrian Baddeley, Mathematics & Statistics, University of Western Australia
		<http://maths.uwa.edu.au/~adrian/>

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:54 EST