Session Ready
Exercise

Bonferroni adjusted p-values

Just like Tukey's procedure, the Bonferroni correction is a method that is used to counteract the problem of inflated type I errors while engaging in multiple pairwise comparisons between subgroups. Bonferroni is generally known as the most conservative method to control the familywise error rate.

Bonferroni is based on the idea that if you test \(N\) dependent or independent hypotheses, one way of maintaining the familywise error rate is to test each individual hypothesis at a statistical significance level that is deflated by a factor of \(\frac{1}{n}\). So, for a significance level for the whole family of tests of \(\alpha\), the Bonferroni correction would be to test each of the individual tests at a significance level of \(\frac{\alpha}{n}\).

Enter the p.adjust() and pairwise.t.test() functions, which are structured like so:

p.adjust(<p-value>, method = <correction method>, 
         n = <# of hypotheses>)

pairwise.t.test(<dependent variable>, 
                <independent variable>, 
                p.adjust = <correction method>)
Instructions
100 XP
  • Suppose you have a p-value of 0.005 and there are eight pairwise comparisons. Use the p.adjust() function while applying the Bonferroni method to calculate the adjusted p-values. Be sure to specify the method and n arguments necessary to adjust the .005 value. Assign the result to bonferroni_ex.
  • Print the result to see how much the p-values are deflated to correct for the inflated type I errors of doing a multiple pairwise hypothesis test.
  • Make use of the pairwise.t.test() function to test the pairwise comparisons between your different conditions and include the Bonferroni correction in one single command. Do not forget to set the p.adjust argument in the pairwise.t.test() function to "bonferroni".