[R] Lattice, skip= and layout= problem, plotting object from nlme output

Michael Dewey m.dewey at iop.kcl.ac.uk
Mon Mar 22 14:15:11 CET 2004


I generate a groupedData object

library(nlme)
obj <- groupedData(mg10 ~ time | gp, data = common, outer = ~pct)

gp has 101 levels, and pct has 3. There are 38, 25, 38 gps in each of the 
levels of pct respectively.

I fit my model

fit.rtg <- lme(mg10 ~ time * group,
    data = obj,
    random = ~time * group | gp)

Now I try to plot the results. I would like to print 40 panels on each page 
and have a new level of pct start a new page. The effect of using outer in 
the call of groupedData is that the values of gp are presented by pct.

plot.rtg <- plot(augPred(fit.rtg),
    skip = c(rep(FALSE, 38), TRUE, TRUE,
             rep(FALSE, 25), rep(TRUE, 15),
             rep(FALSE, 38), TRUE, TRUE),
    layout = c(5, 8, 3),
    strip = FALSE
)

What I get is 38 panels on page 1 with 2 blank panels top right. I had 
hoped to get 25 on the next page with 15 blanks but I get 38 again with 2 
blanks.

If I alter layout to (say) layout = c(12, 10) I get blanks as expected on 
the single page produced so I surmise that skip is forcing the same format 
on each page. There is an example in \cite{pinheiro00} which suggests that 
what I wanted can be done (p113,  p445-447) so I suspect I am doing 
something stupid here.

I am using R 1.8.1 with the versions of lattice and nlme that came with it. 
I am using Windows 98SE if that is relevant.

@BOOK{pinheiro00,
   author = {Pinheiro, J C and Bates, D M},
   year = 2000,
   title = {Mixed-effects models in {S} and {S-PLUS}},
   publisher = {Springer-Verlag}
}


Michael Dewey
m.dewey at iop.kcl.ac.uk




More information about the R-help mailing list