[R] panel ordering in nlme and augPred plots

Petr Pikal petr.pikal at precheza.cz
Mon Apr 25 18:26:23 CEST 2005


Thank you.

On 25 Apr 2005 at 10:29, Deepayan Sarkar wrote:

> On Monday 25 April 2005 09:40, Petr Pikal wrote:
> > Dear all
> >
> > I am trying nlme together with Pinheiro/Bates book. I constructed
> > grouped data object with suitable plotting layout (according to some
> > common factor, panels from bottom to top are in increasing order).
> >
> > When I do nlme(... some stuff...) I get fitted object which I can
> > plot with
> >
> > plot(augPred(fit.nlme6, level=0:1))
> >
> > but it results in completely different ordering. Is there any way
> > how I can plot panels in some defined order e.g.
> 
> Could you give us a reproducible example? Following the example on the
> help page
> 

Not yet, I try.

I made my grouped.data with ooo ordering

limity.gr<-groupedData(konverze~tepl|spol.f, limity[ooo,], 
order.groups=F)

which led to correct ordering in

plot(limity.gr)

but it probably left limity.gr in the same order as limity

> head(limity[,1:2])
  pokus vzorek
1     1      6
2     1      7
3     1      8
4     1      9
5     1     10
6     2      8
> head(limity.gr[,1:2])
  pokus vzorek
1     1      6
2     1      7
3     1      8
4     1      9
5     1     10
6     2      8
> head(limity.gr[ooo,1:2])
   pokus vzorek
33    10      3
34    10      4
35    10      5
36    10      7
37    10      8
38    10      9
> head(limity[ooo,1:2])
   pokus vzorek
26     7      5
27     7      6
28     7      7
78    15      9
79    15     10
80    15     11

When I reordered the limity.gr file in desired order and I made the 
nlme analysis based on this newly ordered data, augPred plot was 
OK.

<snip>

> 
> Possibly. plot.augPred produces a Trellis plot, and usually arguments
> to the underlying plotting function can be passed on through the
> top-level call. e.g., with the Orthodont data
> 
> plot(augPred(fm1, level = 0:1), skip = rep(c(F,T), c(16, 2)))

That's it! Together with suitable layout I got what I wanted. 

Great.
Thanks a lot

Best regards
Petr

> 
> or 
> 
> p <- plot(augPred(fm1, level = 0:1))
> update(p, skip = rep(c(F,T), c(16, 2)))
> 
> You would of course have to know what valid arguments are; for that
> see ?xyplot and ?update.trellis (in the lattice package).
> 
> Deepayan

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list