2

Experiment Design

Mice belonging to knock-out ($n=7$) and wild-type ($n=6$) had their food intake recorded per hour across a 24 hour period. Within this 24 hour period, the first 12 hours is labelled as "light phase" while the remainder 12 hours is labelled as the "dark phase". Food-intake is considered a continuous data type.

My research question is to see within each dark and light phases whether there is a significant difference between knock-out and wild-type mice?

R code

I want to see if there is a difference between groups (i.e. knock-out vs wild-type) on the average food intake per hour (i.e. g/hour) within phases (i.e. light phase vs dark phase). I am graphing this as a cluster bar graph where phase type is on the x-axis and groups are the bar graphs.

model<-glm(food_intake~group*phase,data=df,family=Gamma(link=log))
s_test<-shapiro.test(residuals(model)) #Normality of residuals

if(s_test$p.value>=0.05){#if normal distribution stats<-Anova(model,type="II") em<-emmeans(model,~groupphase) p<-pairs(em,adjust="bonferroni") } else {#not normal distributed stats<-summary.glm(model)$coefficients em<-emmeans(model,~groupphase) p<-pairs(em,adjust="bonferroni") }

I want to ask whether this code is correct when conducting a post-hoc analysis using Bonferroni tests after testing for normality? From the pairwise comparison, I then use the p-values to show significance, if any, on a cluster bar graph (code not shown).

JLit98
  • 45
  • 1
    Gamma GLM residuals are not normally distributed anyways, so it is unclear to me why you need to test that? – user1848065 Nov 10 '23 at 03:22
  • I did it because ANOVA requires normal distribution of residuals, unless there is another way that i should test this? – JLit98 Nov 10 '23 at 03:45
  • 1
    The theoretical null distribution for the ANOVA test in the linear model case assumes that the distribution of the error terms are normally distributed. In general, if you are concerned about the Goodness of Fit for a GLM, there are many ways to do so. – user1848065 Nov 10 '23 at 05:33
  • 1
    Which assumptions do you think summary and emmeans make? You are doing the same in both cases (possibly using different contrasts). Normality tests are pretty much never a good idea either. If there are issues with model fit you should change the model, not the way you try to draw inference from it. – PBulls Nov 10 '23 at 06:04
  • 1
    (1.) Forget the normality test. Read this: https://cran.r-project.org/web/packages/DHARMa/vignettes/DHARMa.html (2.) Why do you want to use the Bonferroni correction? It is inferior to other adjustment methods. – Roland Nov 10 '23 at 07:44
  • @Roland I don't know if I agree Bonferroni is ALWAYS inferior to other adjustment methods but it is less powerful and in most use cases, I think people should prefer FDR or something else. FDR is definitely my preferred adjustment method over Bonferroni but I think there are use cases where Bonferroni could be appropriate over FDR, so I'm hesitant to agree with the premise that it's "inferior". Definitely is extremely conservative and usually inappropriate – JElder Nov 10 '23 at 15:00
  • I used bonferroni because it doesn't assume normal distribution and my datasets are usually never normally distributed. Maybe instead I should fit ANOVA on a linear model and not test for normality? i always thought to test assumptions before using two-way anova, otherwise, i would have kept using two-way ANOVA. – JLit98 Nov 12 '23 at 01:18
  • @JElder Holm (1979) should always be preferred over Bonferroni, unless there are didactic considerations. – Roland Nov 13 '23 at 08:03
  • @Roland Is it not the case that if you indeed want to control the familywise error rate, or the probability of making AT LEAST ONE false positive, then Bonferroni is appropriate? And if you want to control the proportion of false positives at 5% then you should use FDR? I generally discourage Bonferroni and encourage FDR/Holm, but if you want to guard against ANY false positives, it seems that is a boundary case in which Bonferroni is the best tool. What do you think? – JElder Nov 16 '23 at 13:58
  • @Roland https://stats.stackexchange.com/questions/242458/bonferonni-versus-fdr https://www.gs.washington.edu/academics/courses/akey/56008/lecture/lecture10.pdf – JElder Nov 16 '23 at 13:58
  • Let me cite the R documentation: "There seems no reason to use the unmodified Bonferroni correction because it is dominated by Holm's method, which is also valid under arbitrary assumptions." Both Bonferroni and Holm control the familywise error rate. – Roland Nov 17 '23 at 06:12

1 Answers1

0

I think there are multiple issues here. I don’t particularly see the point of the if else statement. You implemented a Gamma GLM so you can just do the emmeans posthoc comparison on the Gamma GLM object. It doesn’t seem there is any need to do a separate ANOVA for emmeans. emmeans and post hoc comparisons aren’t exclusive to an ANOVA, so just run it on GLM object.

Additionally, ANOVA/Linear Model assume normality of residuals/errors and you are doing a test for normality of the response/outcome. This also seems incoherent since in your original test it is a Gamma GLM so you seem to be assuming there that this is a Gamma distributed outcome, but then you subsequently do a test to see if what you previously tested as Gamma distributed is normally distributed which begs the question which is it then? If it’s Gamma distributed and you’re doing a Gamma GLM, no need to check if normally distributed.

Finally, it’s questionable whether a normality test is ever even useful. I wouldn’t recommend it. Rather than expanding on this point myself, may be better to read other literature and posts on topic: Is normality testing 'essentially useless'?

Finally, Bonferroni may be appropriate in some specific use cases but on average and in general when trying to implement multiple comparisons control, Bonferroni will be overly conservative and very low in power. Benjamini-Hochberg FDR procedure more powerful Bonferonni versus FDR

TL;DR:

  • Why Bonferroni? What is your error control goal?
  • Why a normality test if you’re doing Gamma GLM
  • Normality test not useful as assumption is for normality of residuals
  • Normality test is not useful in general anyways
  • Why is there a need for an ANOVA here anyways?
JElder
  • 919
  • Thank you @JElder , i did bonferroni because it doesnt require a normality. I usually use two-way ANOVA, however, after performing a shapiro_wilks() normality test, my dataset is not normally distributed so i though i can't use two-way Anova then. I also read that a linear model requires normality as well so i used a glm model with gamma distributed, as my data is continuous, positive and not normal distributed, as an alternative to two-way Anova. Then, perform a post-hoc test after to observe at which level the significance is occurring to plot the pvalue on my cluster bar graph. – JLit98 Nov 13 '23 at 02:13
  • @Jlit98 I have never heard of a multiple comparisons test requiring normality. Normality of what? Can you direct me to a source where you heard of specific multiple comparisons corrections "requiring normality of ___" and others not? Perhaps it is true and I am unaware but I'd like to understand what you're referring to. As far as I know, this is not an issue/criterion. – JElder Nov 16 '23 at 14:00
  • for instance, Tukey's test require normal distribution of means link Unless I am misinterpreting it – JLit98 Nov 16 '23 at 23:06
  • @JLit98 this appears to be describing assumptions for the ANOVA, not for multiple comparisons correction (i.e., Tukey) – JElder Nov 17 '23 at 02:46