[R-sig-ME] A consultation about lmer -- normality assumptions
John Maindonald
john@m@|ndon@|d @end|ng |rom @nu@edu@@u
Thu Dec 26 19:23:12 CET 2019
Re checking normality, note that lattice::qqmath() has methods both for plotting residuals
and for plotting random effects.
library(lme4) ## for lmer(), sleepstudy
library(lattice) ## for dotplot()
ss.lmer <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
qqmath(ss.lmer) ## Normal probability plot of residuals
qqmath(ranef(ss.lmer, condVar=TRUE)) ## Random effects with 1 SD limits, axes are reversed
qqmath(ranef(ss.lmer, condVar=FALSE)) ## Random effects with 1 SD limits, axes as usual
See ?qqmath.merMod and ?qqmath.ranef.mer for details.
NB also the discussion at:
https://stackoverflow.com/questions/13847936/plot-random-effects-from-lmer-lme4-package-using-qqmath-or-dotplot-how-to-mak?r=SearchResults&s=1|132.5021<https://stackoverflow.com/questions/13847936/plot-random-effects-from-lmer-lme4-package-using-qqmath-or-dotplot-how-to-mak?r=SearchResults&s=1%7C132.5021>
The key question has still to be addressed: Are departures from normality likely to be of sufficient
consequence to matter for purposes of the use that will be made of the analysis? Checks for
normality may be just the first, relatively easy, step!
John Maindonald email: john.maindonald using anu.edu.au<mailto:john.maindonald using anu.edu.au>
On 25/12/2019, at 14:16, John Maindonald <john.maindonald using anu.edu.au<mailto:john.maindonald using anu.edu.au>> wrote:
It is also assumed that the random effects are normally distributed. Depending
on the relative magnitude of the variance components, and on the relative
contributions to the variance of the statistic that is of interest [, this may or may
not be the greater reason for concern]. Where there are
a small number of random effects (alias BLUPs), normality can be a much more
serious matter for them than for the residuals, because there is less opportunity
for the Central Limit Theorem to kick in.
Unbalance in the data can make it quite a bit harder to check the relevant set(s)
of random effects for normality. One may need to resort to simulation.
John Maindonald email: john.maindonald using anu.edu.au<mailto:john.maindonald using anu.edu.au><mailto:john.maindonald using anu.edu.au>
On 24/12/2019, at 23:24, Thierry Onkelinx via R-sig-mixed-models <r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using r-project.org><mailto:r-sig-mixed-models using r-project.org>> wrote:
Dear anonymous,
The assumption of normality is on the residuals, not on the observations.
The assumption holds reasonably for the sleepstudy, except for a few
outliers.
library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
qqnorm(residuals(fm1))
Best regards,
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx using inbo.be<mailto:thierry.onkelinx using inbo.be><mailto:thierry.onkelinx using inbo.be>
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be<http://www.inbo.be>
///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////
<https://www.inbo.be>
Op ma 23 dec. 2019 om 17:36 schreef 何如梦 <18754808835 using 163.com<mailto:18754808835 using 163.com>>:
I have some confusion about the use of lmer. As I learned the data
should be normal distributed when use liner mixed model. I tested the
exmple data (Reaction$sleepstudy) by using shapiro.test. The result shows
that it was not normal distributed. So I have some confusion about the
requirment of data distribution in function lmer and glmmer.
[[alternative HTML version deleted]]
_______________________________________________
R-sig-mixed-models using r-project.org<mailto:R-sig-mixed-models using r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
[[alternative HTML version deleted]]
_______________________________________________
R-sig-mixed-models using r-project.org<mailto:R-sig-mixed-models using r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
[[alternative HTML version deleted]]
_______________________________________________
R-sig-mixed-models using r-project.org<mailto:R-sig-mixed-models using r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list