[R-sig-ME] Fwd: hierarchical gamma model in lme4

Ben Bolker bbolker at gmail.com
Thu May 19 00:34:11 CEST 2011

Hash: SHA1

  The bleeding-edge development version of glmmADMB will now do Gamma
fits, but you will have to be brave and/or patient.  At the moment the
code is available from SVN on r-forge; you will have to build and
install from the "multirand" branch.  Furthermore, unless you have AD
Model Builder installed and can compile the TPL file yourself, at the
moment it will only run on 32-bit linux machines.

  If that all sounds like gibberish to you, then it's probably a little
too early to try to use it.  I will try to put a more accessible version
up soon; keep an eye on <http://glmmadmb.r-forge.r-project.org/> (search
for "alpha").

  For now, I would highly recommend log-transforming and using LMMs ...

  Ben Bolker

- -------- Original Message --------
Subject: 	hierarchical gamma model in lme4
Date: 	Tue, 17 May 2011 15:51:18 -0700
From: 	Benjamin Caldwell <btcaldwell at berkeley.edu>
To: 	bbolker at gmail.com

After seeing this
(https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q1/005213.html) email
I thought I would check the issue with a gamma family in lme4 hadn't
been fixed; can I fit a hierarchical gamma model in lme4 at this time?
There doesn't seem to be another package capable of it at this time.

My thought process:
1. took a look at the response variable and some subsets to see what it
looked like, ("bppfcl" and "transformed response var"), attached
2. took a look at a gamma and gaussian fit to the response variable.
3. ran hierarchical gaussian model in nlme to look at residuals
(more familiar with graphs from that package) ("qqnorm" and "residuals")

Given the residual output for the gaussian model it looks like I could
remove the values at the end of the distribution and get a decent fit.
I'd still like to try a gamma model though, if that's possible. Is it
possible in lme4 or another package I don't know about?

- ---This is the code I'm running---

rws30.BL$site <- factor(rws30.BL$site)
rws30.BL$transect <- interaction(rws30.BL$site, rws30.BL$transect, drop
rws30.BL$plot <- interaction(rws30.BL$site, rws30.BL$transect,
rws30.BL$plot, drop = TRUE)

random=(~1|site/transect/plot),na.action=na.omit, data=rws30.BL)
Error: no valid set of coefficients has been found: please supply
starting values
In addition: Warning message:
In log(ifelse(y == 0, 1, y/mu)) : NaNs produced

- --- I thought the problem might be a convergence error, and so tried a
reduced model ----
family=Gamma, na.action=na.omit, data=rws30.BL)
Error in mer_finalize(ans) :
  mu[i] must be positive: mu = -0.00780625, i = 3

Any clarity I could get would be much appreciated.


*Ben Caldwell*

PhD Candidate
University of California, Berkeley

Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the R-sig-mixed-models mailing list