Intro lab 8 Multiple Groups

John Fieberg

Chi-squared

Is there an association between nest predation and how far an egg is dropped from the nest?

Distance Taken.by.predators Not.Taken.by.predators Total
15 cm 63 87 150
100 cm 48 102 150
200 cm 32 118 150
Total 143 307 450

\(H_0: p_{taken|15cm}= p_{taken|100cm}=p_{taken|200cm}\)

\(H_a:\) at least one of the proportions differs from the others.

ANOVA

For questions involving:

  • A quantitative variable +
  • A categorical variable (with potentially more than 2 categories)

With 2 categories, equivalent to a test for a difference in means.

GPS location errors

Photo showing different habitats where the colar tests were conducted.

\(H_0: \mu_{OpenField}=\mu_{EarlyBrush}=\mu_{HeavyBrush}=\mu_{PinePlantation}\)

\(H_a:\) at least one of the means differs from the others

Assumptions

  • Observations in each group are normally distributed (more critical for small sample sizes, watch out for clear skewness or extreme outliers)
  • Constant variance (or sd) within each group

How can we evaluate these assumptions?

  • Graphically (side-by-side boxplots, density plots overlaid by group)
  • SD rule (no group’s SD should be \(>\) 2SD of another group)

Multiple comparisons

If we reject the null hypothesis, we may want to know…

  • which of the means differ?

We have “4 choose 2” = 6 possible comparisons

  • Open field vs. early brush
  • Open field vs. heavy brush
  • Heavy brush vs. Pine Plantation

Multiple testing issue!

  • If each comparison has a \(\alpha\) = 0.05 type I error rate (reject \(H_o\) when the null hypothesis is true)
  • The probability of making at least 1 type I error is much higher!

If tests are independent:

P(make a type I error) = \(\alpha \Rightarrow\) P(not make a type I error) = \(1-\alpha\)

P(not make a type I error on \(m\) tests) = \((1-\alpha)^m\)

P(make a type I error on at least 1 of \(m\) tests) = \(1-(1-\alpha)^m\)

Overall type I error rate = probability of making one or more type I errors when conducting multiple tests.

In our case, overall type I error rate = 1-(1-0.05)\(^6\) = 0.26

Some things we can do to control the overall type I error rate:

  • Only do pairwise tests if the overall ANOVA indicates some difference exists.

  • Only do a few important comparisons.

  • Consider using a smaller \(\alpha\) for each pairwise test

Several procedures are available (e.g., Bonferroni correction and others that are more powerful)

  • See this link
  • You will explore using the emmeans package in this lab
  • Includes the following options: “tukey”, “scheffe”, “sidak”, “bonferroni”, “dunnettx”, “mvt”, and “none”.

Summarizing multiple comparisons

Screenshot of the published paper describing the multiple comparisons.

Mercury in Goldeneyes and Mergansers

Figure from the published paper showing the results of the multiple comparisons.

\(\overline{\mbox{Pre-DDT } 2003-2004}, 1981\)

Note: DDT was banned in the US in 1972

In general, groups can have more than 1 letter (and groups may have more than one bar overhead). Consider a study with:

  • 3 treatments for stress-reduction (mental, physical, medical)
  • leads to “3 choose 2” = 3 possible comparisons (choose(3,2) in R)
Figure showing the summary of multiple comparisons.

Stress reduction was greatest for mental, then physical, then medical treatment.

Mental (A) Physical (A,B) Medical (B)

\(\overline{Mental \overline{Physical}} \overline{Medical}\)