Message-ID: <eaf18097-3046-97c5-7aef-0ce7916fc8e3@highstat.com>
Date: 2020-01-10T15:35:09Z
From: Highland Statistics Ltd
Subject: zero-inflation beta or gamma model?
In-Reply-To: <mailman.18003.11.1578654002.44192.r-sig-mixed-models@r-project.org>
> 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
Your model is very complication in terms of the random effects.
Besides...I am not a fan of using year and month as random effects.
As to the zero inflation aspect of the beta GLMM....apologies for
self-citing here, but Chapter 16 in this book:
http://highstat.com/index.php/beginner-s-guide-to-zero-inflated-models
has a fully worked out example using the zero-inflated beta GLMM with
2-way nested random effects.
And Chapter 23 in Volume II of this one
http://highstat.com/index.php/beginner-s-guide-to-regression-models-with-spatial-and-temporal-correlation
touches on zero-inflated beta GAMs with spatial correlation and barrier
models.
Kind regards,
Alain
> 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
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
------------------------------
Subject: Digest Footer
_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-models at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
------------------------------
End of R-sig-mixed-models Digest, Vol 157, Issue 6
**************************************************
--
Dr. Alain F. Zuur
Highland Statistics Ltd.
9 St Clair Wynd
AB41 6DZ Newburgh, UK
Email: highstat at highstat.com
URL: www.highstat.com