[R-sig-ME] zero-inflation beta or gamma model?

Luca Santini |uc@@@@nt|n|@eco @end|ng |rom gm@||@com
Sun Jan 12 14:29:45 CET 2020


Hi Alain,

Thank you for your suggestion, I have a couple of your books but not these ones, so I cannot really access the worked out examples..
I’m curious however to know more about your opinion on the “too many” random effects. They are a lot indeed.
The thing is that have have data from multiple populations of different species in different sites, years and months.
My response variable may change throughout the months (different seasons may show different patterns), but I’m not really interested in this variation. The example I shared was an only-intercept model but I’m actually interested in including a number of fixed effects for which I do have good hypotheses. 
Is there a specific reason why you are against using months as random effects? What else would you suggest? 
Thanks

Luca


> On 11 Jan 2020, at 12:00, r-sig-mixed-models-request using r-project.org wrote:
> 
> Send R-sig-mixed-models mailing list submissions to
> 	r-sig-mixed-models using r-project.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> or, via email, send a message with subject or body 'help' to
> 	r-sig-mixed-models-request using r-project.org
> 
> You can reach the person managing the list at
> 	r-sig-mixed-models-owner using r-project.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-sig-mixed-models digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: zero-inflation beta or gamma model? (Luca Santini)
>   2. Re: zero-inflation beta or gamma model? (Highland Statistics Ltd)
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 10 Jan 2020 13:36:00 +0100
> From: Luca Santini <luca.santini.eco using gmail.com>
> To: Ben Bolker <bbolker using gmail.com>
> Cc: R SIG Mixed Models <r-sig-mixed-models using r-project.org>
> Subject: Re: [R-sig-ME] zero-inflation beta or gamma model?
> Message-ID: <314533C3-E6A6-4077-987E-4158BBB5F475 using gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> It works, thanks!
> 
> Luca
> 
> 
>> On 9 Jan 2020, at 15:26, Ben Bolker <bbolker using gmail.com> wrote:
>> 
>> 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 using gmail.com> wrote:
>>> 
>>> 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
>>> 
>>> 
>>> 
>>> 
>>>       [[alternative HTML version deleted]]
>>> 
>>> _______________________________________________
>>> R-sig-mixed-models using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Fri, 10 Jan 2020 15:35:09 +0000
> From: Highland Statistics Ltd <highstat using highstat.com>
> To: "r-sig-mixed-models using r-project.org"
> 	<r-sig-mixed-models using r-project.org>
> Subject: Re: [R-sig-ME] zero-inflation beta or gamma model?
> Message-ID: <eaf18097-3046-97c5-7aef-0ce7916fc8e3 using highstat.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
> 
> 
> 
> 
>> 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 using 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 using 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 using highstat.com
> URL:   www.highstat.com
> 
> 
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> R-sig-mixed-models mailing list
> R-sig-mixed-models using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 
> 
> ------------------------------
> 
> End of R-sig-mixed-models Digest, Vol 157, Issue 7
> **************************************************



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