Dear Helpers,
I have been trying to visualise the random effects of a mixed effects
model which was fitted with the lmer function from the lme4 package.
Extracting the fixed and random effects works rather well with
'coef', but when plotting this with 'by' and 'abline', something
strange happens.
I use the following syntax (example):
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
sleep <- coef(fm1)$Subject
sleep$resp <- 1:18
plot(c(0,10), c(200,400), type="n")
by(sleep, resp, function(x) abline(coef=x))
This results in a basic, but acceptable, plot. However, it also
results in quite some output at the R-Prompt. A portion of it looks
like this:
resp: 308
NULL
-----------------------------------------------------
resp: 309
NULL
-----------------------------------------------------
resp: 310
NULL
-----------------------------------------------------
resp: 330
NULL
-----------------------------------------------------
resp: 331
NULL
-----------------------------------------------------
resp: 332
NULL
What is happening? I suspect it has something to do with my use of
the 'by' function, but is there a way to prevent all the unwanted
text-output?
Thanks in advance
Rense
- - -- --- ----- --------
Rense Nieuwenhuis
+31 6 481 05 683
www.rensenieuwenhuis.nl
[[alternative HTML version deleted]]