[S] xyplot and error bars and tricking trellis into using a multivariate response variable

Frank E Harrell Jr (fharrell@virginia.edu)
Thu, 19 Mar 1998 07:40:57 -0500


Thanks to all who have given me excellent ideas for putting together a
somewhat general function. I'll try to finish putting it all together
tomorrow.

I had one idea to trick trellis into allow a formula such as
low,middle,high ~ x. I wrote a packaging function LmH that places low
and high as attributes to x, and a subscripting function that
subscripts low and high along with x.

Here they are:

LmH <- function(low,mid,high,delta) {
if(!missing(delta)) {low <- mid-delta; high <- mid+delta}
structure(mid, class='LmH', low=low, high=high)
}
'[.LmH' <- function(x, ...)
structure(unclass(x)[...], class='LmH',
low=attr(x,'low')[...], high=attr(x,'high')[...])

By tomorrow I plan to have all the ideas put togetter into a function
LmHplot that looks like xyplot in most ways. It can be called by e.g.

LmHplot(LmH(low,middle,high) ~ x | condvar, groups=g, ...)

I plan to encorporate the following features:

1. Respect trellis line and symbol types (except for error bars themselves?)
2. Automatically sense the presence of groups= so that one panel function
handles 'superpose' as well as one curve/panel
3. Have an option to invoke the labcurve function in the Hmisc library to
automatically label the curves where they are most separated
4. Make it easy for the user to add a key to the plot when groups= is present

More to come - thanks again for all the ideas. Any
comments/suggestions on the above design would be very appreciated.
-Frank

---------------------------------------------------------------------------
Frank E Harrell Jr
Professor of Biostatistics and Statistics
Director, Division of Biostatistics and Epidemiology
Dept of Health Evaluation Sciences
University of Virginia School of Medicine
http://www.med.virginia.edu/medicine/clinical/hes/biostat.htm

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news