[R-sig-ME] lmer() with 'na.action=na.exclude'; error with summary()

Ben Bolker bbolker at gmail.com
Mon Sep 8 18:50:01 CEST 2014


John Maindonald <john.maindonald at ...> writes:

> 
> The following demonstrates the issue:
> 
> > library(DAAG)
> > science.lmer <- lmer(like ~ sex + PrivPub + (1 | school) + 
> +                      (1 | school:class), data = science,  
> +                      na.action=na.exclude) 
> > summary(science.lmer)
> Linear mixed model fit by REML ['lmerMod']

 [snip]
 
> Scaled residuals: 
> Error in quantile.default(resids) : 
>   missing values and NaN's not allowed if 'na.rm' is FALSE
> > ## Suppress details of residuals


> > summary(science.lmer, show.resids=FALSE)

  This is a confusion between the arguments of the summary method
(summary.merMod) and the *print method* (print.summary.merMod).
We should add a warning to summary that says it is discarding
unused arguments (the ... in the model definition is only there
for compatibility with the summary() generic method).

  print(summary(science.lmer), show.resids=FALSE)

works fine.

> 
> I doubt that there is an intention for summary.merMod() to throw an error
> lmer() has been called with 'na.action=na.exclude’.  
> It should certainly not 
> throw an error with the argument 'show.resids=FALSE’.

   Now I'm wondering whether the correct behaviour when there are
NAs in the (extended) residuals is 

  1 omit NAs from the residual quantile calculation (easiest)
  2 return NA values for all quantiles of the residual
  3 return the quantiles plus a statement of the number of NAs.

Any good reason not to just do #1?



More information about the R-sig-mixed-models mailing list