s-news
[Top] [All Lists]

Re: Specialized trellis plot

To: David Parkhurst <parkhurs@imap.iu.edu>, s-news@lists.biostat.wustl.edu
Subject: Re: Specialized trellis plot
From: "Richard M. Heiberger" <rmh@temple.edu>
Date: Thu, 6 Apr 2006 22:53:04 -0400
I believe this does exactly what you requested.  I use the xysplom
function from my recent book for control of the rows and columns of the
trellis.  The panel function uses two calls to the standard trellis
function panel.densityplot, one for each level of the y variables.


## xysplom is a function in the HH online files
## 
##                 Statistical Analysis and Data Display
##                 Richard M. Heiberger and Burt Holland
## 
##    http://springeronline.com/0-387-40270-5


tmp <- data.frame(matrix(rnorm(125),25,5),
                  matrix(rbinom(100,1,.5),25,4))
names(tmp) <- c("x1","x2","x3","x4","x5","y1","y2","y3","y4")
round(tmp,2)

xysplom(y1+y2+y3+y4 ~ x1+x2+x3+x4+x5, data=tmp,
        scales=list(relation="same"),
        ylim=c(0, 3.5), between=list(x=1,y=1),
        par.strip.text=list(cex=1),
        panel=function(x,y,...) {
          panel.densityplot(x[y==1], width=.1, from=0, to=3, col=2)
          panel.densityplot(x[y==0], width=.1, from=0, to=3, col=3)
        })

<Prev in Thread] Current Thread [Next in Thread>