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 at r-project.org
You can reach the person managing the list at
r-sig-mixed-models-owner at 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 at gmail.com>
To: Ben Bolker <bbolker at gmail.com>
Cc: R SIG Mixed Models <r-sig-mixed-models at r-project.org>
Subject: Re: [R-sig-ME] zero-inflation beta or gamma model?
Message-ID: <314533C3-E6A6-4077-987E-4158BBB5F475 at gmail.com>
Content-Type: text/plain; charset="utf-8"
It works, thanks!
Luca
On 9 Jan 2020, at 15:26, Ben Bolker <bbolker at 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 at 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 at 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 at highstat.com>
To: "r-sig-mixed-models at r-project.org"
<r-sig-mixed-models at r-project.org>
Subject: Re: [R-sig-ME] zero-inflation beta or gamma model?
Message-ID: <eaf18097-3046-97c5-7aef-0ce7916fc8e3 at 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 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
------------------------------
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 7
**************************************************