Data Processing

The first thing to do is to merge the size (weight) data into Avika’s dataset. This is in data_forage.

load('../data/data_forage.Rda')
kable(head(data_forage))
Population ID Sex Mom_ID Litter Treatment Pred_Tutor Pred Tutor_pop Birth.Day Day Date Time Water Weight Run Latency Attempts Notes Tutor event time2peck Predator
AH AHF2_1G4G.3.3 F AHF2_1G4G 3 pred-/same pred-/AH pred- AH 2-Feb 2 22-Mar 15:47 pred- 0.133 1 16 17 AH 1 16 pred-
AH AHF2_1G4G.3.3 F AHF2_1G4G 3 pred-/same pred-/AH pred- AH 2-Feb 1 21-Mar 15:06 pred+ 0.133 1 73 99 AH 1 73 pred-
AH AHF2_1G4G.6.2 F AHF2_1G4G 6 pred-/same pred-/AH pred- AH 14-Aug 1 29-Sep 15:17 pred- 0.144 1 35 166 first few in middle AH 1 35 pred-
AH AHF2_1G4G.6.2 F AHF2_1G4G 6 pred-/same pred-/AH pred- AH 14-Aug 2 30-Sep 15:06 pred+ 0.144 1 58 7 AH 1 58 pred-
AH AHF2_1G4P.2.1 F AHF2_1G4P 2 pred-/same pred-/AH pred- AH 15-Jan 1 2-Mar 15:30 pred+ 0.128 1 39 55 AH 1 39 pred-
AH AHF2_1G4P.2.1 F AHF2_1G4P 2 pred-/same pred-/AH pred- AH 15-Jan 2 3-Mar 16:04 pred- 0.128 1 310 72 AH 1 310 pred-

Avika’s data needs to be read.

data_move <- read.csv('../data_raw/Avika Video Analysis.csv')

data_move <- left_join(data_move, data_forage)

Now we can run the binomial models

No movement

model_still <- glmer(I(Unmoving/180) ~  Weight + Sex + Population + Water +
                       (1|ID), 
                     data = data_move,
                     family = binomial)

kable(summary(model_still)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.7246707 1.2975763 -0.5584803 0.5765165
Weight -8.1808092 10.0257658 -0.8159785 0.4145124
SexM -0.0867994 0.5339582 -0.1625584 0.8708661
PopulationAL 0.8128290 0.5065703 1.6045729 0.1085878
Waterpred+ 0.4266785 0.4847596 0.8801858 0.3787586

Low Activity (No movement or slow)

model_slow <- glmer(I((Slow+Unmoving)/180) ~  Weight + Sex + Population + Water
                    +(1|ID), 
                     data = data_move,
                     family = binomial)

kable(summary(model_slow)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.4652368 1.2716807 -1.9385659 0.0525542
Weight 11.2148840 9.5925935 1.1691191 0.2423557
SexM 0.6569701 0.5012864 1.3105684 0.1900036
PopulationAL 1.5514885 0.4702010 3.2996282 0.0009681
Waterpred+ 0.2375094 0.4589836 0.5174682 0.6048294

LP guppies spend a higher proportion of time with low activity than HP but predator water has no effect.

High Activity (Moderate or Fast Movement

model_fast <- glmer(I((Fast+Moderate)/180) ~  Weight + Sex + Population + Water +
                      (1|ID), 
                     data = data_move,
                     family = binomial)

kable(summary(model_fast)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.1474237 1.2518209 1.7154400 0.0862646
Weight -9.6915104 9.5165634 -1.0183834 0.3084958
SexM -0.6166941 0.4994182 -1.2348250 0.2168956
PopulationAL -1.4942384 0.4672070 -3.1982365 0.0013827
Waterpred+ -0.2094753 0.4593164 -0.4560588 0.6483477

HP guppies spend a higher proportion of time with high activity than LP but predator water has no effect.

GRAPHS

Low Activity

plot_still <- ggplot(data = data_move, 
                     aes(y = (Unmoving+Slow)/180, x = Water, group = Population)) +
  geom_jitter(aes(col = Population), width = 0.2)

plot_still

High Activity

plot_fast <- ggplot(data = data_move, 
                     aes(y = (Fast+Moderate)/180, x = Water, group = Population)) +
  geom_jitter(aes(col = Population), width = 0.2)

plot_fast
## Warning: Removed 1 rows containing missing values (geom_point).