[R-sig-ME] [R] Problem specifying Gamma distribution in lme4/glmer
Matthew Giovanni
matthewgiovanni at gmail.com
Sun May 2 04:04:58 CEST 2010
Hey, everyone. Thanks so much for your input. I apologize for not
attaching an example data file before. I'm attaching an example csv file,
used with the following R script:
veg=read.csv("Litter.csv",header=TRUE)
veg$YPM=factor(veg$YPM)
veg$YEAR=factor(veg$YEAR)
hist(veg$LITTER)
qqnorm(veg$LITTER)
qqline(veg$LITTER)
litter=glmer(LITTER~YPM+MNG+(1|PROV/SITE)+(1|YEAR),data=veg,family=Gamma(link=log))
summary(litter)
I also noticed that Stephani posted an inquiry describing the same problem (
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2008q4/001684.html), where
the Gamma specification works with glm, and the lognormal specification
works with glmer, but the Gamma with glmer produces the same error for the
both of us:
Error in asMethod(object) : matrix is not symmetric [1,2]
Stephani, have you had any luck understanding this error? I have not been
able to figure it out. Thanks again for your input, everyone. Best
regards,
Matt
___________________________________
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/
On Sun, Mar 21, 2010 at 7:25 PM, Ben Bolker <bolker at ufl.edu> wrote:
> [Moving this to r-sig-mixed-models ]
>
> David Winsemius wrote:
> > 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?
>
> hurdle/zero-inflated/zero-altered models are typically developed in
> the context of discrete (count) data, where the base model has some
> non-zero probability of recording a zero and has to be altered to
> account for the presence of extra (or missing) zeros. In this case
> (continuous data) the gamma distribution has an infinitesimal
> probability of producing an exact zero, so it's actually easier to deal
> with the data as a mixture of zeros (with probability p) and
> Gamma-distributed values (with shape and scale or rate parameters
> specified). If it's OK to model the mixture process and the conditional
> density separately this is actually easier than a hurdle or ZIF model.
>
> Another possibility, which I've heard of but not ever looked at
> carefully, would be to use Tweedie distributions with 1<p<2:
>
> http://en.wikipedia.org/wiki/Tweedie_distributions
> http://cran.r-project.org/web/packages/tweedie/index.html
>
> Incorporating random effects could be tricky, though: a mean-variance
> relationship is given for Tweedie distributions (V = phi*mu^p), so
> conceivably the fitting could be done as a two-dimensional search over
> the GLMM fits obtained for fixed values of (phi,p). (Yikes.)
>
> Ben
>
>
>
> --
> Ben Bolker
> Associate professor, Biology Dep't, Univ. of Florida
> bolker at ufl.edu / people.biology.ufl.edu/bolker
> GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc
>
More information about the R-sig-mixed-models
mailing list