glmer() Gamma distribution - constant coefficient of variation
On 3/30/21 2:23 PM, Hedyeh Ahmadi wrote:
*Thank you for the informative suggestion - please see my question/comments below in bold:* I would start by checking the scale-location plot, i.e. plot(fitted_model, sqrt(abs(resid(., type="pearson"))) ~ fitted(.)) if that's fairly flat, you should be OK. *I actually ended up doing this last week as one of my colleage suggested as well. I ran a slightly different version of what you suggested, with deviance residual and lowess; I got a straight line (see below, the plot of the left) but when I plot exactly what you suggest, I get the following plot on the right which is kind of weird. I am leaning toward giving the deviance plot a pass since deviance residuals are suggested for GLMM. _Any feedback would be appreciated here._* *_Additional question:_ I can't figure out the connection between constant coefficient of determination and scale-location plot. Do you mind elaborating here?*
The scale-location plot is based on the Pearson residuals, which divide the residuals by their expected (theoretical) standard deviation. If the variance model is correct (i.e. the mean-variance relationship in the data matches that assumed by the model), then the expected magnitude of abs(Pearson resids) (or the square root thereof, which is applied to reduce skew) should be constant as a function of the predicted (fitted) mean.
??? Not that important, but can you tell me why you're fitting an identity-link Gamma model?? I'm always curious (I've read Lo and Andrews [2015] but don't find their argument particularly convincing ...).? Do you have reasons to believe the relationships are linear rather than log-linear?
*We originally hypothesized a linear relationship but then
when we * *ran lmer() the residual diagnostic plots were highly skewed and log transformation did not help at all. Then we implemnted the Gamma distribution assumption in glmer() with identity link to keep the linearity part. After this, I have been asked the same question of "why identity link?" then I doubted my intuition and I ran the model with inverse and log link as ad hoc exploration; I could not get thes emodels to converge so we decided to keep Gamma with identity link.
Surprising that the log-link Gamma didn't converge (usually it works better than the identity link ...) From the diagnostic plots, it looks like your data are discrete. Is there a particular reason you're not using a discrete response distribution (like the [perhaps 0-truncated] negative binomial) ?
* Best, Hedyeh Ahmadi, Ph.D. Statistician Keck School of Medicine Department of Preventive Medicine University of Southern California Postdoctoral Scholar Institute for Interdisciplinary Salivary Bioscience Research (IISBR) University of California, Irvine LinkedIn www.linkedin.com/in/hedyeh-ahmadi <http://www.linkedin.com/in/hedyeh-ahmadi> <http://www.linkedin.com/in/hedyeh-ahmadi><http://www.linkedin.com/in/hedyeh-ahmadi> ------------------------------------------------------------------------ *From:* R-sig-mixed-models <r-sig-mixed-models-bounces at r-project.org> on behalf of Ben Bolker <bbolker at gmail.com> *Sent:* Monday, March 29, 2021 5:54 PM *To:* r-sig-mixed-models at r-project.org <r-sig-mixed-models at r-project.org> *Subject:* Re: [R-sig-ME] glmer() Gamma distribution - constant coefficient of variation ?? I would start by checking the scale-location plot, i.e. plot(fitted_model, sqrt(abs(resid(., type="pearson"))) ~ fitted(.)) if that's fairly flat, you should be OK. ??? Not that important, but can you tell me why you're fitting an identity-link Gamma model?? I'm always curious (I've read Lo and Andrews [2015] but don't find their argument particularly convincing ...).? Do you have reasons to believe the relationships are linear rather than log-linear? Lo, Steson, and Sally Andrews. ?To Transform or Not to Transform: Using Generalized Linear Mixed Models to Analyse Reaction Time Data.? Frontiers in Psychology 6 (August 7, 2015). https://urldefense.com/v3/__https://doi.org/10.3389/fpsyg.2015.01171__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKV5IDIz28$ <https://urldefense.com/v3/__https://doi.org/10.3389/fpsyg.2015.01171__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKV5IDIz28$> . On 3/22/21 5:24 PM, Hedyeh Ahmadi wrote:
Hi all, I am running a glmer() with Gamma distribution and identity link. The R output is as follows. I would like to check the constant coefficient of variation assumption in R but I am not sure where to start. Any help would be appreciated. Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod'] ?? Family: Gamma? ( identity ) Formula: Y ~ 1 + pm252016aa + race +prnt.empl + overall.income +? (1 | site) Data: Family Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000)) ?????? AIC?????? BIC?????????? logLik?????????? deviance df.resid ?? 68781.7?? 68917.1 -34371.8???? 68743.7???? 9180 Scaled residuals: ????? Min????? 1Q???????????? Median????? 3Q??????? Max -1.9286?? -0.7314?? -0.0598??? 0.6770??? 3.9599 Random effects: ?? Groups??? Name?????????????? Variance?? Std.Dev. ?? site (Intercept)????? 0.66157??? 0.8134 ?? Residual??????????????????????????? 0.04502???? 0.2122 Number of obs: 9199,? groups:? site, 21 Fixed effects: ???????????????????????????????????????????????????????????????? Estimate???? Std. Error???????? t value???????????? Pr(>|z|) (Intercept)????????????????????????????????????????????? 52.3578?????????????? 1.3102??????????? 39.962???????? < 0.0000000000000002 *** pm252016aa???????????????????????????????????????? -0.1260???????????????? 0.1099?????????? -1.147??????????? 0.251212 race_1???????????????????????????????????????????????????? 1.0913????????????????? 0.7106???????? -1.536???????????? 0.124628 race_2???????????????????????????????????????????????????? -1.1787????????????????? 0.6870????????? 3.171???????????? 0.001518 ** prnt.empl?????????????????????????????????????????????? 2.8852????????????????? 0.4377??????????? 4.307??????????? 0.000016517 ** overall.income[>=100K]????????????????????? -1.8476???????????????? 0.3693????????? -5.003??????????? 0.000000566 *** overall.income[>=50K & <100K]??????? -0.8644??????????????? 0.3403???????????? -2.540??????????? 0.011078 * --- Signif. codes:? 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 Best, Hedyeh Ahmadi, Ph.D. Statistician Keck School of Medicine Department of Preventive Medicine University of Southern California Postdoctoral Scholar Institute for Interdisciplinary Salivary Bioscience Research (IISBR) University of California, Irvine LinkedIn https://urldefense.com/v3/__http://www.linkedin.com/in/hedyeh-ahmadi__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKVbeztxWs$
<https://urldefense.com/v3/__http://www.linkedin.com/in/hedyeh-ahmadi__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKVbeztxWs$> <https://urldefense.com/v3/__http://www.linkedin.com/in/hedyeh-ahmadi__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKVbeztxWs$
> <https://urldefense.com/v3/__http://www.linkedin.com/in/hedyeh-ahmadi__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKVbeztxWs$ ><https://urldefense.com/v3/__http://www.linkedin.com/in/hedyeh-ahmadi__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKVbeztxWs$ > ??????? [[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKV_JWfCpo$
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKV_JWfCpo$ <https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models__;!!LIr3w8kk_Xxm!_Hr0ANVe7S49QG8nq1EQIqnN8L6onW_Ej2H41C7LDOubwInvN-KOjzKV_JWfCpo$>