0
$\begingroup$

I have a database in which I'm comparing the habituation rates of crabs across a period of time. I have created a database containing the regression slope values for each individual. I have run an Anova comparing my slopes. However i am unsure of which post-hoc test to run (i believe a tukey-kramer), and how to code for that, as my sample sizes are uneven.
My database looks similar to this, but with much more datapoints:

Crab ID |Habitat    |Slope
----    |----       |----
4       |Bare       |0.003148946
7       |Bare       |0.004166906
11      |Bare       |0.019524323
13      |Bare       |0.02184341
3       |Complex    |0.128679071
6       |Complex    |0.066077077
9       |Complex    |0.02622547
12      |Complex    |0.012996901
15      |Complex    |0.021417606
18      |Complex    |0.028369676
21      |Complex    |0.03748329
24      |Complex    |0.053252884
5       |Simple     |0.016888439
8       |Simple     |0.002195244
17      |Simple     |0.007269998
23      |Simple     |0.029555186
35      |Simple     |0.004795072
38      |Simple     |0.034794577
41      |Simple     |0.029953562

regano <- aov(Slope ~ Habitat, data=reg)  
summary(regano)
$\endgroup$
1
$\begingroup$

Unequal sample sizes should be handled automatically by TukeyHSD, quoting

This function incorporates an adjustment for sample size that produces sensible intervals for mildly unbalanced designs.

Some code:

data <- "Crab ID |Habitat    |Slope
4       |Bare       |0.003148946
7       |Bare       |0.004166906
11      |Bare       |0.019524323
13      |Bare       |0.02184341
3       |Complex    |0.128679071
6       |Complex    |0.066077077
9       |Complex    |0.02622547
12      |Complex    |0.012996901
15      |Complex    |0.021417606
18      |Complex    |0.028369676
21      |Complex    |0.03748329
24      |Complex    |0.053252884
5       |Simple     |0.016888439
8       |Simple     |0.002195244
17      |Simple     |0.007269998
23      |Simple     |0.029555186
35      |Simple     |0.004795072
38      |Simple     |0.034794577
41      |Simple     |0.029953562"

library(data.table)
reg <- fread(data, sep="|")

regano <- aov(Slope ~ Habitat, data=reg)  

print(TukeyHSD(regano))
$\endgroup$
  • $\begingroup$ Agreed. However, the question is whether this is mildly unbalanced or not (I'm not sure I know in this case but the n for group 1 is half that of group 2). An alternative a pair-wise t-test with a pooled SD and a Bonferroni alpha correction: pairwise.t.test(reg$Slope, reg$Habitat, p.adj="bonf"). The results are null for both approaches. $\endgroup$ – dbwilson Jan 26 '19 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy