SCM

[#307] block variances incorrectly scaled in quasi-poisson fits

Date:
2009-02-17 16:39
Priority:
3
State:
Closed
Submitted by:
Ben Bolker (bbolker)
Assigned to:
Nobody (None)
Product:
glmer
Operating System:
All
Component:
R or C functions
Version:
None
Severity:
normal
Resolution:
None
URL:
Summary:
block variances incorrectly scaled in quasi-poisson fits

Detailed description
I believe, based on some reasonably careful testing,
that quasi- fits are incorrectly scaling the reported
random effects variance by the error (residual) variance.
A detailed discussion is given by:

http://www.zoology.ufl.edu/bolker/glmm/quasitest.Rnw
http://www.zoology.ufl.edu/bolker/glmm/quasitest.pdf

-- essentially, I generate some simulated data
and show that quasi- are inflating the block variances
inappropriately.

I believe the following patch fixes the problem:

--- lmer.R (revision 279)
+++ lmer.R (working copy)
@@ -938,14 +938,19 @@
else "sigmaML"]
})

+is.glmm <- function(object) {
+ length(object@muEta)>0
+}
+
setMethod("VarCorr", signature(x = "mer"),
function(x, ...)
### Create the VarCorr object of variances and covariances
{
- sc <- sigma(x)
+ tsc <- sc <- sigma(x)
+ if (is.glmm(x)) tsc <- 1 ## DON'T scale GLMM var-corr by
ans <- lapply(cc <- .Call(mer_ST_chol, x),
function(ch) {
- val <- crossprod(sc * ch) # variance-covariance
+ val <- crossprod(tsc * ch) # variance-covariance
stddev <- sqrt(diag(val))
correl <- t(val / stddev)/stddev
diag(correl) <- 1

Comments:

Message  ↓
Date: 2012-03-17 22:35
Sender: Ben Bolker

quasi-poisson no longer exists, this is obsolete!

Attached Files:

Changes

Field Old Value Date By
status_idOpen2012-03-17 22:35bbolker
close_dateNone2012-03-17 22:35bbolker
details I believe, based on some reasonably careful testing, that quasi- fits are incorrectly scaling the reported random effects variance by the error (residual) variance. A detailed discussion is given by: http://www.zoology.ufl.edu/bolker/glmm/quasitest.Rnw http://www.zoology.ufl.edu/bolker/glmm/quasitest.pdf -- essentially, I generate some simulated data and show that quasi- are inflating the block variances inappropriately. I believe the following patch fixes the problem: --- lmer.R (revision 279) +++ lmer.R (working copy) @@ -938,14 +938,19 @@ else "sigmaML"] }) +is.glmm <- function(object) { + length(object@muEta)>0 +} + setMethod("VarCorr", signature(x = "mer"), function(x, ...) ### Create the VarCorr object of variances and covariances { - sc <- sigma(x) + tsc <- sc <- sigma(x) + if (is.glmm(x)) tsc <- 1 ## DON'T scale GLMM var-corr by ans <- lapply(cc <- .Call(mer_ST_chol, x), function(ch) { - val <- crossprod(sc * ch) # variance-covariance + val <- crossprod(tsc * ch) # variance-covariance stddev <- sqrt(diag(val)) correl <- t(val / stddev)/stddev diag(correl) <- 1 2012-03-17 22:35bbolker
Thanks to:
Vienna University of Economics and Business Powered By FusionForge