March 12, 2026
Goose Analysis or similartime spent vigilant (s) becomes t.vig_sCVS (Comma delimited) (*.csv)File > New Project... > then choose Existing DirectoryGoose Analysis) and select itFile > New File > R Scriptmy_analysis.R or whatever)To account for the fact that the individual video segments (observation times) vary somewhat, we
\(H_1:\) There is a correlation between time spent feeding and group size.
\(H_0:\) There is no correlation between time spent feeding and group size.
We’ll use package ggplot2. Simples:
You may feel the urge to add a regression line, which is easy enough:
Look at the data: it is pretty clear that if there is a relationship between feeding time and flock size, it is not a linear one.
There is no reason to assume a priori that the relationship would be linear:
Would you expect any net benefits of group living to increase linearly forever as group size increases? – Think ‘diminishing returns curves’ from the lectures!
It can’t – \(0 \leq time fraction \leq 1\)!
Fit a smooth regression using "loess" instead of "lm".
The span=1 bit just sets how bendy the line is allowed to be. Lower span means more wobbly (try it!).
feed.tf and flock.size.cor.test will carry out a Pearson’s correlation test. This assumes linearity!
Spearman's rank correlation rho
data: feed.tf and flock.size
S = 297.62, p-value = 0.006139
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.6352753
Strict Frequentist: reject \(H_0\) at \(\alpha = 0.05\) (‘significant’ correlation)
Strength of Evidence: the data provide good evidence that time investment in feeding increases with group size.
\(H_1:\) There is a correlation between vigilance time and group size.
\(H_0:\) There is no correlation between vigilance time and group size.
Let’s add both linear and smooth regression lines:
Spearman's rank correlation rho
data: vig.tf and flock.size
S = 1268.6, p-value = 0.02085
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
-0.5546251
Strict Frequentist: reject \(H_0\) at \(\alpha = 0.05\) (‘significant’ correlation).
Strength of Evidence: the data provide weak evidence that time investment in vigilance decreases with group size.
\(H_1:\) There is a correlation between head-up frequency and group size.
\(H_0:\) There is no correlation between head-up frequency and group size.
Let’s add the regression lines straight away
If anything, there is a very weak trend for head-ups to be more frequent in larger groups. Maybe they check more often, but only very briefly?
Spearman's rank correlation rho
data: hu.freq and flock.size
S = 621.37, p-value = 0.3566
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.2385211
Strict Frequentist: accept \(H_0\) at \(\alpha = 0.05\) (‘no significant’ correlation).
Strength of Evidence: the data provide no evidence that the frequency of head-up events correlates with group size.
We can easily calculate the mean bout length, because we know both
Spearman's rank correlation rho
data: mean.vbout.length and flock.size
S = 1146.9, p-value = 0.1064
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
-0.4054838
Curiously, this doesn’t come out significant at \(\alpha = 0.05\) – even though we have good evidence that total time vigilant is higher in small groups, and we found no support for claiming that the frequency of vigilance bouts depends on group size.
But we are power-limited… : our \(N\) is low, and rank-based tests have less power.
But be mindful that trying different tests until one comes out ‘significant’ is wrong-headed at best (if done naively), and fraudulent at worst.
Either way, it is known as p-hacking (google it…).
Pearson's product-moment correlation
data: log(mean.vbout.length) and log(flock.size)
t = -2.9325, df = 15, p-value = 0.01029
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.8404458 -0.1732788
sample estimates:
cor
-0.6036483
Suggests that the individual vigilance bouts are indeed shorter in larger groups.