0
$\begingroup$

I'm trying to find out if there's a significant difference between relative abundance (response variable: rel.abund) and habitat (predictor variable with levels lagoon, bank, shelf: Habitat).

This is my data set

pr_uneq_smme <- structure(list(run_number = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 
9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 
22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 
35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 
48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 
61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 
74L, 75L, 76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 
87L, 88L, 89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 
100L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 
14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 
27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 
40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 
53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 
66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 
79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 
92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L, 1L, 2L, 3L, 4L, 
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 
19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 
32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 
45L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 
58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 
71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 
84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 
97L, 98L, 99L, 100L), time_step = c(5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 
5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L, 5000L), Species = c("Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator", "Small mesopredator", 
"Small mesopredator", "Small mesopredator"), Habitat = c("lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", "lagoon", 
"lagoon", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "bank", "bank", "bank", 
"bank", "bank", "bank", "bank", "bank", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf", "shelf", 
"shelf", "shelf", "shelf", "shelf", "shelf", "shelf"), value = c(238L, 
270L, 226L, 258L, 275L, 285L, 297L, 260L, 267L, 267L, 264L, 267L, 
236L, 283L, 284L, 254L, 254L, 270L, 275L, 246L, 256L, 284L, 255L, 
271L, 262L, 244L, 240L, 263L, 261L, 264L, 259L, 276L, 289L, 256L, 
247L, 276L, 260L, 260L, 273L, 254L, 286L, 269L, 277L, 266L, 271L, 
263L, 279L, 251L, 274L, 261L, 255L, 279L, 263L, 249L, 270L, 266L, 
277L, 275L, 251L, 264L, 248L, 256L, 263L, 271L, 259L, 253L, 255L, 
255L, 258L, 282L, 281L, 283L, 311L, 250L, 250L, 258L, 264L, 286L, 
275L, 285L, 253L, 255L, 265L, 294L, 283L, 262L, 285L, 267L, 293L, 
265L, 293L, 263L, 272L, 269L, 279L, 241L, 261L, 263L, 247L, 276L, 
217L, 153L, 204L, 199L, 203L, 177L, 164L, 188L, 181L, 185L, 203L, 
192L, 208L, 194L, 199L, 188L, 198L, 205L, 180L, 207L, 219L, 178L, 
186L, 192L, 205L, 215L, 211L, 215L, 210L, 170L, 163L, 211L, 176L, 
208L, 167L, 167L, 188L, 191L, 165L, 185L, 199L, 169L, 203L, 193L, 
187L, 188L, 191L, 196L, 189L, 168L, 192L, 188L, 176L, 177L, 196L, 
198L, 176L, 179L, 185L, 209L, 212L, 185L, 177L, 168L, 183L, 196L, 
189L, 191L, 198L, 166L, 227L, 162L, 165L, 196L, 176L, 192L, 171L, 
175L, 207L, 178L, 218L, 200L, 192L, 192L, 186L, 178L, 203L, 194L, 
168L, 223L, 183L, 197L, 204L, 181L, 177L, 202L, 191L, 173L, 191L, 
209L, 169L, 201L, 176L, 153L, 145L, 182L, 157L, 163L, 174L, 176L, 
162L, 176L, 175L, 164L, 159L, 175L, 167L, 164L, 178L, 174L, 160L, 
156L, 190L, 165L, 156L, 151L, 175L, 158L, 157L, 174L, 184L, 144L, 
161L, 177L, 192L, 175L, 162L, 160L, 185L, 166L, 141L, 177L, 148L, 
156L, 156L, 161L, 151L, 166L, 149L, 177L, 176L, 173L, 185L, 192L, 
153L, 161L, 185L, 182L, 173L, 148L, 164L, 178L, 167L, 160L, 170L, 
178L, 180L, 154L, 157L, 164L, 139L, 162L, 166L, 171L, 195L, 170L, 
198L, 166L, 151L, 176L, 152L, 170L, 175L, 152L, 158L, 172L, 139L, 
153L, 162L, 122L, 161L, 154L, 136L, 157L, 160L, 174L, 167L, 180L, 
197L, 143L), PR = c("Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal", "Unequal", "Unequal", "Unequal", "Unequal", 
"Unequal", "Unequal"), total_predators = c(624L, 624L, 606L, 
610L, 623L, 644L, 618L, 611L, 622L, 628L, 629L, 635L, 619L, 641L, 
642L, 617L, 619L, 639L, 633L, 627L, 635L, 618L, 631L, 628L, 623L, 
610L, 626L, 636L, 628L, 608L, 606L, 631L, 626L, 641L, 606L, 618L, 
610L, 611L, 623L, 605L, 626L, 615L, 628L, 615L, 614L, 612L, 621L, 
613L, 612L, 606L, 623L, 640L, 624L, 618L, 619L, 625L, 638L, 636L, 
609L, 621L, 624L, 619L, 607L, 599L, 612L, 627L, 624L, 600L, 613L, 
612L, 647L, 607L, 642L, 617L, 621L, 620L, 633L, 627L, 633L, 639L, 
623L, 625L, 632L, 638L, 627L, 612L, 627L, 614L, 623L, 610L, 637L, 
614L, 612L, 607L, 616L, 617L, 619L, 616L, 635L, 628L, 624L, 624L, 
606L, 610L, 623L, 644L, 618L, 611L, 622L, 628L, 629L, 635L, 619L, 
641L, 642L, 617L, 619L, 639L, 633L, 627L, 635L, 618L, 631L, 628L, 
623L, 610L, 626L, 636L, 628L, 608L, 606L, 631L, 626L, 641L, 606L, 
618L, 610L, 611L, 623L, 605L, 626L, 615L, 628L, 615L, 614L, 612L, 
621L, 613L, 612L, 606L, 623L, 640L, 624L, 618L, 619L, 625L, 638L, 
636L, 609L, 621L, 624L, 619L, 607L, 599L, 612L, 627L, 624L, 600L, 
613L, 612L, 647L, 607L, 642L, 617L, 621L, 620L, 633L, 627L, 633L, 
639L, 623L, 625L, 632L, 638L, 627L, 612L, 627L, 614L, 623L, 610L, 
637L, 614L, 612L, 607L, 616L, 617L, 619L, 616L, 635L, 628L, 624L, 
624L, 606L, 610L, 623L, 644L, 618L, 611L, 622L, 628L, 629L, 635L, 
619L, 641L, 642L, 617L, 619L, 639L, 633L, 627L, 635L, 618L, 631L, 
628L, 623L, 610L, 626L, 636L, 628L, 608L, 606L, 631L, 626L, 641L, 
606L, 618L, 610L, 611L, 623L, 605L, 626L, 615L, 628L, 615L, 614L, 
612L, 621L, 613L, 612L, 606L, 623L, 640L, 624L, 618L, 619L, 625L, 
638L, 636L, 609L, 621L, 624L, 619L, 607L, 599L, 612L, 627L, 624L, 
600L, 613L, 612L, 647L, 607L, 642L, 617L, 621L, 620L, 633L, 627L, 
633L, 639L, 623L, 625L, 632L, 638L, 627L, 612L, 627L, 614L, 623L, 
610L, 637L, 614L, 612L, 607L, 616L, 617L, 619L, 616L, 635L, 628L
), rel.abund = c(38.1410256410256, 43.2692307692308, 37.2937293729373, 
42.2950819672131, 44.1412520064205, 44.2546583850932, 48.0582524271845, 
42.5531914893617, 42.9260450160772, 42.515923566879, 41.9713831478537, 
42.0472440944882, 38.1260096930533, 44.1497659906396, 44.2367601246106, 
41.1669367909238, 41.0339256865913, 42.2535211267606, 43.4439178515008, 
39.2344497607655, 40.3149606299213, 45.9546925566343, 40.4120443740095, 
43.1528662420382, 42.0545746388443, 40, 38.3386581469649, 41.3522012578616, 
41.5605095541401, 43.421052631579, 42.7392739273927, 43.7400950871632, 
46.1661341853035, 39.9375975039002, 40.7590759075908, 44.6601941747573, 
42.6229508196721, 42.5531914893617, 43.8202247191011, 41.9834710743802, 
45.6869009584665, 43.739837398374, 44.1082802547771, 43.2520325203252, 
44.1368078175896, 42.9738562091503, 44.9275362318841, 40.9461663947798, 
44.7712418300654, 43.0693069306931, 40.9309791332263, 43.59375, 
42.1474358974359, 40.2912621359223, 43.6187399030695, 42.56, 
43.4169278996865, 43.2389937106918, 41.2151067323481, 42.512077294686, 
39.7435897435897, 41.3570274636511, 43.32784184514, 45.2420701168614, 
42.3202614379085, 40.3508771929825, 40.8653846153846, 42.5, 42.0880913539967, 
46.078431372549, 43.4312210200927, 46.6227347611203, 48.4423676012461, 
40.5186385737439, 40.2576489533011, 41.6129032258065, 41.7061611374408, 
45.6140350877193, 43.4439178515008, 44.6009389671362, 40.6099518459069, 
40.8, 41.9303797468354, 46.0815047021944, 45.1355661881978, 42.8104575163399, 
45.4545454545455, 43.485342019544, 47.0304975922953, 43.4426229508197, 
45.9968602825746, 42.8338762214984, 44.4444444444444, 44.3163097199341, 
45.2922077922078, 39.0599675850891, 42.1647819063005, 42.6948051948052, 
38.8976377952756, 43.9490445859873, 34.775641025641, 24.5192307692308, 
33.6633663366337, 32.6229508196721, 32.5842696629214, 27.4844720496894, 
26.537216828479, 30.7692307692308, 29.0996784565916, 29.4585987261146, 
32.2734499205087, 30.2362204724409, 33.6025848142165, 30.2652106084243, 
30.9968847352025, 30.4700162074554, 31.9870759289176, 32.0813771517997, 
28.436018957346, 33.0143540669856, 34.488188976378, 28.8025889967638, 
29.4770206022187, 30.5732484076433, 32.9052969502408, 35.2459016393443, 
33.7060702875399, 33.8050314465409, 33.4394904458599, 27.9605263157895, 
26.8976897689769, 33.4389857369255, 28.1150159744409, 32.4492979719189, 
27.5577557755776, 27.0226537216829, 30.8196721311475, 31.2602291325696, 
26.4847512038523, 30.5785123966942, 31.7891373801917, 27.479674796748, 
32.3248407643312, 31.3821138211382, 30.4560260586319, 30.718954248366, 
30.7568438003221, 31.973898858075, 30.8823529411765, 27.7227722772277, 
30.8186195826645, 29.375, 28.2051282051282, 28.6407766990291, 
31.6639741518578, 31.68, 27.5862068965517, 28.1446540880503, 
30.3776683087028, 33.6553945249597, 33.974358974359, 29.8869143780291, 
29.159802306425, 28.0467445742905, 29.9019607843137, 31.2599681020734, 
30.2884615384615, 31.8333333333333, 32.300163132137, 27.1241830065359, 
35.0850077279753, 26.6886326194399, 25.7009345794392, 31.7666126418152, 
28.341384863124, 30.9677419354839, 27.0142180094787, 27.9106858054226, 
32.7014218009479, 27.8560250391236, 34.991974317817, 32, 30.379746835443, 
30.0940438871473, 29.6650717703349, 29.0849673202614, 32.3763955342903, 
31.5960912052117, 26.9662921348315, 36.5573770491803, 28.7284144427002, 
32.0846905537459, 33.3333333333333, 29.8187808896211, 28.7337662337662, 
32.7390599675851, 30.8562197092084, 28.0844155844156, 30.0787401574803, 
33.2802547770701, 27.0833333333333, 32.2115384615385, 29.042904290429, 
25.0819672131148, 23.2744783306581, 28.2608695652174, 25.4045307443366, 
26.6775777414075, 27.9742765273312, 28.0254777070064, 25.7551669316375, 
27.7165354330709, 28.2714054927302, 25.585023400936, 24.7663551401869, 
28.3630470016207, 26.9789983844911, 25.6651017214397, 28.1200631911532, 
27.7511961722488, 25.1968503937008, 25.2427184466019, 30.1109350237718, 
26.2738853503185, 25.0401284109149, 24.7540983606557, 27.9552715654952, 
24.8427672955975, 25, 28.6184210526316, 30.3630363036304, 22.8209191759113, 
25.7188498402556, 27.613104524181, 31.6831683168317, 28.3171521035599, 
26.5573770491803, 26.1865793780687, 29.6950240770466, 27.4380165289256, 
22.5239616613419, 28.780487804878, 23.5668789808917, 25.3658536585366, 
25.4071661237785, 26.3071895424837, 24.3156199677939, 27.0799347471452, 
24.3464052287582, 29.2079207920792, 28.2504012841091, 27.03125, 
29.6474358974359, 31.0679611650485, 24.7172859450727, 25.76, 
28.9968652037618, 28.6163522012579, 28.4072249589491, 23.8325281803543, 
26.2820512820513, 28.7560581583199, 27.5123558484349, 26.7111853088481, 
27.7777777777778, 28.3891547049442, 28.8461538461538, 25.6666666666667, 
25.6117455138662, 26.797385620915, 21.483771251932, 26.6886326194399, 
25.8566978193146, 27.7147487844408, 31.4009661835749, 27.4193548387097, 
31.2796208530806, 26.4752791068581, 23.8546603475513, 27.5430359937402, 
24.3980738362761, 27.2, 27.6898734177215, 23.8244514106583, 25.1993620414673, 
28.1045751633987, 22.1690590111643, 24.9185667752443, 26.0032102728732, 
20, 25.2747252747253, 25.0814332247557, 22.2222222222222, 25.8649093904448, 
25.974025974026, 28.2009724473258, 26.9789983844911, 29.2207792207792, 
31.0236220472441, 22.7707006369427)), row.names = c(NA, -300L
), class = "data.frame")

whose first 6 rows look like this

  run_number time_step            Species Habitat value      PR total_predators rel.abund
1          1      5000 Small mesopredator  lagoon   238 Unequal             624  38.14103
2          2      5000 Small mesopredator  lagoon   270 Unequal             624  43.26923
3          3      5000 Small mesopredator  lagoon   226 Unequal             606  37.29373
4          4      5000 Small mesopredator  lagoon   258 Unequal             610  42.29508
5          5      5000 Small mesopredator  lagoon   275 Unequal             623  44.14125
6          6      5000 Small mesopredator  lagoon   285 Unequal             644  44.25466

I first visualized the data using a boxplot

boxplot(rel.abund~Habitat, data = pr_uneq_smme)

I then ran a 1-way anova as follows

res.aov <- aov(rel.abund ~ Habitat, data = pr_uneq_smme)
summary(res.aov)

The anova comes back with a significant p-value, so i then run a TukeyHSD

To my surprise, this test comes back with significant p-values for each factor-level combination, seemingly contradicting the boxplot (ie the boxplox shows overlapping SDs for the bank and shelf habitats).

I evaluated model assumptions for running this 1-way anova, but these seem to be honored by my data

# 1. Homogeneity of variances
plot(res.aov, 1)

library(car); leveneTest(resid(res.aov)~Habitat, data = pr_uneq_smme) # p = 0.31: fine

# Bartlett's test
bartlett.test(resid(res.aov)~Habitat, data = pr_uneq_smme) # p = 0.51: fine

### Check the normality assumption
plot(res.aov, 2)

# Extract the residuals
aov_residuals <- residuals(object = res.aov )
# Run Shapiro-Wilk test
shapiro.test(x = aov_residuals)

So, my question is can I trust this analysis? Or did I go wrong somewhere?

$\endgroup$
3
  • 5
    $\begingroup$ There might be some misconception about boxplots implicit here. (1) Boxplots usually don't display CIs (and when they do it's an additional graphical feature shown as a "notch"). (2) Overlaps of CIs are not appropriate statistical tests unless properly adjusted. $\endgroup$
    – whuber
    Commented Jun 27, 2023 at 19:58
  • $\begingroup$ @whuber Sorry I meant standard deviations. $\endgroup$ Commented Jun 28, 2023 at 1:48
  • $\begingroup$ You can't use SDs to assess the significance of differences, either, because they do not account for the sample sizes. Since a CI width typically is proportional (at least approximately) to the SD divided by the root group size, in the boxplots you have added to this post, where there is no overlap among any of the middles (the "boxes"), it's immediately clear that all pairwise differences are significant provided the group sizes are larger than 5 or so. $\endgroup$
    – whuber
    Commented Jun 28, 2023 at 13:09

1 Answer 1

4
$\begingroup$

Overlapping boxplots do not imply that there is no statistically significant difference between the two groups. You have 100 individuals per group, so your group means are estimated quite accurately, and a test will have high power.

In this particular case, the two groups that have overlapping boxplot are habitats shelf and bank, with a difference of group means slightly less than 4.0, and estimated standard deviations slightly less than 2.5. If you wanted to detect differences of this magnitude in 99% of such cases, using a test with $\alpha = 0.05$, you would only need a sample size of $n=16$ - you have far more :-)

> power.t.test(delta = 4, sd = 2.5, sig.level = 0.05, power = 0.99)

     Two-sample t test power calculation 

              n = 15.39226
          delta = 4
             sd = 2.5
      sig.level = 0.05
          power = 0.99
    alternative = two.sided

NOTE: n is number in *each* group
```
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.