Skip to content

zero-inflation beta or gamma model?

3 messages · Luca Santini, Ben Bolker

#
Hi,

I have a response variable expressed as proportion that varies from 0 to 1. The variable is highly left skewed, and about half of the values are zeros. I found a previous question related to a possible use of beta family together with a zero-inflation, to which B. Bolker replied it was possible using a hurdle approach in the glmmTMB package. I rescaled the response to 0 - 0.999 (only 1 value is = 1) and tried this approach.

However, when I run 

mod<-glmmTMB(TerrBeta2 ~ 1 + (1|Family/Genus/Species) + (1|Site/Year/Month), family=beta_family(), ziformula=~., data=data2)

I get the following error message (looks like the ziformula argument is ignored)

Error in eval(family$initialize) : y values must be 0 < y < 1

I also tried to specify the family differently

mod<-glmmTMB(TerrBeta2 ~ 1 + (1|Family/Genus/Species) + (1|Site/Year/Month), family=list(family="beta",link="logit"), ziformula=~., data=data2)

But I get this

Error in nlminb(start = par, objective = fn, gradient = gr, control = control$optCtrl) : 
  gradient function must return a numeric vector of length 15
In addition: Warning messages:
1: In glmmTMB(TerrBeta2 ~ 1 + (1 | Family/Genus/Species) + (1 | Site/Year/Month),  :
  some components missing from ?family?: downstream methods may fail
2: In mkTMBStruc(formula, ziformula, dispformula, combForm, mf, fr,  :
  specifying ?family? as a plain list is deprecated
3: In nlminb(start = par, objective = fn, gradient = gr, control = control$optCtrl) :
  NA/NaN function evaluation
Timing stopped at: 0.626 0.065 0.689

Any suggestion? 

Another option to avoid rescaling the variable may be using the gamma family, but I get into the same error messages. 
Any suggestion would be greatly appreciated!

Best
#
The zero-inflation stuff is only available in the development
version of glmmTMB at the moment ... although we hope to submit a new
version to CRAN in the very near future.  (See
https://github.com/glmmTMB/glmmTMB/blob/master/README.md for
instructions on installing the development version.)
On Thu, Jan 9, 2020 at 5:28 AM Luca Santini <luca.santini.eco at gmail.com> wrote:
#
It works, thanks!

Luca