[R-sig-ME] Need help on zero-inflated beta model and post-hoc test
Yiru Cheng
yc2975 @end|ng |rom co|umb|@@edu
Mon Feb 3 22:04:50 CET 2020
Hi, Ben
Thanks for your clarification! The raw residuals for the simulated data
don't look normal as you said. Since the expected and observed residuals
have no sig. deviation, I guess I can go ahead and do the post-hoc test
using this model.
Yiru
>
>
> Message: 1
> Date: Sun, 2 Feb 2020 16:08:36 -0500
> From: Yi-Ru Cheng <yc2975 using columbia.edu>
> To: r-sig-mixed-models using r-project.org
> Subject: [R-sig-ME] Need help on zero-inflated beta model and post-hoc
> test
> Message-ID:
> <CAOmDo73Fv5Ew0ZtqXUQhTjv5N==Jty=
> aEYfdM5n2ULQ_OVj6og using mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi, everyone
>
>
> I would like to compare the relatedness of individuals among plots. Since
> relatedness is bound between 0 and 1 and most of them are zeros, I am
> trying to fit with the zero-inflated beta model in the gamlss and glmmTMB
> packages. After fitting the model, I want to perform the post-hoc test
> between different plots. However, I have some conundrums here.
>
>
> 1. gamlss
>
> The beta model in the package gamlss gives a pretty good residual plot, but
> the post-hoc tests in emmeans and multcomp don't work with the model...Here
> is my model.
>
>
>
> m1 <- gamlss(r ~ plot + random(year), family = BEINF, data = df)
>
> emmeans(m1, pairwise ~ plot, type="response")
>
> hist(resid(m1))
>
>
> "Error in emm_basis.gamlss(object, trms, xlev, grid, misc = attr(data, :
>
> gamlss models with smoothing are not yet supported in 'emmeans'"
>
>
>
> 2. glmmTMB
>
> I then tried the beta family in glmmTMB. For some reason, the simple
> residual plot looks pretty skewed, but it looks alright with the scaled
> residual plot in DHARMa. Otherwise, the post-hoc test in emmeas works fine.
>
>
>
> m2 <- glmmTMB(r ~ plot + (1|year), ziformula =~ 1, data=df,
> family=beta_family(link="logit"))
>
> emmeans(m2, pairwise ~ plot, type="response")
>
> hist(resid(m2)) #skewed
>
> DHARMa::simulateResiduals(m2) ⇒ no significant deviation
>
>
>
> I’m not quite sure why the residual plots give different patterns in two
> models. Is it not correct to look at the residual distribution for
> diagnosis? Could I see it’s a green light to use the model in glmmTMB based
> on the simulated residuals in the DHAMRMa package even though the simple
> residual plot looks skewed? Or is there any other post-hoc test designed
> for gamlss with the smoothing process? Any suggestions would be
> appreciated. Thanks in advance!
>
>
> Best,
>
> Yiru
>
> [[alternative HTML version deleted]]
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 2 Feb 2020 19:57:06 -0500
> From: Ben Bolker <bbolker using gmail.com>
> To: r-sig-mixed-models using r-project.org
> Subject: Re: [R-sig-ME] Need help on zero-inflated beta model and
> post-hoc test
> Message-ID: <e7a36b0d-339b-5564-065c-c529d7084c0d using gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
>
>
> On 2020-02-02 4:08 p.m., Yi-Ru Cheng wrote:
> > Hi, everyone
> >
> >
> > I would like to compare the relatedness of individuals among plots. Since
> > relatedness is bound between 0 and 1 and most of them are zeros, I am
> > trying to fit with the zero-inflated beta model in the gamlss and glmmTMB
> > packages. After fitting the model, I want to perform the post-hoc test
> > between different plots. However, I have some conundrums here.
> >
> >
> > 1. gamlss
> >
> > The beta model in the package gamlss gives a pretty good residual plot,
> but
> > the post-hoc tests in emmeans and multcomp don't work with the
> model...Here
> > is my model.
> >
> >
> >
> > m1 <- gamlss(r ~ plot + random(year), family = BEINF, data = df)
> >
> > emmeans(m1, pairwise ~ plot, type="response")
> >
> > hist(resid(m1))
> >
> >
> > "Error in emm_basis.gamlss(object, trms, xlev, grid, misc = attr(data,
> :
> >
> > gamlss models with smoothing are not yet supported in 'emmeans'"
> >
> >
> >
> > 2. glmmTMB
> >
> > I then tried the beta family in glmmTMB. For some reason, the simple
> > residual plot looks pretty skewed, but it looks alright with the scaled
> > residual plot in DHARMa. Otherwise, the post-hoc test in emmeas works
> fine.
> >
> > m2 <- glmmTMB(r ~ plot + (1|year), ziformula =~ 1, data=df,
> > family=beta_family(link="logit"))
> >
> > emmeans(m2, pairwise ~ plot, type="response")
> >
> > hist(resid(m2)) #skewed
> >
> > DHARMa::simulateResiduals(m2) ⇒ no significant deviation
>
> Quick answer: I don't think there's any reason to expect the
> residuals of a Beta GLMM *not* to be skewed. Try simulating a simple
> example (you may even be able to use simulate() on your fitted model) to
> see for yourself. DHARMa does a plot of expected vs actual
> distributions of residuals, not a raw plot of residuals.
>
>
> >
> >
> >
> > I’m not quite sure why the residual plots give different patterns in two
> > models. Is it not correct to look at the residual distribution for
> > diagnosis? Could I see it’s a green light to use the model in glmmTMB
> based
> > on the simulated residuals in the DHAMRMa package even though the simple
> > residual plot looks skewed? Or is there any other post-hoc test designed
> > for gamlss with the smoothing process? Any suggestions would be
> > appreciated. Thanks in advance!
> >
> >
> > Best,
> >
> > Yiru
> >
> > [[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 158, Issue 3
> **************************************************
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list