[R] lme plot

Dieter Menne dieter.menne at menne-biomed.de
Fri Mar 24 16:46:25 CET 2006


Leonardo D Bacigalupe <L.Bacigalupe <at> sheffield.ac.uk> writes:

> I'm trying to plot e.g. fitted vs residuals for each level of the 
> random effects, and i'm getting the same error.
> I guess this might be a problem of the graphic capabilities of R.
> 
> Is there any way to obtain those plots?
> 
> library(nlme)
> attach(ergoStool)
> names(ergoStool)
> [1] "effort"  "Type"    "Subject"
> m1<-lme(effort~Type,random=~1|Subject)
> plot(m1,form=resid(.,type="p")~fitted(.)|Subject,abline=0)#resid and 
> fitted for each level of subject
> Error in as.vector(x, "list") : cannot coerce to vector
> 

I don't believe your idea is wrong, and I don't understand why this does not 
work, but a similar line on page 176 of Pinheiro/Bates does (there, the call to 
getData returns non-null).  The lines I don't understand in plot.lme are 

            alist <- lapply(as.list(allV), as.name)
            names(alist) <- allV
# next line
            alist <- c(as.list(as.name("data.frame")), alist)
            mode(alist) <- "call"
            data <- eval(alist, sys.parent(1))

This code turn up again and again in nlme, but I admit I don't understand what 
it means.

Anybody taking the challenge to dissect it?

Dieter




More information about the R-help mailing list