Matthew Giovanni
2010-Mar-20 22:54 UTC
[R] Problem specifying Gamma distribution in lme4/glmer
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? Thank you for your input. Best regards, ___________________________________ Matt Giovanni, Ph.D. NSERC Visiting Research Fellow Canadian Wildlife Service 2365 Albert St., Room 300 Regina, SK S4P 4K1 306-780-6121 work 402-617-3764 mobile http://sites.google.com/site/matthewgiovanni/
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)?
Dieter Menne
2010-Mar-21 16:00 UTC
[R] Problem specifying Gamma distribution in lme4/glmer
Ben Bolker wrote:> > > 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)? > >Interesting idea. Do you know of a example where this was done (independent of lmer)? We have similar data, were people are either symptom free (50% with score 0), and the rest is smoothly distributed. Dieter -- View this message in context: http://n4.nabble.com/Problem-specifying-Gamma-distribution-in-lme4-glmer-tp1676344p1676746.html Sent from the R help mailing list archive at Nabble.com.
Dieter Menne <dieter.menne <at> menne-biomed.de> writes:> Ben Bolker wrote:> > 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)?> [...] Do you know of a example where this was done (independent > of lmer)? [...]Nothing springs to mind, but it seems sensible. Ben Bolker
David Winsemius
2010-Mar-21 21:48 UTC
[R] Problem specifying Gamma distribution in lme4/glmer
On Mar 21, 2010, at 5:16 PM, Ben Bolker wrote:> Dieter Menne <dieter.menne <at> menne-biomed.de> writes: > >> Ben Bolker wrote: > >>> 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)? > >> [...] Do you know of a example where this was done (independent >> of lmer)? [...] > > Nothing springs to mind, but it seems sensible.I thought this was what hurdle and ZIF models were supposed to handle gracefully? -- David.> > Ben Bolker
David Winsemius
2010-Mar-22 02:56 UTC
[R] Problem specifying Gamma distribution in lme4/glmer
On Mar 21, 2010, at 5:16 PM, Ben Bolker wrote:> Dieter Menne <dieter.menne <at> menne-biomed.de> writes: > >> Ben Bolker wrote: > >>> 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)? > >> [...] Do you know of a example where this was done (independent >> of lmer)? [...] > > Nothing springs to mind, but it seems sensible.I thought this was what hurdle and ZIF models were supposed to handle gracefully? -- David.> > Ben Bolker