MichaelChirico / r-bugs

A ⚠️read-only⚠️mirror of https://bugs.r-project.org/
20 stars 0 forks source link

[BUGZILLA #16890] nlme::intervals.lmList with seems not to work with unpooled SE estimates #6211

Open MichaelChirico opened 4 years ago

MichaelChirico commented 4 years ago

?intervals.lmList suggests that we can get un-pooled confidence intervals on the fly:

pool: an optional logical value indicating whether a pooled
estimate of the residual standard error should be used.
Default is ‘attr(object, "pool")’.

However, intervals.lmList doesn't seem to work for unpooled SE estimates, whether the unpooling is specified in the original model or as an override argument.

library(nlme) fm1 <- lmList(heigh∼age|Subject, Oxboys) ## pool=TRUE (default) fm2 <- lmList(heigh∼age|Subject, Oxboys, pool=FALSE) i1 <- intervals(fm1) ## works (uses pooled SE) attr(fm1,"pool") ## TRUE attr(fm2,"pool") ## FALSE

intervals(fm1,pool=FALSE) ## Error in qf(level, 1, smry$df.residual) : ## Non-numeric argument to mathematical function intervals(fm2) ## same error

The proximal problem seems to be that summary.lme gives a NULL df.residual when pool=FALSE ...

summary(fm1)$df.residual ## TRUE summary(fm1, pool=FALSE)$df.residual ## NULL


METADATA

MichaelChirico commented 4 years ago

Thank you, Ben.

At least this is a very old bug. I've checked a 2005 version of R's nlme...

Further suggestions {what are the correct 'df' ???} are welcome.

Or should we (R-core) just update the documentation with its "suggestion" ?


METADATA

MichaelChirico commented 4 years ago

(In reply to Martin Maechler from comment #1)

Thank you, Ben.

At least this is a *very* old bug. I've checked a 2005 version of R's nlme...

Further suggestions {what are the correct 'df' ???}  are welcome.

Or should we (R-core) just update the documentation with its "suggestion" ?

I would think that the correct df.residuals would be a vector, equivalent to whatever would have been estimated for the individual group fits (i.e. nobs per group - npar per group). If having length(df.residuals)>1 would mess things up elsewhere, then intervals.lmList should probably just compute these values itself (rather than expecting it to be in the summary object)


METADATA