[R-sig-ME] Need help on zero-inflated beta model and post-hoc test

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Mon Feb 3 01:57:06 CET 2020



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
>



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