[R] Problem specifying Gamma distribution in lme4/glmer
Ben Bolker
bolker at ufl.edu
Sun Mar 21 16:33:49 CET 2010
Matthew Giovanni <matthewgiovanni <at> gmail.com> writes:
>
> Dear R and lme4 users-
>
> I am trying to fit a mixed-effects model, with the glmer function in
> lme4, to right-skewed, zero-inflated, non-normal data representing
> understory grass and forb biomass (continuous) as a function of tree
> density (indicated by leaf-area). Thus, I have tried to specify a
> Gamma distribution with a log-link function but consistently receive
> an error as follows:
>
> total=glmer(total~gla4+(1|plot)+
(1|year/month),data=veg,family=Gamma(link=log))
> summary(total)
> Error in asMethod(object) : matrix is not symmetric [1,2]
>
> I have also tried fitting glmm's with lme4 and glmer to other
> Gamma-distributed data but receive the same error. Has anyone had
> similar problems and found any solutions?
1. probably best to post questions like this to
r-sig-mixed-models at r-project.org
2. haven't seen this particular problem. Can you please
provide a reproducible example (post your data, or a small
subset of your data, or a simulated example that displays
the same problem), and give the results of
the sessionInfo() function?
f <- factor(rep(1:10,each=10))
x <- runif(100)
dat <- data.frame(x,f)
library(lme4)
[snip messages]
g1 <- glmer(x~1+(1|f),data=dat,family=Gamma(link=log))
Generalized linear mixed model fit by the Laplace approximation
[...]
summary(g1)
[ works fine]
sessionInfo()
R version 2.10.1 (2009-12-14)
i486-pc-linux-gnu
[snip]
other attached packages:
[1] lme4_0.999375-32-2 Matrix_0.999375-38 lattice_0.18-3
3. zero-inflated data may not be particularly well-represented
by a Gamma distribution: if you actually have a significant number
of exactly-zero values, you may want to analyze your data in two
stages, first as a presence-absence problem and then as a conditional
density (i.e., what is the distribution of the non-zero values)?
More information about the R-help
mailing list