Input Data
brood <- read_csv("brood.csv")
brood$colony <- as.factor(brood$colony)
brood$treatment <- as.factor(brood$treatment)
brood$block <- as.factor(brood$replicate)
pollen <- read_csv("pollen.csv")
pollen$colony <- as.factor(pollen$colony)
pollen$treatment <- as.factor(pollen$treatment)
pollen$block <- as.factor(pollen$block)
workers <- read_csv("workers.csv")
workers$colony <- as.factor(workers$colony)
workers$treatment <- as.factor(workers$treatment)
workers$block <- as.factor(workers$block)
workers$qro <- as.factor(workers$qro)
workers$inoculate <- as.logical(workers$inoculate)
duration <- read_csv("duration.csv")
duration$treatment <- as.factor(duration$treatment)
duration$block <- as.factor(duration$block)
duration$colony <- as.factor(duration$colony)
duration$qro <- as.factor(duration$qro)
drones <- read_csv("drones.csv")
drones$treatment <- as.factor(drones$treatment)
drones$block <- as.factor(drones$block)
drones$colony <- as.factor(drones$colony)
drones$id <- as.factor(drones$id)
drones$abdomen_post_ethyl <- as.numeric(drones$abdomen_post_ethyl)
drones_rf <- read_csv("drones_rf.csv")
drones_rf$treatment <- as.factor(drones_rf$treatment)
drones_rf$block <- as.factor(drones_rf$block)
drones_rf$colony <- as.factor(drones_rf$colony)
drones_rf$id <- as.factor(drones_rf$id)
drones_rf$abdomen_post_ethyl <- as.numeric(drones_rf$abdomen_post_ethyl)
qro <- read_csv("qro.csv")
qro$colony <- as.factor(qro$colony)
qro$qro <- as.factor(qro$qro)
qro$fungicide <- as.logical(qro$fungicide)
qro$crithidia <- as.logical(qro$crithidia)
qro_simple <- qro[c('colony', 'qro', 'fungicide', 'crithidia')]
qro_pol <- qro[c('colony', 'qro')]
pollen <- merge(pollen, qro_pol, by = "colony", all = FALSE)
brood1 <- merge(brood, duration, by = "colony", all = FALSE)
custom_labels <- c("Control", "Fungicide", "Fungicide + Crithidia", "Crithidia")
avg.pol <- pollen %>%
group_by(colony) %>%
summarise(avg.pol = mean(whole_dif))
duration <- merge(duration, avg.pol, by = "colony", all = FALSE)
new_dataframe <- duration[c('colony', 'days_active')]
brood <- merge(qro_simple, brood, by = "colony", all = FALSE)
workers <- merge(new_dataframe, workers, by = "colony", all = FALSE)
all_bees <- read_csv("qpcr_inoc_bees.csv", col_types = cols(treatment = col_factor(levels = c("1",
"2", "3", "4")), replicate = col_factor(levels = c("1",
"4", "6", "7", "8", "9", "10", "11",
"12")), start = col_date(format = "%m/%d/%Y"),
Innoculation_date = col_date(format = "%m/%d/%Y"),
date = col_date(format = "%m/%d/%Y"), censor_status = col_factor(levels = c("1","2"))))
all_bees$colony <- as.factor(all_bees$colony)
all_bees$bee_id <- as.factor(all_bees$bee_id)
workers_for_qpcr_merge <- read_csv("workers_for qpcr merge.csv",
col_types = cols(fungicide = col_logical(),
crithidia = col_logical(), inoculate_round = col_factor(levels = c("1",
"2", "3")), inoculate = col_logical(),
premature_death = col_logical(),
`end date` = col_date(format = "%m/%d/%Y")))
start_dates <- read_csv("start dates.csv")
treatments <- read_csv("treatments.csv")
all_bees <- merge(all_bees, treatments, by = "colony", all = FALSE)
Collinearity
# brood cells
brood.col <- lm(brood_cells~ treatment.x + block.x + workers_alive.x + qro + days_active + avg_pollen, data = brood1)
Anova(brood.col)
## Anova Table (Type II tests)
##
## Response: brood_cells
## Sum Sq Df F value Pr(>F)
## treatment.x 246.44 3 2.4069 0.09587 .
## block.x 30.00 4 0.2198 0.92439
## workers_alive.x 205.77 1 6.0293 0.02287 *
## qro 0
## days_active 0.27 1 0.0081 0.92934
## avg_pollen 1646.55 1 48.2453 7.336e-07 ***
## Residuals 716.70 21
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(brood.col, test = "Chisq")
## Single term deletions
##
## Model:
## brood_cells ~ treatment.x + block.x + workers_alive.x + qro +
## days_active + avg_pollen
## Df Sum of Sq RSS AIC Pr(>Chi)
## <none> 716.70 137.68
## treatment.x 3 246.44 963.14 142.32 0.013845 *
## block.x 4 30.00 746.71 131.16 0.830804
## workers_alive.x 1 205.77 922.47 144.77 0.002575 **
## qro 0 0.00 716.70 137.68
## days_active 1 0.27 716.98 135.69 0.906469
## avg_pollen 1 1646.55 2363.25 178.63 5.608e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
b1 <- update(brood.col, .~. -qro)
vif(b1)
## GVIF Df GVIF^(1/(2*Df))
## treatment.x 1.499238 3 1.069823
## block.x 8.025087 8 1.139011
## workers_alive.x 3.569032 1 1.889188
## days_active 2.843844 1 1.686370
## avg_pollen 5.848885 1 2.418447
b2 <- update(b1, .~. -block.x)
anova(brood.col, b1, b2)
## Analysis of Variance Table
##
## Model 1: brood_cells ~ treatment.x + block.x + workers_alive.x + qro +
## days_active + avg_pollen
## Model 2: brood_cells ~ treatment.x + block.x + workers_alive.x + days_active +
## avg_pollen
## Model 3: brood_cells ~ treatment.x + workers_alive.x + days_active + avg_pollen
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 21 716.7
## 2 21 716.7 0 0.0
## 3 29 2481.2 -8 -1764.5 6.4627 0.0002814 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(b1, b2)
## df AIC
## b1 16 241.8446
## b2 8 270.5508
vif(b2)
## GVIF Df GVIF^(1/(2*Df))
## treatment.x 1.249684 3 1.037847
## workers_alive.x 2.319573 1 1.523015
## days_active 1.609306 1 1.268584
## avg_pollen 2.131195 1 1.459861
drop1(b2, test = "Chisq")
## Single term deletions
##
## Model:
## brood_cells ~ treatment.x + workers_alive.x + days_active + avg_pollen
## Df Sum of Sq RSS AIC Pr(>Chi)
## <none> 2481.2 166.39
## treatment.x 3 329.0 2810.2 164.87 0.21389
## workers_alive.x 1 232.0 2713.2 167.60 0.07282 .
## days_active 1 347.1 2828.3 169.10 0.02993 *
## avg_pollen 1 7456.1 9937.3 214.34 1.576e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(b1, b2)
## Analysis of Variance Table
##
## Model 1: brood_cells ~ treatment.x + block.x + workers_alive.x + days_active +
## avg_pollen
## Model 2: brood_cells ~ treatment.x + workers_alive.x + days_active + avg_pollen
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 21 716.7
## 2 29 2481.2 -8 -1764.5 6.4627 0.0002814 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(b1, brood.col)
## Analysis of Variance Table
##
## Model 1: brood_cells ~ treatment.x + block.x + workers_alive.x + days_active +
## avg_pollen
## Model 2: brood_cells ~ treatment.x + block.x + workers_alive.x + qro +
## days_active + avg_pollen
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 21 716.7
## 2 21 716.7 0 0
drop1(b1, test = "Chisq")
## Single term deletions
##
## Model:
## brood_cells ~ treatment.x + block.x + workers_alive.x + days_active +
## avg_pollen
## Df Sum of Sq RSS AIC Pr(>Chi)
## <none> 716.70 137.68
## treatment.x 3 246.44 963.14 142.32 0.013845 *
## block.x 8 1764.50 2481.20 166.39 4.183e-07 ***
## workers_alive.x 1 205.77 922.47 144.77 0.002575 **
## days_active 1 0.27 716.98 135.69 0.906469
## avg_pollen 1 1646.55 2363.25 178.63 5.608e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
b2 <- update(b1, .~. -days_active)
vif(b2)
## GVIF Df GVIF^(1/(2*Df))
## treatment.x 1.362270 3 1.052876
## block.x 4.541324 8 1.099193
## workers_alive.x 3.361139 1 1.833341
## avg_pollen 5.615940 1 2.369797
AIC(b1, b2)
## df AIC
## b1 16 241.8446
## b2 15 239.8584
anova(b1, b2)
## Analysis of Variance Table
##
## Model 1: brood_cells ~ treatment.x + block.x + workers_alive.x + days_active +
## avg_pollen
## Model 2: brood_cells ~ treatment.x + block.x + workers_alive.x + avg_pollen
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 21 716.70
## 2 22 716.98 -1 -0.27488 0.0081 0.9293
drop1(b2, test = "Chisq")
## Single term deletions
##
## Model:
## brood_cells ~ treatment.x + block.x + workers_alive.x + avg_pollen
## Df Sum of Sq RSS AIC Pr(>Chi)
## <none> 716.98 135.69
## treatment.x 3 246.29 963.26 140.32 0.013902 *
## block.x 8 2111.28 2828.26 169.10 5.316e-08 ***
## workers_alive.x 1 222.37 939.35 143.42 0.001818 **
## avg_pollen 1 1723.70 2440.67 177.79 3.121e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#don't include qro
Average pollen consumed per colony
pol_consum_sum <- pollen %>%
group_by(colony) %>%
summarise(mean.pollen = mean(whole_dif))
pol_consum_sum <- as.data.frame(pol_consum_sum)
workers <- merge(workers, pol_consum_sum, by = "colony", all = FALSE)
#brood <- merge(brood, pol_consum_sum, by = "colony", all = FALSE)
duration <- merge(duration, pol_consum_sum, by = "colony", all = FALSE)
all_bees <- merge(all_bees, pol_consum_sum, by="colony", all = FALSE)
#drones <- na.omit(drones)
#brood <- na.omit(brood)
pollen$days <- pollen$`pollen ball id`
new pollen csv
p <- read_csv("pollen.dates.csv",
col_types = cols(treatment = col_factor(levels = c("1",
"2", "3", "4")), pollen.start = col_date(format = "%m/%d/%Y"),
pollen.end = col_date(format = "%m/%d/%Y"),
colony.start = col_date(format = "%m/%d/%Y")))
p$colony <- as.factor(p$colony)
p <- p %>%
mutate(
fungicide = factor(fungicide),
crithidia = factor(crithidia),
block = factor(block),
qro = factor(qro),
id = factor(id)
)
shapiro.test(p$whole_dif)
##
## Shapiro-Wilk normality test
##
## data: p$whole_dif
## W = 0.76908, p-value < 2.2e-16
hist(p$whole_dif)

p$box <- bcPower(p$whole_dif, -3, gamma=1.1)
shapiro.test(p$box)
##
## Shapiro-Wilk normality test
##
## data: p$box
## W = 0.92686, p-value < 2.2e-16
hist(p$box)

p$log <- log(p$whole_dif)
shapiro.test(p$log)
##
## Shapiro-Wilk normality test
##
## data: p$log
## W = 0.9363, p-value < 2.2e-16
hist(p$log)

pol.mod1 <- lmer(box ~ crithidia + fungicide + pollen.time + workers_alive + block + (1|colony), data = p)
pol.mod.int <- lmer(box ~ crithidia*pollen.time + fungicide + workers_alive + block + (1|colony), data = p)
drop1(pol.mod.int, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ crithidia * pollen.time + fungicide + workers_alive + block +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -3283.7
## fungicide 1 -3283.7 1.994 0.157912
## workers_alive 1 -3201.3 84.434 < 2.2e-16 ***
## block 8 -3261.7 38.048 7.376e-06 ***
## crithidia:pollen.time 1 -3277.0 8.699 0.003183 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(pol.mod1)
## Single term deletions
##
## Model:
## box ~ crithidia + fungicide + pollen.time + workers_alive + block +
## (1 | colony)
## npar AIC
## <none> -3277.0
## crithidia 1 -3274.7
## fungicide 1 -3277.0
## pollen.time 1 -3007.8
## workers_alive 1 -3184.7
## block 8 -3254.8
Anova(pol.mod1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: box
## Chisq Df Pr(>Chisq)
## crithidia 3.1483 1 0.07601 .
## fungicide 1.4167 1 0.23395
## pollen.time 322.3806 1 < 2.2e-16 ***
## workers_alive 96.6335 1 < 2.2e-16 ***
## block 47.2314 8 1.385e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(pol.mod1, pol.mod.int)
## Data: p
## Models:
## pol.mod1: box ~ crithidia + fungicide + pollen.time + workers_alive + block + (1 | colony)
## pol.mod.int: box ~ crithidia * pollen.time + fungicide + workers_alive + block + (1 | colony)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## pol.mod1 15 -3277.0 -3208.0 1653.5 -3307.0
## pol.mod.int 16 -3283.7 -3210.1 1657.8 -3315.7 8.6993 1 0.003183 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(pol.mod1, pol.mod.int)
## df AIC
## pol.mod1 15 -3164.936
## pol.mod.int 16 -3156.017
drop1(pol.mod1, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ crithidia + fungicide + pollen.time + workers_alive + block +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -3277.0
## crithidia 1 -3274.7 4.280 0.03856 *
## fungicide 1 -3277.0 1.989 0.15847
## pollen.time 1 -3007.8 271.190 < 2.2e-16 ***
## workers_alive 1 -3184.7 94.341 < 2.2e-16 ***
## block 8 -3254.8 38.246 6.781e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(pol.mod1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: box
## Chisq Df Pr(>Chisq)
## crithidia 3.1483 1 0.07601 .
## fungicide 1.4167 1 0.23395
## pollen.time 322.3806 1 < 2.2e-16 ***
## workers_alive 96.6335 1 < 2.2e-16 ***
## block 47.2314 8 1.385e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(pol.mod1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: box ~ crithidia + fungicide + pollen.time + workers_alive + block +
## (1 | colony)
## Data: p
##
## REML criterion at convergence: -3194.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.73866 -0.62142 -0.01707 0.61692 2.80644
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 0.0004090 0.02022
## Residual 0.0005754 0.02399
## Number of obs: 733, groups: colony, 35
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 1.201e-01 1.447e-02 8.298
## crithidiaTRUE -1.266e-02 7.135e-03 -1.774
## fungicideTRUE -8.462e-03 7.110e-03 -1.190
## pollen.time 1.606e-03 8.944e-05 17.955
## workers_alive 1.473e-02 1.498e-03 9.830
## block4 5.313e-02 1.480e-02 3.590
## block6 -3.596e-02 1.475e-02 -2.437
## block7 1.160e-02 1.481e-02 0.783
## block8 1.948e-02 1.478e-02 1.318
## block9 7.993e-03 1.478e-02 0.541
## block10 3.679e-02 1.606e-02 2.291
## block11 -1.202e-02 1.480e-02 -0.813
## block12 8.685e-03 1.477e-02 0.588
qqnorm(resid(pol.mod1));qqline(resid(pol.mod1))

Anova(pol.mod1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: box
## Chisq Df Pr(>Chisq)
## crithidia 3.1483 1 0.07601 .
## fungicide 1.4167 1 0.23395
## pollen.time 322.3806 1 < 2.2e-16 ***
## workers_alive 96.6335 1 < 2.2e-16 ***
## block 47.2314 8 1.385e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
residuals <- resid(pol.mod1)
plot(residuals)

ps <- p[p$days >= 4 & p$days <=25, ]
range(ps$pollen.time)
## [1] 6 48
shapiro.test(ps$log)
##
## Shapiro-Wilk normality test
##
## data: ps$log
## W = 0.93269, p-value < 2.2e-16
hist(ps$log)

ps1 <- lmer(whole_dif ~ crithidia + fungicide + days + workers_alive + block + (1|colony), data = ps)
Anova(ps1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: whole_dif
## Chisq Df Pr(>Chisq)
## crithidia 2.9151 1 0.08775 .
## fungicide 1.0140 1 0.31394
## days 166.7600 1 < 2.2e-16 ***
## workers_alive 57.9176 1 2.733e-14 ***
## block 45.9379 8 2.443e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pe <- emmeans(ps1, pairwise ~ crithidia, type = "response")
pe
## $emmeans
## crithidia emmean SE df lower.CL upper.CL
## FALSE 0.475 0.0346 24.3 0.404 0.547
## TRUE 0.390 0.0359 24.0 0.316 0.464
##
## Results are averaged over the levels of: fungicide, block
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## FALSE - TRUE 0.0855 0.0501 24.4 1.707 0.1004
##
## Results are averaged over the levels of: fungicide, block
## Degrees-of-freedom method: kenward-roger
qqnorm(resid(ps1));qqline(resid(ps1))

ps_sum <- ps %>%
group_by(treatment) %>%
summarise(mean = mean(whole_dif),
sd = sd(whole_dif),
n = length(whole_dif)) %>%
mutate(se = sd/sqrt(n))
ps_sum
## # A tibble: 4 × 5
## treatment mean sd n se
## <fct> <dbl> <dbl> <int> <dbl>
## 1 1 0.514 0.341 167 0.0264
## 2 2 0.442 0.322 170 0.0247
## 3 3 0.337 0.257 177 0.0193
## 4 4 0.363 0.270 149 0.0221
ggplot(data = p, aes(x = pollen.time, y = whole_dif, fill = treatment)) +
geom_smooth() +
labs(x = "Time", y = "Mean Pollen Consumed (g)") +
theme_cowplot()+
scale_x_continuous(breaks = seq(min(p$pollen.time), max(ps$pollen.time), by = 1))

ggplot(data = ps_sum, aes(x = treatment, y = mean, fill = treatment)) +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0.4, 0), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 0.65)) +
geom_errorbar(aes(ymin = mean - se, ymax = mean + se), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Average Pollen Consumed (g)") +
annotate(
geom = "text",
x = 3,
y = 0.6,
label = "P = 0.05",
size = 8
) +
theme_classic(base_size = 20) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_manual(values = c("none", "none", "stripe", "none")) + # Add stripes to the fourth column
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none") +
geom_segment(x = 1, xend = 2, y = 0.65, yend = 0.65,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 1, y = 0.64, yend = 0.66,
lineend = "round", linejoin = "round") +
geom_segment(x = 2, xend = 2, y = 0.64, yend = 0.66,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 4, y = 0.47, yend = 0.47,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 3, y = 0.46, yend = 0.48,
lineend = "round", linejoin = "round") +
geom_segment(x = 4, xend = 4, y = 0.46, yend = 0.48,
lineend = "round", linejoin = "round") +
geom_text(x = 1.5, y = 0.65, label = "a", size = 6, vjust = -0.5) +
geom_text(x = 3.5, y = 0.48, label = "b", size = 6, vjust = -0.5)

Pollen Consumption
shapiro.test(pollen$whole_dif)
##
## Shapiro-Wilk normality test
##
## data: pollen$whole_dif
## W = 0.77483, p-value < 2.2e-16
hist(pollen$whole_dif)

range(pollen$whole_dif)
## [1] 0.03316 1.39545
pollen$box <- bcPower(pollen$whole_dif, -5, gamma=1)
shapiro.test(pollen$box)
##
## Shapiro-Wilk normality test
##
## data: pollen$box
## W = 0.95648, p-value = 3.679e-14
hist(pollen$box)

pollen$log <- log(pollen$whole_dif)
shapiro.test(pollen$log)
##
## Shapiro-Wilk normality test
##
## data: pollen$log
## W = 0.93499, p-value < 2.2e-16
hist(pollen$log)

pollen$square <- pollen$whole_dif^2
shapiro.test(pollen$square)
##
## Shapiro-Wilk normality test
##
## data: pollen$square
## W = 0.62065, p-value < 2.2e-16
hist(pollen$square)

pollen$root <- sqrt(pollen$whole_dif)
shapiro.test(pollen$root)
##
## Shapiro-Wilk normality test
##
## data: pollen$root
## W = 0.86233, p-value < 2.2e-16
hist(pollen$root)

descdist(pollen$whole_dif, discrete = FALSE)

## summary statistics
## ------
## min: 0.03316 max: 1.39545
## median: 0.27686
## mean: 0.4042769
## estimated sd: 0.3016975
## estimated skewness: 1.532669
## estimated kurtosis: 4.289505
ggplot(pollen, aes(x = log, fill = treatment)) +
geom_histogram(position = "identity", binwidth = 0.1, col = I("black")) +
scale_fill_viridis_d() + # Use viridis_d() for the color-blind friendly palette
ggtitle("Pollen Consumption(g)") +
labs(y = "Count", x = "Pollen (g)")

pol.mod <- lmer(box ~ fungicide*crithidia + block + days + workers_alive + (1|colony), data = pollen)
drop1(pol.mod, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ fungicide * crithidia + block + days + workers_alive +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -3905.8
## block 8 -3881.2 40.572 2.506e-06 ***
## days 1 -3658.3 249.500 < 2.2e-16 ***
## workers_alive 1 -3833.8 74.012 < 2.2e-16 ***
## fungicide:crithidia 1 -3907.7 0.073 0.7876
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pm1 <- update(pol.mod, .~. -days)
drop1(pm1, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ fungicide + crithidia + block + workers_alive + (1 | colony) +
## fungicide:crithidia
## npar AIC LRT Pr(Chi)
## <none> -3658.3
## block 8 -3641.0 33.257 5.534e-05 ***
## workers_alive 1 -3656.2 4.128 0.04218 *
## fungicide:crithidia 1 -3660.3 0.033 0.85554
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pol.mod1 <- lmer(box ~ crithidia + fungicide + days + workers_alive + block + (1|colony), data = pollen)
pol.mod.int <- lmer(box ~ crithidia*days + fungicide + workers_alive + block + (1|colony), data = pollen)
anova(pol.mod1, pol.mod.int)
## Data: pollen
## Models:
## pol.mod1: box ~ crithidia + fungicide + days + workers_alive + block + (1 | colony)
## pol.mod.int: box ~ crithidia * days + fungicide + workers_alive + block + (1 | colony)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## pol.mod1 15 -3907.7 -3838.3 1968.9 -3937.7
## pol.mod.int 16 -3911.0 -3837.0 1971.5 -3943.0 5.2815 1 0.02155 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(pol.mod1, pol.mod.int)
## df AIC
## pol.mod1 15 -3787.219
## pol.mod.int 16 -3775.598
drop1(pol.mod1, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ crithidia + fungicide + days + workers_alive + block +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -3907.7
## crithidia 1 -3905.5 4.261 0.0390 *
## fungicide 1 -3907.2 2.473 0.1158
## days 1 -3660.3 249.461 < 2.2e-16 ***
## workers_alive 1 -3835.8 73.943 < 2.2e-16 ***
## block 8 -3883.2 40.521 2.562e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(pm1, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ fungicide + crithidia + block + workers_alive + (1 | colony) +
## fungicide:crithidia
## npar AIC LRT Pr(Chi)
## <none> -3658.3
## block 8 -3641.0 33.257 5.534e-05 ***
## workers_alive 1 -3656.2 4.128 0.04218 *
## fungicide:crithidia 1 -3660.3 0.033 0.85554
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(pm1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: box
## Chisq Df Pr(>Chisq)
## fungicide 1.6293 1 0.20179
## crithidia 4.3682 1 0.03662 *
## block 36.0573 8 1.714e-05 ***
## workers_alive 5.7953 1 0.01607 *
## fungicide:crithidia 0.0233 1 0.87870
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(pm1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: box ~ fungicide + crithidia + block + workers_alive + (1 | colony) +
## fungicide:crithidia
## Data: pollen
##
## REML criterion at convergence: -3582.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.9271 -0.5947 0.0905 0.7533 1.9758
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 0.0003295 0.01815
## Residual 0.0003931 0.01983
## Number of obs: 755, groups: colony, 36
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.168149 0.011863 14.174
## fungicide -0.008899 0.008810 -1.010
## crithidia -0.013991 0.008822 -1.586
## block4 0.032649 0.013218 2.470
## block6 -0.033742 0.013172 -2.562
## block7 -0.003422 0.013215 -0.259
## block8 0.007327 0.013203 0.555
## block9 0.005102 0.013203 0.386
## block10 0.020309 0.013205 1.538
## block11 -0.021104 0.013204 -1.598
## block12 -0.001972 0.013193 -0.149
## workers_alive -0.002431 0.001010 -2.407
## fungicide:crithidia 0.001900 0.012447 0.153
pm2 <- update(pm1, .~. -days)
drop1(pm2, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ fungicide + crithidia + block + workers_alive + (1 | colony) +
## fungicide:crithidia
## npar AIC LRT Pr(Chi)
## <none> -3658.3
## block 8 -3641.0 33.257 5.534e-05 ***
## workers_alive 1 -3656.2 4.128 0.04218 *
## fungicide:crithidia 1 -3660.3 0.033 0.85554
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(pm2)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: box
## Chisq Df Pr(>Chisq)
## fungicide 1.6293 1 0.20179
## crithidia 4.3682 1 0.03662 *
## block 36.0573 8 1.714e-05 ***
## workers_alive 5.7953 1 0.01607 *
## fungicide:crithidia 0.0233 1 0.87870
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qqnorm(resid(pm2));qqline(resid(pm2))

Anova(pm2)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: box
## Chisq Df Pr(>Chisq)
## fungicide 1.6293 1 0.20179
## crithidia 4.3682 1 0.03662 *
## block 36.0573 8 1.714e-05 ***
## workers_alive 5.7953 1 0.01607 *
## fungicide:crithidia 0.0233 1 0.87870
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
residuals <- resid(pm1)
summary(pm1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: box ~ fungicide + crithidia + block + workers_alive + (1 | colony) +
## fungicide:crithidia
## Data: pollen
##
## REML criterion at convergence: -3582.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.9271 -0.5947 0.0905 0.7533 1.9758
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 0.0003295 0.01815
## Residual 0.0003931 0.01983
## Number of obs: 755, groups: colony, 36
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.168149 0.011863 14.174
## fungicide -0.008899 0.008810 -1.010
## crithidia -0.013991 0.008822 -1.586
## block4 0.032649 0.013218 2.470
## block6 -0.033742 0.013172 -2.562
## block7 -0.003422 0.013215 -0.259
## block8 0.007327 0.013203 0.555
## block9 0.005102 0.013203 0.386
## block10 0.020309 0.013205 1.538
## block11 -0.021104 0.013204 -1.598
## block12 -0.001972 0.013193 -0.149
## workers_alive -0.002431 0.001010 -2.407
## fungicide:crithidia 0.001900 0.012447 0.153
plot(residuals)

wilcox.test(residuals ~ pollen$fungicide)
##
## Wilcoxon rank sum test with continuity correction
##
## data: residuals by pollen$fungicide
## W = 71544, p-value = 0.9188
## alternative hypothesis: true location shift is not equal to 0
range(pollen$days)
## [1] 2 26
pollen_subset <- pollen[pollen$days >= 7 & pollen$days <=20, ]
pol.mod1 <- lmer(box ~ block + crithidia + fungicide + workers_alive + days + (1|colony), data = pollen_subset)
drop1(pol.mod1, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ block + crithidia + fungicide + workers_alive + days +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -2712.4
## block 8 -2687.2 41.260 1.864e-06 ***
## crithidia 1 -2709.1 5.358 0.02062 *
## fungicide 1 -2711.7 2.790 0.09485 .
## workers_alive 1 -2681.1 33.356 7.675e-09 ***
## days 1 -2621.2 93.255 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(pm1, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ fungicide + crithidia + block + workers_alive + (1 | colony) +
## fungicide:crithidia
## npar AIC LRT Pr(Chi)
## <none> -3658.3
## block 8 -3641.0 33.257 5.534e-05 ***
## workers_alive 1 -3656.2 4.128 0.04218 *
## fungicide:crithidia 1 -3660.3 0.033 0.85554
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pm1 <- update(pol.mod1, .~. -days)
drop1(pm2, test = "Chisq")
## Single term deletions
##
## Model:
## box ~ fungicide + crithidia + block + workers_alive + (1 | colony) +
## fungicide:crithidia
## npar AIC LRT Pr(Chi)
## <none> -3658.3
## block 8 -3641.0 33.257 5.534e-05 ***
## workers_alive 1 -3656.2 4.128 0.04218 *
## fungicide:crithidia 1 -3660.3 0.033 0.85554
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(pm1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: box
## Chisq Df Pr(>Chisq)
## block 44.0890 8 5.474e-07 ***
## crithidia 5.1193 1 0.02366 *
## fungicide 2.5169 1 0.11263
## workers_alive 0.2880 1 0.59149
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qqnorm(resid(pm1));qqline(resid(pm1))

Anova(pm2)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: box
## Chisq Df Pr(>Chisq)
## fungicide 1.6293 1 0.20179
## crithidia 4.3682 1 0.03662 *
## block 36.0573 8 1.714e-05 ***
## workers_alive 5.7953 1 0.01607 *
## fungicide:crithidia 0.0233 1 0.87870
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
residuals <- resid(pm2)
summary(pm1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: box ~ block + crithidia + fungicide + workers_alive + (1 | colony)
## Data: pollen_subset
##
## REML criterion at convergence: -2550.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.5762 -0.4671 0.1651 0.6295 2.1554
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 0.0003166 0.01779
## Residual 0.0002581 0.01606
## Number of obs: 505, groups: colony, 36
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.1590119 0.0123539 12.871
## block4 0.0365948 0.0129578 2.824
## block6 -0.0339113 0.0129403 -2.621
## block7 -0.0010390 0.0129890 -0.080
## block8 0.0098421 0.0129435 0.760
## block9 0.0108862 0.0129439 0.841
## block10 0.0266132 0.0129455 2.056
## block11 -0.0199890 0.0129890 -1.539
## block12 -0.0005906 0.0129492 -0.046
## crithidia -0.0138796 0.0061344 -2.263
## fungicide -0.0097021 0.0061155 -1.586
## workers_alive 0.0007725 0.0014394 0.537
##
## Correlation of Fixed Effects:
## (Intr) block4 block6 block7 block8 block9 blck10 blck11 blck12
## block4 -0.495
## block6 -0.532 0.499
## block7 -0.571 0.493 0.499
## block8 -0.533 0.499 0.500 0.499
## block9 -0.513 0.500 0.500 0.497 0.500
## block10 -0.537 0.498 0.500 0.500 0.500 0.499
## block11 -0.571 0.493 0.499 0.504 0.499 0.497 0.500
## block12 -0.543 0.497 0.500 0.501 0.500 0.499 0.500 0.501
## crithidia -0.306 -0.005 0.002 0.009 0.002 -0.002 0.003 0.009 0.004
## fungicide -0.286 -0.003 0.001 0.006 0.001 -0.001 0.002 0.006 0.002
## workers_alv -0.574 -0.050 0.014 0.085 0.016 -0.018 0.024 0.085 0.034
## crithd fungcd
## block4
## block6
## block7
## block8
## block9
## block10
## block11
## block12
## crithidia
## fungicide 0.007
## workers_alv 0.105 0.070
plot(pm1)

pollen %>%
wilcox.test(whole_dif ~ crithidia, data = .)
##
## Wilcoxon rank sum test with continuity correction
##
## data: whole_dif by crithidia
## W = 88668, p-value = 5.97e-09
## alternative hypothesis: true location shift is not equal to 0
pollen %>%
ggplot(aes(x = factor(crithidia),
y = whole_dif)) +
geom_boxplot(aes(fill = factor(crithidia))) +
geom_jitter(alpha = 0.4) + # add data points
theme(legend.position = "none")

#this model says: average pollen consumed ~ yes/no Fung + yes/no Crit. + workers surviving when colony was frozen + time (id is pollen ball id, meaning it is the pollen ball number) + block + random effect of colony)
pe <- emmeans(pol.mod1, pairwise ~ crithidia, type = "response")
pe
## $emmeans
## crithidia emmean SE df lower.CL upper.CL
## 0 0.159 0.00368 25.1 0.151 0.167
## 1 0.148 0.00368 25.1 0.141 0.156
##
## Results are averaged over the levels of: block, fungicide
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## crithidia0 - crithidia1 0.0105 0.00522 25.5 2.011 0.0550
##
## Results are averaged over the levels of: block, fungicide
## Degrees-of-freedom method: kenward-roger
kruskal.test(whole_dif ~ crithidia, data = pollen)
##
## Kruskal-Wallis rank sum test
##
## data: whole_dif by crithidia
## Kruskal-Wallis chi-squared = 33.846, df = 1, p-value = 5.964e-09
kruskal.test(whole_dif ~ treatment, data = pollen)
##
## Kruskal-Wallis rank sum test
##
## data: whole_dif by treatment
## Kruskal-Wallis chi-squared = 43.371, df = 3, p-value = 2.053e-09
library(dunn.test)
## Warning: package 'dunn.test' was built under R version 4.2.3
dunn_test <- dunn.test(pollen$whole_dif, pollen$treatment, method = "bonferroni")
## Kruskal-Wallis rank sum test
##
## data: x and group
## Kruskal-Wallis chi-squared = 43.371, df = 3, p-value = 0
##
##
## Comparison of x by group
## (Bonferroni)
## Col Mean-|
## Row Mean | 1 2 3
## ---------+---------------------------------
## 2 | 2.712047
## | 0.0201*
## |
## 3 | 6.222593 3.505382
## | 0.0000* 0.0014*
## |
## 4 | 4.715377 2.014187 -1.472871
## | 0.0000* 0.1320 0.4224
##
## alpha = 0.05
## Reject Ho if p <= alpha/2
# Output the result of Dunn test
print(dunn_test)
## $chi2
## [1] 43.37096
##
## $Z
## [1] 2.712048 6.222593 3.505383 4.715377 2.014188 -1.472871
##
## $P
## [1] 3.343448e-03 2.445020e-10 2.279758e-04 1.206315e-06 2.199490e-02
## [6] 7.039285e-02
##
## $P.adjusted
## [1] 2.006069e-02 1.467012e-09 1.367855e-03 7.237892e-06 1.319694e-01
## [6] 4.223571e-01
##
## $comparisons
## [1] "1 - 2" "1 - 3" "2 - 3" "1 - 4" "2 - 4" "3 - 4"
pairwise.wilcox.test(pollen$whole_dif, pollen$crithidia,
p.adjust.method = "BH")
##
## Pairwise comparisons using Wilcoxon rank sum test with continuity correction
##
## data: pollen$whole_dif and pollen$crithidia
##
## 0
## 1 6e-09
##
## P value adjustment method: BH
ggplot(data = pollen_subset, aes(x = days, y = whole_dif, fill = treatment)) +
geom_smooth() +
labs(x = "Time", y = "Mean Pollen Consumed (g)")

pollen_sum <- pollen %>%
group_by(treatment) %>%
summarise(mean = mean(whole_dif),
sd = sd(whole_dif),
n = length(whole_dif)) %>%
mutate(se = sd/sqrt(n))
pollen_box_sum <- pollen %>%
group_by(treatment) %>%
summarise(mean = mean(box),
sd = sd(box),
n = length(box)) %>%
mutate(se = sd/sqrt(n))
pollen_sum
## # A tibble: 4 × 5
## treatment mean sd n se
## <fct> <dbl> <dbl> <int> <dbl>
## 1 1 0.493 0.333 184 0.0245
## 2 2 0.426 0.317 188 0.0231
## 3 3 0.327 0.250 195 0.0179
## 4 4 0.376 0.280 188 0.0204
ggplot(data = pollen_sum, aes(x = treatment, y = mean, fill = treatment)) +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0.4, 0), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 0.55)) +
geom_errorbar(aes(ymin = mean - se, ymax = mean + se), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Average Pollen Consumed (g)") +
annotate(
geom = "text",
x = 3,
y = 0.55,
label = "P = ?",
size = 8
) +
theme_classic(base_size = 20) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_manual(values = c("none", "none", "stripe", "none")) + # Add stripes to the fourth column
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none") +
geom_segment(x = 1, xend = 2, y = 0.54, yend = 0.54,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 1, y = 0.54, yend = 0.53,
lineend = "round", linejoin = "round") +
geom_segment(x = 2, xend = 2, y = 0.54, yend = 0.53,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 4, y = 0.42, yend = 0.42,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 3, y = 0.42, yend = 0.41,
lineend = "round", linejoin = "round") +
geom_segment(x = 4, xend = 4, y = 0.42, yend = 0.41,
lineend = "round", linejoin = "round") +
geom_text(x = 1.5, y = 0.55, label = "a", size = 6, vjust = -0.5) +
geom_text(x = 3.5, y = 0.43, label = "b", size = 6, vjust = -0.5)

ggplot(data = pollen_sum, aes(x = treatment, y = mean, fill = treatment)) +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0.4, 0), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 0.55)) +
geom_errorbar(aes(ymin = mean - se, ymax = mean + se), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Average Pollen Consumed (g)") +
annotate(
geom = "text",
x = 3,
y = 0.55,
label = "P = 0.07",
size = 8
) +
theme_classic(base_size = 20) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_manual(values = c("none", "none", "stripe", "none")) + # Add stripes to the fourth column
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none")

Worker Survival
duration$fungicide <- as.logical(duration$fungicide)
duration$crithidia <- as.logical(duration$crithidia)
cbw1 <- glm(cbind(workers_alive, workers_dead) ~ fungicide*crithidia + mean.pollen + block + days_active, data = duration, family = binomial("logit"))
Anova(cbw1)
## Analysis of Deviance Table (Type II tests)
##
## Response: cbind(workers_alive, workers_dead)
## LR Chisq Df Pr(>Chisq)
## fungicide 0.8742 1 0.34980
## crithidia 3.4505 1 0.06323 .
## mean.pollen 20.4002 1 6.282e-06 ***
## block 19.4531 8 0.01262 *
## days_active 0.6021 1 0.43779
## fungicide:crithidia 1.1590 1 0.28168
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(cbw1, test = "Chisq")
## Single term deletions
##
## Model:
## cbind(workers_alive, workers_dead) ~ fungicide * crithidia +
## mean.pollen + block + days_active
## Df Deviance AIC LRT Pr(>Chi)
## <none> 24.949 92.390
## mean.pollen 1 45.349 110.790 20.4002 6.282e-06 ***
## block 8 44.402 95.843 19.4531 0.01262 *
## days_active 1 25.551 90.992 0.6021 0.43779
## fungicide:crithidia 1 26.108 91.549 1.1590 0.28168
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
cbw1 <- glm(cbind(workers_alive, workers_dead) ~ fungicide + crithidia + mean.pollen + block + days_active, data = duration, family = binomial("logit"))
Anova(cbw1)
## Analysis of Deviance Table (Type II tests)
##
## Response: cbind(workers_alive, workers_dead)
## LR Chisq Df Pr(>Chisq)
## fungicide 0.8742 1 0.34980
## crithidia 3.4505 1 0.06323 .
## mean.pollen 20.9469 1 4.722e-06 ***
## block 20.1480 8 0.00979 **
## days_active 0.2346 1 0.62810
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(cbw1, test = "Chisq")
## Single term deletions
##
## Model:
## cbind(workers_alive, workers_dead) ~ fungicide + crithidia +
## mean.pollen + block + days_active
## Df Deviance AIC LRT Pr(>Chi)
## <none> 26.108 91.549
## fungicide 1 26.982 90.423 0.8742 0.34980
## crithidia 1 29.559 92.999 3.4505 0.06323 .
## mean.pollen 1 47.055 110.496 20.9469 4.722e-06 ***
## block 8 46.256 95.697 20.1480 0.00979 **
## days_active 1 26.343 89.784 0.2346 0.62810
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
cbw3 <- update(cbw1, .~. -days_active)
qqnorm(resid(cbw3));qqline(resid(cbw3))

Anova(cbw3)
## Analysis of Deviance Table (Type II tests)
##
## Response: cbind(workers_alive, workers_dead)
## LR Chisq Df Pr(>Chisq)
## fungicide 0.9395 1 0.332394
## crithidia 3.8291 1 0.050370 .
## mean.pollen 26.4903 1 2.649e-07 ***
## block 21.1782 8 0.006689 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(cbw3)
##
## Call:
## glm(formula = cbind(workers_alive, workers_dead) ~ fungicide +
## crithidia + mean.pollen + block, family = binomial("logit"),
## data = duration)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9252 -0.5366 0.1348 0.6577 1.5162
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.1264 1.0823 -1.965 0.0495 *
## fungicideTRUE 0.4218 0.4386 0.962 0.3362
## crithidiaTRUE -0.8727 0.4483 -1.947 0.0516 .
## mean.pollen 10.4521 2.5014 4.179 2.93e-05 ***
## block4 14.8345 3600.7582 0.004 0.9967
## block6 0.3860 0.7888 0.489 0.6246
## block7 -1.1692 0.7926 -1.475 0.1402
## block8 0.6117 0.8994 0.680 0.4965
## block9 0.9506 0.9531 0.997 0.3186
## block10 -2.3981 0.9979 -2.403 0.0163 *
## block11 -0.1471 0.7723 -0.191 0.8489
## block12 -1.9234 0.9288 -2.071 0.0384 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 104.128 on 35 degrees of freedom
## Residual deviance: 26.343 on 24 degrees of freedom
## AIC: 89.784
##
## Number of Fisher Scoring iterations: 18
worker_sum <-duration %>%
group_by(treatment) %>%
summarise(m = mean(workers_alive),
sd = sd(workers_alive))
worker_sum
## # A tibble: 4 × 3
## treatment m sd
## <fct> <dbl> <dbl>
## 1 1 4.33 0.866
## 2 2 3.78 1.20
## 3 3 2.78 1.86
## 4 4 2.89 1.96
worker_sum <-duration %>%
group_by(treatment) %>%
summarise(m = mean(workers_alive),
sd = sd(workers_alive),
l = length(workers_alive)) %>%
mutate(se = sd/sqrt(l))
worker_sum
## # A tibble: 4 × 5
## treatment m sd l se
## <fct> <dbl> <dbl> <int> <dbl>
## 1 1 4.33 0.866 9 0.289
## 2 2 3.78 1.20 9 0.401
## 3 3 2.78 1.86 9 0.619
## 4 4 2.89 1.96 9 0.655
workers$prob <- workers$days_alive / workers$days_active
worker_prob_sum <-workers %>%
group_by(treatment) %>%
summarise(m = mean(prob),
sd = sd(prob),
l = length(prob)) %>%
mutate(se = sd/sqrt(l))
worker_prob_sum$plot <- worker_prob_sum$m + worker_prob_sum$se
worker_prob_sum$treatment <- as.factor(worker_prob_sum$treatment)
ggplot(data = worker_prob_sum, aes(x = treatment, y = m, fill = treatment)) +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0, 0.4), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)) +
coord_cartesian(ylim = c(0.5, 1.05)) +
geom_errorbar(aes(ymin = m - se, ymax = m + se), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Probability") +
theme_classic(base_size = 20) +
annotate(
geom = "text",
x = 3.5,
y = 1.05,
label = "P = 0.05",
size = 7
) + # Add stripes to the fourth column
scale_fill_manual(values = c("lightgreen", "lightblue", "grey", "lightblue")) +
scale_pattern_manual(values = c("none", "none", "none", "stripe")) + # Add stripes to the fourth column
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none") +
geom_segment(x = 1, xend = 2, y = 1, yend = 1,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 1, y = 0.98, yend = 1.02,
lineend = "round", linejoin = "round") +
geom_segment(x = 2, xend = 2, y = 0.98, yend = 1.02,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 4, y = 0.9, yend = 0.9,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 3, y = 0.88, yend = 0.92,
lineend = "round", linejoin = "round") +
geom_segment(x = 4, xend = 4, y = 0.88, yend = 0.92,
lineend = "round", linejoin = "round") +
geom_text(x = 1.5, y = 1.01, label = "a", size = 6, vjust = -0.5) +
geom_text(x = 3.5, y = 0.93, label = "b", size = 6, vjust = -0.5)

COX PH Workers
library(survival)
library(coxme)
## Warning: package 'coxme' was built under R version 4.2.3
library(survminer)
## Warning: package 'survminer' was built under R version 4.2.3
workers$censor_status <- ifelse(workers$premature_death == 0, 1, 2)
workers$fungicide <- as.factor(workers$fungicide)
workers$crithidia <- as.factor(workers$crithidia)
all_bees$bee_id <-as.factor(all_bees$bee_id)
all_bees$fungicide <- as.factor(all_bees$fungicide)
all_bees$crithidia <- as.factor(all_bees$crithidia)
all_bees$round <- as.factor(all_bees$round)
workers$inoculate_round <- as.factor(workers$inoculate_round)
library(survminer)
all_bees$censor_status <- as.double(all_bees$censor_status)
res.cox <- coxme(Surv(days_since_innoculation, censor_status) ~ fungicide + crithidia + (1|bee_id), data = all_bees)
res.cox
## Cox mixed-effects model fit by maximum likelihood
## Data: all_bees
## events, n = 138, 2226
## Iterations= 11 76
## NULL Integrated Fitted
## Log-likelihood -904.4969 -643.4905 -561.5684
## Warning in pchisq(chi2, x$df[2]): NaNs produced
## Chisq df p AIC BIC
## Integrated loglik 522.01 3.0 0 516.01 507.23
## Penalized loglik 685.86 -1326.2 NaN 3338.26 7220.40
##
## Model: Surv(days_since_innoculation, censor_status) ~ fungicide + crithidia + (1 | bee_id)
## Fixed coefficients
## coef exp(coef) se(coef) z p
## fungicide1 1.932330 6.905582 5.2545770 0.37 7.1e-01
## crithidia1 1.333845 3.795608 0.2003761 6.66 2.8e-11
##
## Random effects
## Group Variable Std Dev Variance
## bee_id Intercept 2.478426 6.142595
Anova(res.cox)
## Analysis of Deviance Table (Type II tests)
##
## Response: Surv(days_since_innoculation, censor_status)
## Df Chisq Pr(>Chisq)
## fungicide 1 0.1352 0.7131
## crithidia 1 44.3117 2.8e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
emm.cox <- emmeans(res.cox, pairwise ~ crithidia, type = "response")
pairs(emm.cox)
## contrast ratio SE df null z.ratio p.value
## crithidia0 / crithidia1 0.263 0.0528 Inf 1 -6.657 <.0001
##
## Results are averaged over the levels of: fungicide
## Tests are performed on the log scale
emmdf <- as.data.frame(emm.cox$contrasts)
emmdf
## contrast ratio SE df null z.ratio p.value
## crithidia0 / crithidia1 0.2634624 0.05279157 Inf 1 -6.657 <.0001
##
## Results are averaged over the levels of: fungicide
## Tests are performed on the log scale
emmdf <- setDT(emmdf)
workcld <- cld(object = emm.cox,
adjust = "Tukey",
alpha = 0.05,
Letters = letters)
workcld
## crithidia response SE df asymp.LCL asymp.UCL .group
## 0 0.512 0.0595 Inf 0.395 0.664 a
## 1 1.945 0.1639 Inf 1.610 2.348 b
##
## Results are averaged over the levels of: fungicide
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## Intervals are back-transformed from the log scale
## Tests are performed on the log scale
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
require("survival")
ggsurvplot(survfit(Surv(days_since_innoculation, censor_status) ~ treatment, data = all_bees),
legend.title = "",
censor.shape = 124,
censor.size = 2.5)

ggsurvplot(
survfit(Surv(days_since_innoculation, censor_status) ~ treatment, data = all_bees),
legend.title = "",
censor.shape = 124,
censor.size = 2.5,
ylim = c(0.7, 1),
palette = c("green", "lightblue", "darkblue", "orange")
)
## Warning: Removed 2 rows containing missing values (`geom_step()`).
## Warning: Removed 2 rows containing missing values (`geom_point()`).
## Warning: Removed 2 rows containing missing values (`geom_step()`).
## Warning: Removed 2 rows containing missing values (`geom_point()`).

Days workers survive
dayswrk <- glmer.nb(days_alive ~ fungicide*crithidia + avg_pollen + inoculate + block + (1|colony), data = workers)
drop1(dayswrk, test = "Chisq")
## Single term deletions
##
## Model:
## days_alive ~ fungicide * crithidia + avg_pollen + inoculate +
## block + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 1420.8
## avg_pollen 1 1420.5 1.6459 0.1995
## inoculate 1 1418.9 0.0398 0.8418
## block 8 1416.7 11.8477 0.1581
## fungicide:crithidia 1 1419.5 0.7021 0.4021
dayswrk <- glmer(days_alive ~ fungicide + crithidia + block + inoculate + avg_pollen + (1|colony), data = workers, family = "poisson")
summary(dayswrk)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: poisson ( log )
## Formula: days_alive ~ fungicide + crithidia + block + inoculate + avg_pollen +
## (1 | colony)
## Data: workers
##
## AIC BIC logLik deviance df.resid
## 1523.4 1568.0 -747.7 1495.4 165
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.4270 -0.0936 0.2549 0.6165 3.4435
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 0.004707 0.06861
## Number of obs: 179, groups: colony, 36
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.707542 0.078370 47.308 < 2e-16 ***
## fungicide1 0.001255 0.034173 0.037 0.97072
## crithidia1 -0.044325 0.036012 -1.231 0.21837
## block4 -0.158303 0.091823 -1.724 0.08471 .
## block6 0.034254 0.071873 0.477 0.63366
## block7 -0.212578 0.070571 -3.012 0.00259 **
## block8 -0.177787 0.072662 -2.447 0.01441 *
## block9 -0.063467 0.069159 -0.918 0.35877
## block10 -0.194140 0.076896 -2.525 0.01158 *
## block11 -0.139371 0.071053 -1.961 0.04982 *
## block12 -0.101651 0.069882 -1.455 0.14578
## inoculateTRUE -0.017745 0.029983 -0.592 0.55396
## avg_pollen 0.214721 0.134352 1.598 0.11000
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dayswrk <- glmer.nb(days_alive ~ fungicide + crithidia + block + inoculate + avg_pollen + (1|colony), data = workers)
drop1(dayswrk, test = "Chisq")
## Single term deletions
##
## Model:
## days_alive ~ fungicide + crithidia + block + inoculate + avg_pollen +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 1419.5
## fungicide 1 1417.5 0.0000 0.9994
## crithidia 1 1418.4 0.8608 0.3535
## block 8 1415.4 11.8590 0.1576
## inoculate 1 1417.6 0.0388 0.8438
## avg_pollen 1 1419.2 1.6266 0.2022
dayswrk1 <- update(dayswrk, .~. -inoculate)
drop1(dayswrk1, test = "Chisq")
## Single term deletions
##
## Model:
## days_alive ~ fungicide + crithidia + block + avg_pollen + (1 |
## colony)
## npar AIC LRT Pr(Chi)
## <none> 1417.6
## fungicide 1 1415.6 0.0000 0.9988
## crithidia 1 1416.5 0.8670 0.3518
## block 8 1413.5 11.9030 0.1556
## avg_pollen 1 1417.2 1.6366 0.2008
dayswrk2 <- update(dayswrk1, .~. -avg_pollen)
drop1(dayswrk2, test = "Chisq")
## Single term deletions
##
## Model:
## days_alive ~ fungicide + crithidia + block + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 1417.2
## fungicide 1 1415.3 0.1022 0.7492
## crithidia 1 1417.6 2.3719 0.1235
## block 8 1411.6 10.3752 0.2397
dayswrk4 <- update(dayswrk2, .~. -fungicide)
drop1(dayswrk4, test = "Chisq")
## Single term deletions
##
## Model:
## days_alive ~ crithidia + block + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 1415.3
## crithidia 1 1415.7 2.3914 0.1220
## block 8 1409.7 10.3187 0.2434
Anova(dayswrk1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: days_alive
## Chisq Df Pr(>Chisq)
## fungicide 0.0000 1 0.9989
## crithidia 0.8671 1 0.3518
## block 11.8883 8 0.1563
## avg_pollen 1.6320 1 0.2014
worker_days_sum <-workers %>%
group_by(treatment) %>%
summarise(m = mean(days_alive),
sd = sd(days_alive),
l = length(days_alive)) %>%
mutate(se = sd/sqrt(l))
worker_days_sum$plot <- worker_days_sum$m + worker_days_sum$se
worker_days_sum$treatment <- as.factor(worker_days_sum$treatment)
ggplot(data = worker_days_sum, aes(x = treatment, y = m, fill = treatment, pattern = treatment)) +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0, 0.4), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(20, 45)) +
geom_errorbar(aes(ymin = m - se, ymax = m + se), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Days") +
theme_classic(base_size = 20) +
annotate(
geom = "text",
x = 1,
y = 45,
label = "P > 0.05",
size = 7
) + scale_fill_manual(values = c("lightgreen", "lightblue", "grey", "lightblue")) +
scale_pattern_manual(values = c("none", "none", "none", "stripe")) + # Add stripes to the fourth column
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none")

durmod <- glm.nb(days_active ~ fungicide + crithidia + mean.pollen + days_first_ov, data = duration)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(durmod, test = "Chisq")
## Single term deletions
##
## Model:
## days_active ~ fungicide + crithidia + mean.pollen + days_first_ov
## Df Deviance AIC LRT Pr(>Chi)
## <none> 11.595 218.93
## fungicide 1 11.636 216.97 0.04072 0.8401
## crithidia 1 12.041 217.38 0.44567 0.5044
## mean.pollen 1 12.632 217.97 1.03675 0.3086
## days_first_ov 1 12.261 217.60 0.66545 0.4146
durmod <- glm.nb(days_active ~ fungicide + crithidia + mean.pollen, data = duration)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(durmod, test = "Chisq")
## Single term deletions
##
## Model:
## days_active ~ fungicide + crithidia + mean.pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 12.371 223.46
## fungicide 1 12.379 221.47 0.0079 0.92916
## crithidia 1 12.748 221.84 0.3771 0.53917
## mean.pollen 1 16.304 225.40 3.9330 0.04735 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dm2 <- update(durmod, .~. -fungicide)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(dm2, test = "Chisq")
## Single term deletions
##
## Model:
## days_active ~ crithidia + mean.pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 12.379 221.47
## crithidia 1 12.752 219.84 0.3734 0.54115
## mean.pollen 1 16.462 223.55 4.0834 0.04331 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(durmod)
##
## Call:
## glm.nb(formula = days_active ~ fungicide + crithidia + mean.pollen,
## data = duration, init.theta = 2513306.23, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.23370 -0.31100 0.04984 0.36315 1.08001
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.885269 0.073759 52.675 <2e-16 ***
## fungicideTRUE 0.004474 0.050325 0.089 0.9292
## crithidiaTRUE 0.031525 0.051345 0.614 0.5392
## mean.pollen -0.237193 0.120287 -1.972 0.0486 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(2513306) family taken to be 1)
##
## Null deviance: 17.770 on 35 degrees of freedom
## Residual deviance: 12.371 on 32 degrees of freedom
## AIC: 225.46
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 2513306
## Std. Err.: 66077581
## Warning while fitting theta: iteration limit reached
##
## 2 x log-likelihood: -215.463
Anova(durmod)
## Analysis of Deviance Table (Type II tests)
##
## Response: days_active
## LR Chisq Df Pr(>Chisq)
## fungicide 0.0079 1 0.92916
## crithidia 0.3771 1 0.53917
## mean.pollen 3.9330 1 0.04735 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(duration$treatment, duration$days_active)

Worker dry weight
workers$dry <- as.double(workers$dry)
## Warning: NAs introduced by coercion
hist(workers$dry)

shapiro.test(workers$dry)
##
## Shapiro-Wilk normality test
##
## data: workers$dry
## W = 0.96362, p-value = 0.0001443
workers$logdry <- log(workers$dry)
shapiro.test(workers$logdry)
##
## Shapiro-Wilk normality test
##
## data: workers$logdry
## W = 0.98991, p-value = 0.2444
hist(workers$logdry)

wrkdry <- lmer(logdry ~ fungicide*crithidia + avg_pollen + inoculate +block + (1|colony), data = workers)
drop1(wrkdry, test = "Chisq")
## Single term deletions
##
## Model:
## logdry ~ fungicide * crithidia + avg_pollen + inoculate + block +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 66.985
## avg_pollen 1 85.038 20.052 7.535e-06 ***
## inoculate 1 64.992 0.007 0.9349
## block 8 87.068 36.083 1.696e-05 ***
## fungicide:crithidia 1 65.393 0.408 0.5231
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
wrkdry <- lmer(logdry ~ fungicide + crithidia + avg_pollen + inoculate +block + (1|colony), data = workers)
drop1(wrkdry, test = "Chisq")
## Single term deletions
##
## Model:
## logdry ~ fungicide + crithidia + avg_pollen + inoculate + block +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 65.393
## fungicide 1 66.158 2.765 0.096355 .
## crithidia 1 71.006 7.613 0.005795 **
## avg_pollen 1 83.162 19.768 8.742e-06 ***
## inoculate 1 63.400 0.007 0.932656
## block 8 85.142 35.749 1.952e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
wrkdry1 <- update(wrkdry, .~. -inoculate)
drop1(wrkdry1, test = "Chisq")
## Single term deletions
##
## Model:
## logdry ~ fungicide + crithidia + avg_pollen + block + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 63.400
## fungicide 1 64.165 2.765 0.096363 .
## crithidia 1 69.016 7.616 0.005786 **
## avg_pollen 1 81.172 19.772 8.725e-06 ***
## block 8 83.155 35.754 1.947e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
wm2 <- update(wrkdry1, .~. -fungicide)
drop1(wm2, test = "Chisq")
## Single term deletions
##
## Model:
## logdry ~ crithidia + avg_pollen + block + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 64.165
## crithidia 1 68.571 6.406 0.01137 *
## avg_pollen 1 84.273 22.108 2.578e-06 ***
## block 8 82.775 34.610 3.149e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(wrkdry, wm2, test = "Chisq")
## Data: workers
## Models:
## wm2: logdry ~ crithidia + avg_pollen + block + (1 | colony)
## wrkdry: logdry ~ fungicide + crithidia + avg_pollen + inoculate + block + (1 | colony)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## wm2 13 64.165 105.45 -19.082 38.165
## wrkdry 15 65.393 113.03 -17.697 35.393 2.7719 2 0.2501
summary(wrkdry1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: logdry ~ fungicide + crithidia + avg_pollen + block + (1 | colony)
## Data: workers
##
## REML criterion at convergence: 77.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.02299 -0.56652 -0.04535 0.61291 2.16906
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 0.008674 0.09313
## Residual 0.070615 0.26574
## Number of obs: 177, groups: colony, 36
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) -3.133210 0.120772 -25.943
## fungicide1 -0.072102 0.052330 -1.378
## crithidia1 -0.130746 0.055229 -2.367
## avg_pollen 0.849884 0.203664 4.173
## block4 -0.293828 0.140549 -2.091
## block6 0.122021 0.112098 1.089
## block7 -0.126237 0.107821 -1.171
## block8 0.004312 0.110376 0.039
## block9 -0.418020 0.107027 -3.906
## block10 -0.329383 0.117314 -2.808
## block11 -0.297229 0.109508 -2.714
## block12 -0.212682 0.107617 -1.976
##
## Correlation of Fixed Effects:
## (Intr) fngcd1 crthd1 avg_pl block4 block6 block7 block8 block9
## fungicide1 -0.386
## crithidia1 -0.481 0.105
## avg_pollen -0.722 0.253 0.400
## block4 0.134 -0.165 -0.260 -0.650
## block6 -0.621 0.063 0.118 0.278 0.181
## block7 -0.399 -0.020 -0.027 -0.049 0.408 0.458
## block8 -0.244 -0.064 -0.101 -0.254 0.532 0.390 0.491
## block9 -0.390 -0.018 -0.028 -0.070 0.424 0.456 0.497 0.500
## block10 -0.103 -0.105 -0.166 -0.414 0.615 0.318 0.471 0.545 0.483
## block11 -0.565 0.054 0.080 0.181 0.252 0.515 0.474 0.425 0.474
## block12 -0.348 -0.032 -0.050 -0.126 0.459 0.438 0.497 0.512 0.504
## blck10 blck11
## fungicide1
## crithidia1
## avg_pollen
## block4
## block6
## block7
## block8
## block9
## block10
## block11 0.368
## block12 0.504 0.461
Anova(wrkdry1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: logdry
## Chisq Df Pr(>Chisq)
## fungicide 1.8984 1 0.16825
## crithidia 5.6043 1 0.01792 *
## avg_pollen 17.4136 1 3.007e-05 ***
## block 40.8700 8 2.205e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qqnorm(resid(wrkdry1));qqline(resid(wrkdry1))

pe <- emmeans(wrkdry1, pairwise ~ crithidia, type = "response")
pe
## $emmeans
## crithidia emmean SE df lower.CL upper.CL
## 0 -2.98 0.0372 23.8 -3.06 -2.91
## 1 -3.11 0.0377 24.1 -3.19 -3.04
##
## Results are averaged over the levels of: fungicide, block
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## crithidia0 - crithidia1 0.131 0.0552 23.9 2.367 0.0264
##
## Results are averaged over the levels of: fungicide, block
## Degrees-of-freedom method: kenward-roger
pairs(pe)
## contrast estimate SE df t.ratio p.value
## crithidia0 - crithidia1 0.131 0.0552 23.9 2.367 0.0264
##
## Results are averaged over the levels of: fungicide, block
## Degrees-of-freedom method: kenward-roger
wrkdry.df <- na.omit(workers)
wrkdrysum <- wrkdry.df %>%
group_by(treatment) %>%
summarise(m = mean(dry),
sd = sd(dry),
n = length(dry)) %>%
mutate(se = sd/sqrt(n))
wrkdrysum
## # A tibble: 4 × 5
## treatment m sd n se
## <fct> <dbl> <dbl> <int> <dbl>
## 1 1 0.0586 0.0186 44 0.00280
## 2 2 0.0528 0.0169 45 0.00252
## 3 3 0.0416 0.0132 44 0.00199
## 4 4 0.0487 0.0182 44 0.00275
wtuk.means <- emmeans(object = wrkdry1,
specs = "crithidia",
adjust = "Tukey",
type = "response")
wtuk.means
## crithidia emmean SE df lower.CL upper.CL
## 0 -2.98 0.0372 23.8 -3.07 -2.89
## 1 -3.11 0.0377 24.1 -3.20 -3.02
##
## Results are averaged over the levels of: fungicide, block
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
w.cld.model <- cld(object = wtuk.means,
adjust = "Tukey",
Letters = letters,
alpha = 0.05)
w.cld.model
## crithidia emmean SE df lower.CL upper.CL .group
## 1 -3.11 0.0377 24.1 -3.20 -3.02 a
## 0 -2.98 0.0372 23.8 -3.07 -2.89 b
##
## Results are averaged over the levels of: fungicide, block
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
ggplot(data = wrkdrysum, aes(x = treatment, y = m, fill = treatment)) +
geom_col(col = "black") +
coord_cartesian(ylim = c(0, 0.08)) +
scale_fill_viridis_d() +
labs(x = "Treatment", y = "Worker Dry Weight (g)") +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0.4, 0), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
geom_errorbar(aes(ymin = m - se, ymax = m + se), width = 0.2, position = position_dodge(0.9)) +
theme_classic(base_size = 20) +
theme(legend.position = "none") +
annotate(
geom = "text",
x = 4,
y = 0.079,
label = "P = 0.02",
size = 7
) +
theme(legend.position = "none") +
scale_x_discrete(labels = custom_labels) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_manual(values = c("none", "none", "stripe", "none")) +
geom_segment(x = 1, xend = 2, y = 0.07, yend = 0.07,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 1, y = 0.07, yend = 0.069,
lineend = "round", linejoin = "round") +
geom_segment(x = 2, xend = 2, y = 0.07, yend = 0.069,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 4, y = 0.06, yend = 0.06,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 3, y = 0.06, yend = 0.059,
lineend = "round", linejoin = "round") +
geom_segment(x = 4, xend = 4, y = 0.06, yend = 0.059,
lineend = "round", linejoin = "round") +
geom_text(x = 1.5, y = 0.071, label = "a", size = 6, vjust = -0.5) +
geom_text(x = 3.5, y = 0.061, label = "b", size = 6, vjust = -0.5)

ggplot(data = wrkdrysum, aes(x = treatment, y = m, fill = treatment, pattern = treatment)) +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0, 0.4), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 0.07)) +
geom_errorbar(aes(ymin = m - se, ymax = m + se), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Worker Dry Weight (g)") +
annotate(
geom = "text",
x = c(1, 2, 3, 4),
y = wrkdrysum$m + wrkdrysum$se + 0.01, # Adjust the y-position as needed
label = c("a", "a", "b", "ab"),
size = 8
) +
theme_classic(base_size = 20) +
annotate(
geom = "text",
x = 4,
y = 0.07,
label = "P = 0.05",
size = 7
) +
scale_fill_manual(values = c("lightgreen", "lightblue", "grey", "lightblue")) +
scale_pattern_manual(values = c("none", "none", "none", "stripe")) + # Add stripes to the fourth column
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none")

First Oviposition
duration$fungicide <- as.logical(duration$fungicide)
duration$crithidia <- as.logical(duration$crithidia)
ov <- glm.nb(days_first_ov ~ fungicide*crithidia + avg.pol + workers_alive + block, data = duration)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(ov, test = "Chisq")
## Single term deletions
##
## Model:
## days_first_ov ~ fungicide * crithidia + avg.pol + workers_alive +
## block
## Df Deviance AIC LRT Pr(>Chi)
## <none> 17.299 193.75
## avg.pol 1 20.216 194.67 2.9167 0.08767 .
## workers_alive 1 18.139 192.59 0.8399 0.35944
## block 8 26.334 186.79 9.0353 0.33933
## fungicide:crithidia 1 17.727 192.18 0.4283 0.51283
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ov.pois <- glm(days_first_ov ~ fungicide + crithidia + avg.pol + workers_alive + block, data = duration, family = "poisson")
summary(ov.pois)
##
## Call:
## glm(formula = days_first_ov ~ fungicide + crithidia + avg.pol +
## workers_alive + block, family = "poisson", data = duration)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.6936 -0.3927 -0.1427 0.5417 1.3279
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.85680 0.28194 10.133 <2e-16 ***
## fungicideTRUE -0.03515 0.10714 -0.328 0.7428
## crithidiaTRUE -0.14256 0.11684 -1.220 0.2224
## avg.pol -0.97454 0.60683 -1.606 0.1083
## workers_alive -0.05975 0.05775 -1.035 0.3008
## block4 0.49446 0.33514 1.475 0.1401
## block6 0.48118 0.21249 2.264 0.0235 *
## block7 0.22272 0.23082 0.965 0.3346
## block8 0.26521 0.27207 0.975 0.3297
## block9 0.19574 0.23070 0.848 0.3962
## block10 0.34408 0.27195 1.265 0.2058
## block11 0.21287 0.22151 0.961 0.3365
## block12 0.13061 0.24776 0.527 0.5981
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 50.163 on 34 degrees of freedom
## Residual deviance: 17.728 on 22 degrees of freedom
## (1 observation deleted due to missingness)
## AIC: 192.18
##
## Number of Fisher Scoring iterations: 4
qqnorm(resid(ov.pois));qqline(resid(ov.pois))

ov <- glm.nb(days_first_ov ~ fungicide + crithidia + avg.pol + workers_alive + block, data = duration)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(ov, test = "Chisq")
## Single term deletions
##
## Model:
## days_first_ov ~ fungicide + crithidia + avg.pol + workers_alive +
## block
## Df Deviance AIC LRT Pr(>Chi)
## <none> 17.727 192.18
## fungicide 1 17.835 190.29 0.1076 0.7429
## crithidia 1 19.227 191.68 1.4995 0.2208
## avg.pol 1 20.392 192.84 2.6647 0.1026
## workers_alive 1 18.797 191.25 1.0696 0.3010
## block 8 26.773 185.23 9.0457 0.3385
anova(ov.pois, ov, test = "Chisq")
## Analysis of Deviance Table
##
## Model 1: days_first_ov ~ fungicide + crithidia + avg.pol + workers_alive +
## block
## Model 2: days_first_ov ~ fungicide + crithidia + avg.pol + workers_alive +
## block
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 22 17.728
## 2 22 17.727 0 0.00054378
qqnorm(resid(ov));qqline(resid(ov))

AIC(ov.pois, ov)
## df AIC
## ov.pois 13 192.1801
## ov 14 194.1806
drop1(ov.pois, test = "Chisq")
## Single term deletions
##
## Model:
## days_first_ov ~ fungicide + crithidia + avg.pol + workers_alive +
## block
## Df Deviance AIC LRT Pr(>Chi)
## <none> 17.728 192.18
## fungicide 1 17.836 190.29 0.1076 0.7429
## crithidia 1 19.227 191.68 1.4995 0.2207
## avg.pol 1 20.393 192.84 2.6648 0.1026
## workers_alive 1 18.798 191.25 1.0696 0.3010
## block 8 26.774 185.23 9.0460 0.3384
ov1 <- update(ov, .~. -block)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(ov1, test = "Chisq")
## Single term deletions
##
## Model:
## days_first_ov ~ fungicide + crithidia + avg.pol + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 26.772 185.23
## fungicide 1 26.878 183.33 0.1053 0.74551
## crithidia 1 28.305 184.76 1.5327 0.21571
## avg.pol 1 32.704 189.16 5.9317 0.01487 *
## workers_alive 1 28.931 185.38 2.1591 0.14173
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ov2 <- update(ov1, .~. -workers_alive)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(ov2, test = "Chisq")
## Single term deletions
##
## Model:
## days_first_ov ~ fungicide + crithidia + avg.pol
## Df Deviance AIC LRT Pr(>Chi)
## <none> 28.931 185.39
## fungicide 1 29.045 183.50 0.1146 0.7350
## crithidia 1 29.519 183.97 0.5882 0.4431
## avg.pol 1 49.820 204.27 20.8889 4.867e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(ov2)
## Analysis of Deviance Table (Type II tests)
##
## Response: days_first_ov
## LR Chisq Df Pr(>Chisq)
## fungicide 0.1146 1 0.7350
## crithidia 0.5882 1 0.4431
## avg.pol 20.8889 1 4.867e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(ov2)
##
## Call:
## glm.nb(formula = days_first_ov ~ fungicide + crithidia + avg.pol,
## data = duration, init.theta = 151930.6281, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.71248 -0.65163 -0.07036 0.53669 1.82330
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.95946 0.14611 20.255 < 2e-16 ***
## fungicideTRUE -0.03434 0.10142 -0.339 0.735
## crithidiaTRUE -0.07821 0.10197 -0.767 0.443
## avg.pol -1.14088 0.25754 -4.430 9.43e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(151930.6) family taken to be 1)
##
## Null deviance: 50.159 on 34 degrees of freedom
## Residual deviance: 28.931 on 31 degrees of freedom
## (1 observation deleted due to missingness)
## AIC: 187.39
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 151931
## Std. Err.: 5542697
## Warning while fitting theta: iteration limit reached
##
## 2 x log-likelihood: -177.386
plot(duration$treatment, duration$days_first_ov)

Duration
duration$fungicide <- as.factor(duration$fungicide)
duration$crithidia <- as.factor(duration$crithidia)
dm1 <- glm.nb(days_active ~ fungicide + crithidia + avg.pol, data = duration)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(dm1, test = "Chisq")
## Single term deletions
##
## Model:
## days_active ~ fungicide + crithidia + avg.pol
## Df Deviance AIC LRT Pr(>Chi)
## <none> 12.371 223.46
## fungicide 1 12.379 221.47 0.0079 0.92916
## crithidia 1 12.748 221.84 0.3771 0.53917
## avg.pol 1 16.304 225.40 3.9330 0.04735 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(dm1)
##
## Call:
## glm.nb(formula = days_active ~ fungicide + crithidia + avg.pol,
## data = duration, init.theta = 2513306.23, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.23370 -0.31100 0.04984 0.36315 1.08001
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.885269 0.073759 52.675 <2e-16 ***
## fungicideTRUE 0.004474 0.050325 0.089 0.9292
## crithidiaTRUE 0.031525 0.051345 0.614 0.5392
## avg.pol -0.237193 0.120287 -1.972 0.0486 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(2513306) family taken to be 1)
##
## Null deviance: 17.770 on 35 degrees of freedom
## Residual deviance: 12.371 on 32 degrees of freedom
## AIC: 225.46
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 2513306
## Std. Err.: 66077581
## Warning while fitting theta: iteration limit reached
##
## 2 x log-likelihood: -215.463
Anova(dm1)
## Analysis of Deviance Table (Type II tests)
##
## Response: days_active
## LR Chisq Df Pr(>Chisq)
## fungicide 0.0079 1 0.92916
## crithidia 0.3771 1 0.53917
## avg.pol 3.9330 1 0.04735 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Brood cells
brood$fungicide <- as.factor(brood$fungicide)
brood$crithidia <- as.factor(brood$crithidia)
plot(brood$treatment, brood$brood_cells)

brood.mod <- glm.nb(brood_cells ~ fungicide*crithidia + block + workers_alive + duration + avg_pollen, data = brood)
## Warning in glm.nb(brood_cells ~ fungicide * crithidia + block + workers_alive +
## : alternation limit reached
Anova(brood.mod)
## Analysis of Deviance Table (Type II tests)
##
## Response: brood_cells
## LR Chisq Df Pr(>Chisq)
## fungicide 9.473 1 0.002085 **
## crithidia 0.483 1 0.487155
## block 87.471 8 1.515e-15 ***
## workers_alive 35.058 1 3.200e-09 ***
## duration 0.253 1 0.615167
## avg_pollen 19.007 1 1.302e-05 ***
## fungicide:crithidia 0.286 1 0.592710
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(brood.mod, test = "Chisq")
## Single term deletions
##
## Model:
## brood_cells ~ fungicide * crithidia + block + workers_alive +
## duration + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 49.836 249.43
## block 8 137.307 320.90 87.471 1.515e-15 ***
## workers_alive 1 84.894 282.48 35.058 3.200e-09 ***
## duration 1 50.089 247.68 0.253 0.6152
## avg_pollen 1 68.843 266.43 19.007 1.302e-05 ***
## fungicide:crithidia 1 50.122 247.71 0.286 0.5927
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
brood.mod <- glm(brood_cells ~ fungicide + crithidia + block + workers_alive + duration + avg_pollen, data = brood, family = "poisson")
Anova(brood.mod)
## Analysis of Deviance Table (Type II tests)
##
## Response: brood_cells
## LR Chisq Df Pr(>Chisq)
## fungicide 17.065 1 3.613e-05 ***
## crithidia 1.142 1 0.2853
## block 144.440 8 < 2.2e-16 ***
## workers_alive 46.697 1 8.284e-12 ***
## duration 0.051 1 0.8209
## avg_pollen 37.618 1 8.604e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(brood.mod)
##
## Call:
## glm(formula = brood_cells ~ fungicide + crithidia + block + workers_alive +
## duration + avg_pollen, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.2715 -1.3129 -0.0113 0.7457 2.6676
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.22582 0.83780 1.463 0.1434
## fungicideTRUE 0.30506 0.07459 4.090 4.31e-05 ***
## crithidiaTRUE 0.07661 0.07171 1.068 0.2854
## block4 -0.80926 0.17507 -4.622 3.79e-06 ***
## block6 -1.53435 0.30258 -5.071 3.96e-07 ***
## block7 -0.70856 0.16548 -4.282 1.85e-05 ***
## block8 -1.18429 0.17252 -6.865 6.67e-12 ***
## block9 -0.85542 0.15096 -5.666 1.46e-08 ***
## block10 0.01133 0.15394 0.074 0.9413
## block11 -1.30993 0.23389 -5.601 2.13e-08 ***
## block12 -0.36818 0.17402 -2.116 0.0344 *
## workers_alive 0.36984 0.05497 6.728 1.72e-11 ***
## duration -0.00368 0.01623 -0.227 0.8206
## avg_pollen 2.25736 0.37273 6.056 1.39e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 835.183 on 35 degrees of freedom
## Residual deviance: 75.399 on 22 degrees of freedom
## AIC: 253.42
##
## Number of Fisher Scoring iterations: 5
brood.mod <- glm.nb(brood_cells ~ fungicide + crithidia + block + workers_alive + duration + avg_pollen, data = brood)
## Warning in glm.nb(brood_cells ~ fungicide + crithidia + block + workers_alive +
## : alternation limit reached
Anova(brood.mod)
## Analysis of Deviance Table (Type II tests)
##
## Response: brood_cells
## LR Chisq Df Pr(>Chisq)
## fungicide 9.657 1 0.001886 **
## crithidia 0.493 1 0.482703
## block 89.641 8 5.500e-16 ***
## workers_alive 35.570 1 2.461e-09 ***
## duration 0.137 1 0.710886
## avg_pollen 19.689 1 9.112e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(brood.mod)
##
## Call:
## glm.nb(formula = brood_cells ~ fungicide + crithidia + block +
## workers_alive + duration + avg_pollen, data = brood, init.theta = 31.99881983,
## link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.95923 -0.92806 -0.01616 0.51861 2.10120
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.15461 1.11942 1.031 0.302338
## fungicideTRUE 0.33381 0.10757 3.103 0.001915 **
## crithidiaTRUE 0.07651 0.10781 0.710 0.477905
## block4 -0.92307 0.25751 -3.585 0.000338 ***
## block6 -1.48097 0.34083 -4.345 1.39e-05 ***
## block7 -0.78255 0.23518 -3.327 0.000877 ***
## block8 -1.30078 0.23444 -5.548 2.88e-08 ***
## block9 -0.91597 0.20677 -4.430 9.43e-06 ***
## block10 0.02685 0.21927 0.122 0.902542
## block11 -1.38420 0.28411 -4.872 1.10e-06 ***
## block12 -0.37987 0.24030 -1.581 0.113916
## workers_alive 0.43251 0.07442 5.812 6.18e-09 ***
## duration -0.00802 0.02155 -0.372 0.709811
## avg_pollen 2.32869 0.53039 4.390 1.13e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(31.9988) family taken to be 1)
##
## Null deviance: 515.429 on 35 degrees of freedom
## Residual deviance: 50.724 on 22 degrees of freedom
## AIC: 249.71
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 32.0
## Std. Err.: 18.8
## Warning while fitting theta: alternation limit reached
##
## 2 x log-likelihood: -219.708
drop1(brood.mod, test = "Chisq")
## Single term deletions
##
## Model:
## brood_cells ~ fungicide + crithidia + block + workers_alive +
## duration + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 50.724 247.71
## fungicide 1 60.381 255.37 9.657 0.001886 **
## crithidia 1 51.216 246.20 0.493 0.482703
## block 8 140.365 321.35 89.641 5.500e-16 ***
## workers_alive 1 86.294 281.28 35.570 2.461e-09 ***
## duration 1 50.861 245.85 0.137 0.710886
## avg_pollen 1 70.413 265.40 19.689 9.112e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
bm1 <- update(brood.mod, .~. -duration)
## Warning in glm.nb(formula = brood_cells ~ fungicide + crithidia + block + :
## alternation limit reached
drop1(bm1, test = "Chisq")
## Single term deletions
##
## Model:
## brood_cells ~ fungicide + crithidia + block + workers_alive +
## avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 51.222 245.84
## fungicide 1 60.858 253.48 9.635 0.001909 **
## crithidia 1 51.658 244.28 0.436 0.509110
## block 8 153.184 331.81 101.962 < 2.2e-16 ***
## workers_alive 1 92.733 285.35 41.511 1.172e-10 ***
## avg_pollen 1 71.821 264.44 20.599 5.663e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
bm3 <- update(bm1, .~. -crithidia)
## Warning in glm.nb(formula = brood_cells ~ fungicide + block + workers_alive + :
## alternation limit reached
drop1(bm3, test = "Chisq")
## Single term deletions
##
## Model:
## brood_cells ~ fungicide + block + workers_alive + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 50.907 244.27
## fungicide 1 59.994 251.36 9.087 0.002574 **
## block 8 152.195 329.56 101.289 < 2.2e-16 ***
## workers_alive 1 91.526 282.89 40.619 1.850e-10 ***
## avg_pollen 1 70.579 261.94 19.672 9.192e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(bm1, bm3)
## df AIC
## bm1 14 247.8438
## bm3 13 246.2726
Anova(bm3)
## Analysis of Deviance Table (Type II tests)
##
## Response: brood_cells
## LR Chisq Df Pr(>Chisq)
## fungicide 9.087 1 0.002574 **
## block 101.289 8 < 2.2e-16 ***
## workers_alive 40.619 1 1.850e-10 ***
## avg_pollen 19.672 1 9.192e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qqnorm(resid(bm3));qqline(resid(bm3))

broodem <- emmeans(bm1, pairwise ~ fungicide*crithidia, type = "response")
broodem
## $emmeans
## fungicide crithidia response SE df asymp.LCL asymp.UCL
## FALSE FALSE 11.7 1.27 Inf 9.48 14.5
## TRUE FALSE 16.3 1.50 Inf 13.59 19.5
## FALSE TRUE 12.6 1.33 Inf 10.23 15.5
## TRUE TRUE 17.5 1.75 Inf 14.36 21.3
##
## Results are averaged over the levels of: block
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
##
## $contrasts
## contrast ratio SE df null z.ratio p.value
## FALSE FALSE / TRUE FALSE 0.720 0.0764 Inf 1 -3.096 0.0106
## FALSE FALSE / FALSE TRUE 0.932 0.0989 Inf 1 -0.666 0.9099
## FALSE FALSE / TRUE TRUE 0.671 0.1055 Inf 1 -2.541 0.0539
## TRUE FALSE / FALSE TRUE 1.295 0.1847 Inf 1 1.809 0.2691
## TRUE FALSE / TRUE TRUE 0.932 0.0989 Inf 1 -0.666 0.9099
## FALSE TRUE / TRUE TRUE 0.720 0.0764 Inf 1 -3.096 0.0106
##
## Results are averaged over the levels of: block
## P value adjustment: tukey method for comparing a family of 4 estimates
## Tests are performed on the log scale
broodem.df <- as.data.frame(broodem$emmeans)
broodem.df
## fungicide crithidia response SE df asymp.LCL asymp.UCL
## FALSE FALSE 11.71797 1.270220 Inf 9.475078 14.49179
## TRUE FALSE 16.28037 1.498668 Inf 13.592773 19.49937
## FALSE TRUE 12.57647 1.325379 Inf 10.229498 15.46191
## TRUE TRUE 17.47312 1.748343 Inf 14.361512 21.25890
##
## Results are averaged over the levels of: block
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
broodem.df$treatment <- c(1, 2, 4, 3)
broodem.df$treatment <-as.factor(broodem.df$treatment)
broodcld <- cld(object = broodem,
adjust = "Tukey",
Letters = letters,
alpha = 0.05)
broodcld
## fungicide crithidia response SE df asymp.LCL asymp.UCL .group
## FALSE FALSE 11.7 1.27 Inf 8.95 15.4 ab
## FALSE TRUE 12.6 1.33 Inf 9.67 16.4 a c
## TRUE FALSE 16.3 1.50 Inf 12.94 20.5 cd
## TRUE TRUE 17.5 1.75 Inf 13.62 22.4 b d
##
## Results are averaged over the levels of: block
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## Intervals are back-transformed from the log scale
## P value adjustment: tukey method for comparing a family of 4 estimates
## Tests are performed on the log scale
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
brood_sum <- brood %>%
group_by(fungicide) %>%
summarise(mb = mean(brood_cells),
nb = length(brood_cells),
sdb = sd(brood_cells)) %>%
mutate(seb = (sdb/sqrt(nb)))
brood_sum
## # A tibble: 2 × 5
## fungicide mb nb sdb seb
## <fct> <dbl> <int> <dbl> <dbl>
## 1 FALSE 27.3 18 24.3 5.72
## 2 TRUE 25.7 18 22.8 5.37
ggplot(data = broodem.df, aes(x = treatment, y = response, fill = treatment)) +
geom_col_pattern(
aes(pattern_density = treatment),
pattern = "stripe", # Set a common pattern type, but differentiate density
pattern_density = c(0, 0, 0.4, 0), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 25)) +
geom_errorbar(aes(ymin = response - SE, ymax = response + SE), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Average Brood Cells") +
theme_classic(base_size = 20) +
annotate(
geom = "text",
x = 1,
y = 20,
label = "P < 0.001",
size = 7
) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_density_manual(values = c("none", "none", "stripe", "none")) +
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none") +
geom_segment(x = 2, xend = 3, y = 21, yend = 21,
lineend = "round", linejoin = "round") +
geom_segment(x = 2, xend = 2, y = 20.5, yend = 21.5,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 3, y = 20.5, yend = 21.5,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 4, y = 23, yend = 23,
lineend = "round", linejoin = "round") +
geom_segment(x =1, xend = 1, y = 22.5, yend = 23.5,
lineend = "round", linejoin = "round") +
geom_segment(x = 4, xend = 4, y = 22.5, yend = 23.5,
lineend = "round", linejoin = "round") +
geom_text(x = 2.5, y = 21.5, label = "a", size = 6, vjust = -0.5) +
geom_text(x = 2.5, y = 23.5, label = "b", size = 6, vjust = -0.5)

ggplot(data = broodem.df, aes(x = treatment, y = response, fill = treatment)) +
geom_col_pattern(
aes(pattern_density = treatment),
pattern = "stripe", # Set a common pattern type, but differentiate density
pattern_density = c(0, 0, 0, 0.4), # Add density for the third column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 25)) +
geom_errorbar(aes(ymin = response - SE, ymax = response + SE), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Average Brood Cells") +
theme_classic(base_size = 20) +
annotate(
geom = "text",
x = 1,
y = 20,
label = "P < 0.001",
size = 7
) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_density_manual(values = c(0, 0, 0, 0.4)) +
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none") +
geom_segment(x = 2, xend = 3, y = 21, yend = 21,
lineend = "round", linejoin = "round") +
geom_segment(x = 2, xend = 2, y = 20.5, yend = 21.5,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 3, y = 20.5, yend = 21.5,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 4, y = 23, yend = 23,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 1, y = 22.5, yend = 23.5,
lineend = "round", linejoin = "round") +
geom_segment(x = 4, xend = 4, y = 22.5, yend = 23.5,
lineend = "round", linejoin = "round") +
geom_text(x = 2.5, y = 21.5, label = "b", size = 6, vjust = -0.5) +
geom_text(x = 2.5, y = 23.5, label = "a", size = 6, vjust = -0.5)

Live pupae
plot(brood$treatment, brood$live_pupae)

livepup.mod.int <- glm(live_pupae ~ fungicide +crithidia + workers_alive + duration + avg_pollen, data = brood, family = "poisson")
drop1(livepup.mod.int, test = "Chisq")
## Single term deletions
##
## Model:
## live_pupae ~ fungicide + crithidia + workers_alive + duration +
## avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 46.667 147.33
## fungicide 1 47.277 145.94 0.610 0.4347
## crithidia 1 48.451 147.12 1.784 0.1816
## workers_alive 1 67.688 166.35 21.021 4.542e-06 ***
## duration 1 51.610 150.28 4.943 0.0262 *
## avg_pollen 1 104.321 202.99 57.655 3.124e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
livepup.mod <- glm.nb(live_pupae ~ fungicide*crithidia + workers_alive + block + duration + avg_pollen, data = brood)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in glm.nb(live_pupae ~ fungicide * crithidia + workers_alive + block +
## : alternation limit reached
Anova(livepup.mod)
## Analysis of Deviance Table (Type II tests)
##
## Response: live_pupae
## LR Chisq Df Pr(>Chisq)
## fungicide 0.2574 1 0.611898
## crithidia 3.1498 1 0.075934 .
## workers_alive 12.7658 1 0.000353 ***
## block 11.4846 8 0.175721
## duration 4.3615 1 0.036760 *
## avg_pollen 23.2025 1 1.458e-06 ***
## fungicide:crithidia 0.1222 1 0.726688
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(livepup.mod, test = "Chisq")
## Single term deletions
##
## Model:
## live_pupae ~ fungicide * crithidia + workers_alive + block +
## duration + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 34.959 153.64
## workers_alive 1 47.725 164.40 12.7658 0.000353 ***
## block 8 46.444 149.12 11.4846 0.175721
## duration 1 39.321 156.00 4.3615 0.036760 *
## avg_pollen 1 58.162 174.84 23.2025 1.458e-06 ***
## fungicide:crithidia 1 35.081 151.76 0.1222 0.726688
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
livepup.mod <- glm(live_pupae ~ fungicide + crithidia + workers_alive + block + duration + avg_pollen, data = brood, family = "poisson")
Anova(livepup.mod)
## Analysis of Deviance Table (Type II tests)
##
## Response: live_pupae
## LR Chisq Df Pr(>Chisq)
## fungicide 0.2579 1 0.6115536
## crithidia 3.1538 1 0.0757492 .
## workers_alive 12.6561 1 0.0003743 ***
## block 11.5771 8 0.1710932
## duration 4.4296 1 0.0353208 *
## avg_pollen 23.0991 1 1.539e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
livepup.mod.nb <- glm.nb(live_pupae ~ fungicide + crithidia + workers_alive + block + duration + avg_pollen, data = brood)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in glm.nb(live_pupae ~ fungicide + crithidia + workers_alive + block +
## : alternation limit reached
Anova(livepup.mod.nb)
## Analysis of Deviance Table (Type II tests)
##
## Response: live_pupae
## LR Chisq Df Pr(>Chisq)
## fungicide 0.2574 1 0.6119094
## crithidia 3.1497 1 0.0759404 .
## workers_alive 12.6524 1 0.0003751 ***
## block 11.5747 8 0.1712097
## duration 4.4289 1 0.0353345 *
## avg_pollen 23.0894 1 1.546e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
lpnb1 <- update(livepup.mod.nb, .~. -block)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in glm.nb(formula = live_pupae ~ fungicide + crithidia + workers_alive
## + : alternation limit reached
drop1(lpnb1, test = "Chisq")
## Single term deletions
##
## Model:
## live_pupae ~ fungicide + crithidia + workers_alive + duration +
## avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 46.648 147.34
## fungicide 1 47.256 145.94 0.608 0.43552
## crithidia 1 48.426 147.11 1.778 0.18238
## workers_alive 1 67.656 166.34 21.008 4.574e-06 ***
## duration 1 51.586 150.27 4.938 0.02627 *
## avg_pollen 1 104.253 202.94 57.605 3.204e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(lpnb1)
##
## Call:
## glm.nb(formula = live_pupae ~ fungicide + crithidia + workers_alive +
## duration + avg_pollen, data = brood, init.theta = 9275.737704,
## link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.2877 -0.9999 -0.4254 0.4985 3.2316
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -4.82616 1.52562 -3.163 0.00156 **
## fungicideTRUE -0.11596 0.14912 -0.778 0.43679
## crithidiaTRUE -0.20690 0.15682 -1.319 0.18705
## workers_alive 0.51275 0.12068 4.249 2.15e-05 ***
## duration 0.06014 0.02679 2.245 0.02476 *
## avg_pollen 3.44634 0.48603 7.091 1.33e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(9275.738) family taken to be 1)
##
## Null deviance: 252.605 on 35 degrees of freedom
## Residual deviance: 46.648 on 30 degrees of freedom
## AIC: 149.33
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 9276
## Std. Err.: 120994
## Warning while fitting theta: alternation limit reached
##
## 2 x log-likelihood: -135.335
Anova(lpnb1)
## Analysis of Deviance Table (Type II tests)
##
## Response: live_pupae
## LR Chisq Df Pr(>Chisq)
## fungicide 0.608 1 0.43552
## crithidia 1.778 1 0.18238
## workers_alive 21.008 1 4.574e-06 ***
## duration 4.938 1 0.02627 *
## avg_pollen 57.605 1 3.204e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qqnorm(resid(livepup.mod));qqline(resid(livepup.mod))

plot(livepup.mod)




AIC(livepup.mod, livepup.mod.nb)
## df AIC
## livepup.mod 14 151.7561
## livepup.mod.nb 15 153.7595
anova(livepup.mod, livepup.mod.nb, test = "Chisq")
## Analysis of Deviance Table
##
## Model 1: live_pupae ~ fungicide + crithidia + workers_alive + block +
## duration + avg_pollen
## Model 2: live_pupae ~ fungicide + crithidia + workers_alive + block +
## duration + avg_pollen
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 22 35.089
## 2 22 35.081 0 0.0084061
drop1(livepup.mod, test = "Chisq")
## Single term deletions
##
## Model:
## live_pupae ~ fungicide + crithidia + workers_alive + block +
## duration + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 35.089 151.76
## fungicide 1 35.347 150.01 0.2579 0.6115536
## crithidia 1 38.243 152.91 3.1538 0.0757492 .
## workers_alive 1 47.746 162.41 12.6561 0.0003743 ***
## block 8 46.667 147.33 11.5771 0.1710932
## duration 1 39.519 154.19 4.4296 0.0353208 *
## avg_pollen 1 58.189 172.85 23.0991 1.539e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
lp1 <- update(livepup.mod, .~. -block)
drop1(lp1, test = "Chisq")
## Single term deletions
##
## Model:
## live_pupae ~ fungicide + crithidia + workers_alive + duration +
## avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 46.667 147.33
## fungicide 1 47.277 145.94 0.610 0.4347
## crithidia 1 48.451 147.12 1.784 0.1816
## workers_alive 1 67.688 166.35 21.021 4.542e-06 ***
## duration 1 51.610 150.28 4.943 0.0262 *
## avg_pollen 1 104.321 202.99 57.655 3.124e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
lp2 <- update(lp1, .~. -duration)
Anova(lp2)
## Analysis of Deviance Table (Type II tests)
##
## Response: live_pupae
## LR Chisq Df Pr(>Chisq)
## fungicide 0.544 1 0.4607
## crithidia 1.940 1 0.1636
## workers_alive 16.636 1 4.528e-05 ***
## avg_pollen 52.745 1 3.798e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(lp1)
##
## Call:
## glm(formula = live_pupae ~ fungicide + crithidia + workers_alive +
## duration + avg_pollen, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.2883 -0.9998 -0.4256 0.4991 3.2325
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -4.82576 1.52462 -3.165 0.00155 **
## fungicideTRUE -0.11609 0.14903 -0.779 0.43599
## crithidiaTRUE -0.20712 0.15674 -1.321 0.18634
## workers_alive 0.51273 0.12063 4.251 2.13e-05 ***
## duration 0.06014 0.02677 2.247 0.02467 *
## avg_pollen 3.44614 0.48583 7.093 1.31e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 252.752 on 35 degrees of freedom
## Residual deviance: 46.667 on 30 degrees of freedom
## AIC: 147.33
##
## Number of Fisher Scoring iterations: 5
Anova(lp1)
## Analysis of Deviance Table (Type II tests)
##
## Response: live_pupae
## LR Chisq Df Pr(>Chisq)
## fungicide 0.610 1 0.4347
## crithidia 1.784 1 0.1816
## workers_alive 21.021 1 4.542e-06 ***
## duration 4.943 1 0.0262 *
## avg_pollen 57.655 1 3.124e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qqnorm(resid(lp1));qqline(resid(lp1))

anova(livepup.mod, lp1, test = "Chisq")
## Analysis of Deviance Table
##
## Model 1: live_pupae ~ fungicide + crithidia + workers_alive + block +
## duration + avg_pollen
## Model 2: live_pupae ~ fungicide + crithidia + workers_alive + duration +
## avg_pollen
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 22 35.089
## 2 30 46.667 -8 -11.577 0.1711
AIC(livepup.mod, lp1)
## df AIC
## livepup.mod 14 151.7561
## lp1 6 147.3332
be <- emmeans(lp1, "crithidia")
pairs(be)
## contrast estimate SE df z.ratio p.value
## FALSE - TRUE 0.207 0.157 Inf 1.321 0.1863
##
## Results are averaged over the levels of: fungicide
## Results are given on the log (not the response) scale.
broodem <- emmeans(lp1, pairwise ~ crithidia, type = "response")
broodem
## $emmeans
## crithidia rate SE df asymp.LCL asymp.UCL
## FALSE 2.79 0.429 Inf 2.06 3.77
## TRUE 2.27 0.370 Inf 1.65 3.12
##
## Results are averaged over the levels of: fungicide
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
##
## $contrasts
## contrast ratio SE df null z.ratio p.value
## FALSE / TRUE 1.23 0.193 Inf 1 1.321 0.1863
##
## Results are averaged over the levels of: fungicide
## Tests are performed on the log scale
broodem <- emmeans(lp1, pairwise ~ crithidia*fungicide, type = "response")
broodcld <- cld(object = broodem,
adjust = "Tukey",
Letters = letters,
alpha = 0.05)
broodcld
## crithidia fungicide rate SE df asymp.LCL asymp.UCL .group
## TRUE TRUE 2.14 0.386 Inf 1.36 3.35 a
## TRUE FALSE 2.40 0.429 Inf 1.54 3.75 a
## FALSE TRUE 2.63 0.458 Inf 1.71 4.06 a
## FALSE FALSE 2.95 0.495 Inf 1.95 4.49 a
##
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## Intervals are back-transformed from the log scale
## P value adjustment: tukey method for comparing a family of 4 estimates
## Tests are performed on the log scale
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
livepup_sum <- brood %>%
group_by(treatment) %>%
summarise(mb = mean(live_pupae),
nb = length(live_pupae),
sdb = sd(live_pupae)) %>%
mutate(seb = (sdb/sqrt(nb)))
livepup_sum
## # A tibble: 4 × 5
## treatment mb nb sdb seb
## <fct> <dbl> <int> <dbl> <dbl>
## 1 1 8.22 9 7.58 2.53
## 2 2 5.89 9 7.54 2.51
## 3 3 2.89 9 3.30 1.10
## 4 4 4 9 5.17 1.72
ggplot(data = livepup_sum, aes(x = treatment, y = mb, fill = treatment, pattern = treatment)) +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0.4, 0), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 13)) +
geom_errorbar(aes(ymin = mb - seb, ymax = mb + seb), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Average Live Pupae") +
theme_classic(base_size = 20) +
annotate(
geom = "text",
x = 2,
y = 12.5,
label = "P > 0.05",
size = 12
) +
scale_x_discrete(labels = custom_labels) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_manual(values = c("none", "none", "stripe", "none")) +
theme(legend.position = "none")

#geom_segment(x = 1, xend = 2, y = 12, yend = 12,
# lineend = "round", linejoin = "round") +
#geom_segment(x = 1, xend = 1, y = 11.8, yend = 12.2,
# lineend = "round", linejoin = "round") +
# geom_segment(x = 2, xend = 2, y = 11.8, yend = 12.2,
# lineend = "round", linejoin = "round") +
# geom_segment(x = 3, xend = 4, y = 7, yend = 7,
# lineend = "round", linejoin = "round") +
# geom_segment(x = 3, xend = 3, y = 6.8, yend = 7.2,
# lineend = "round", linejoin = "round") +
# geom_segment(x = 4, xend = 4, y = 6.8, yend = 7.2,
# lineend = "round", linejoin = "round") +
# geom_text(x = 1.5, y = 12, label = "a", size = 6, vjust = -0.5) +
# geom_text(x = 3.5, y = 7, label = "b", size = 6, vjust = -0.5) +
plot(brood$treatment, brood$live_larvae)
livelar.mod <- glm(live_larvae ~ fungicide + crithidia + workers_alive + block + duration + avg_pollen , data = brood, family = "poisson")
summary(livelar.mod) #overdisp
##
## Call:
## glm(formula = live_larvae ~ fungicide + crithidia + workers_alive +
## block + duration + avg_pollen, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.6068 -1.6238 -0.5069 1.0864 2.5547
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.90936 1.11950 1.706 0.088094 .
## fungicideTRUE 0.19053 0.09850 1.934 0.053080 .
## crithidiaTRUE 0.18432 0.09419 1.957 0.050357 .
## workers_alive 0.34362 0.07345 4.678 2.89e-06 ***
## block4 -0.35446 0.23717 -1.495 0.135039
## block6 -1.82877 0.60694 -3.013 0.002586 **
## block7 -0.55917 0.23774 -2.352 0.018674 *
## block8 -0.90571 0.24315 -3.725 0.000195 ***
## block9 -0.66470 0.22504 -2.954 0.003140 **
## block10 0.75755 0.22272 3.401 0.000671 ***
## block11 -1.31312 0.38511 -3.410 0.000650 ***
## block12 0.32055 0.23934 1.339 0.180472
## duration -0.03840 0.02207 -1.740 0.081935 .
## avg_pollen 2.24259 0.48644 4.610 4.02e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 690.91 on 35 degrees of freedom
## Residual deviance: 91.83 on 22 degrees of freedom
## AIC: 237.57
##
## Number of Fisher Scoring iterations: 5
livelar.mod.int <- glm(live_larvae ~ fungicide*crithidia + workers_alive + block + duration + avg_pollen, data = brood, family = "poisson")
summary(livelar.mod.int) #overdisp
##
## Call:
## glm(formula = live_larvae ~ fungicide * crithidia + workers_alive +
## block + duration + avg_pollen, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.6955 -1.6402 -0.5423 1.1193 2.2554
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.17431 1.15107 1.889 0.058898 .
## fungicideTRUE 0.12449 0.12521 0.994 0.320099
## crithidiaTRUE 0.11112 0.12715 0.874 0.382157
## workers_alive 0.34537 0.07376 4.682 2.83e-06 ***
## block4 -0.36849 0.23880 -1.543 0.122817
## block6 -1.83346 0.60674 -3.022 0.002513 **
## block7 -0.56421 0.23834 -2.367 0.017924 *
## block8 -0.91356 0.24198 -3.775 0.000160 ***
## block9 -0.70003 0.22921 -3.054 0.002257 **
## block10 0.76821 0.22112 3.474 0.000512 ***
## block11 -1.35595 0.38821 -3.493 0.000478 ***
## block12 0.29780 0.24254 1.228 0.219513
## duration -0.04277 0.02246 -1.904 0.056896 .
## avg_pollen 2.16957 0.49298 4.401 1.08e-05 ***
## fungicideTRUE:crithidiaTRUE 0.15563 0.18144 0.858 0.391032
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 690.912 on 35 degrees of freedom
## Residual deviance: 91.094 on 21 degrees of freedom
## AIC: 238.84
##
## Number of Fisher Scoring iterations: 5
livelar.mod.nb.int <- glm.nb(live_larvae ~ fungicide*crithidia + workers_alive + block + duration + avg_pollen , data = brood)
## Warning in glm.nb(live_larvae ~ fungicide * crithidia + workers_alive + :
## alternation limit reached
summary(livelar.mod.nb.int)
##
## Call:
## glm.nb(formula = live_larvae ~ fungicide * crithidia + workers_alive +
## block + duration + avg_pollen, data = brood, init.theta = 9.07466479,
## link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.9298 -1.2359 -0.3805 0.5865 2.1165
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.36901 1.86239 0.735 0.462291
## fungicideTRUE 0.12018 0.22743 0.528 0.597224
## crithidiaTRUE -0.02186 0.24449 -0.089 0.928765
## workers_alive 0.43366 0.12208 3.552 0.000382 ***
## block4 -0.65537 0.43381 -1.511 0.130857
## block6 -1.75205 0.68248 -2.567 0.010252 *
## block7 -0.65454 0.39712 -1.648 0.099312 .
## block8 -1.20924 0.39409 -3.068 0.002152 **
## block9 -0.75635 0.35561 -2.127 0.033425 *
## block10 0.70621 0.37204 1.898 0.057666 .
## block11 -1.48747 0.51072 -2.912 0.003586 **
## block12 0.37671 0.39256 0.960 0.337239
## duration -0.03602 0.03572 -1.009 0.313178
## avg_pollen 2.70545 0.87460 3.093 0.001979 **
## fungicideTRUE:crithidiaTRUE 0.27237 0.34618 0.787 0.431409
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(9.0747) family taken to be 1)
##
## Null deviance: 311.724 on 35 degrees of freedom
## Residual deviance: 51.376 on 21 degrees of freedom
## AIC: 229.7
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 9.07
## Std. Err.: 5.05
## Warning while fitting theta: alternation limit reached
##
## 2 x log-likelihood: -197.70
drop1(livelar.mod.nb.int, test = "Chisq")
## Single term deletions
##
## Model:
## live_larvae ~ fungicide * crithidia + workers_alive + block +
## duration + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 51.376 227.70
## workers_alive 1 63.882 238.21 12.506 0.0004056 ***
## block 8 107.289 267.61 55.913 2.933e-09 ***
## duration 1 52.267 226.59 0.891 0.3452583
## avg_pollen 1 60.587 234.91 9.211 0.0024050 **
## fungicide:crithidia 1 51.987 226.31 0.611 0.4344570
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
livelar.mod.nb <- glm.nb(live_larvae ~ fungicide + crithidia + workers_alive + block + duration + avg_pollen , data = brood) #start with this one
## Warning in glm.nb(live_larvae ~ fungicide + crithidia + workers_alive + :
## alternation limit reached
summary(livelar.mod.nb)
##
## Call:
## glm.nb(formula = live_larvae ~ fungicide + crithidia + workers_alive +
## block + duration + avg_pollen, data = brood, init.theta = 8.987768981,
## link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.8127 -1.1505 -0.4229 0.5430 2.1928
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.98943 1.81342 0.546 0.58533
## fungicideTRUE 0.23197 0.17923 1.294 0.19557
## crithidiaTRUE 0.10121 0.18221 0.555 0.57858
## workers_alive 0.42852 0.12171 3.521 0.00043 ***
## block4 -0.60665 0.43116 -1.407 0.15942
## block6 -1.77937 0.68529 -2.597 0.00942 **
## block7 -0.63088 0.39774 -1.586 0.11270
## block8 -1.16564 0.39233 -2.971 0.00297 **
## block9 -0.71906 0.35055 -2.051 0.04024 *
## block10 0.70056 0.37496 1.868 0.06171 .
## block11 -1.42670 0.50319 -2.835 0.00458 **
## block12 0.38682 0.39093 0.989 0.32243
## duration -0.02891 0.03499 -0.826 0.40872
## avg_pollen 2.73864 0.87600 3.126 0.00177 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(8.9878) family taken to be 1)
##
## Null deviance: 310.310 on 35 degrees of freedom
## Residual deviance: 51.831 on 22 degrees of freedom
## AIC: 228.31
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 8.99
## Std. Err.: 5.08
## Warning while fitting theta: alternation limit reached
##
## 2 x log-likelihood: -198.31
drop1(livelar.mod.nb, test = "Chisq")
## Single term deletions
##
## Model:
## live_larvae ~ fungicide + crithidia + workers_alive + block +
## duration + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 51.831 226.31
## fungicide 1 53.501 225.98 1.670 0.1961955
## crithidia 1 52.126 224.60 0.295 0.5868366
## workers_alive 1 64.093 236.57 12.262 0.0004623 ***
## block 8 107.087 265.57 55.256 3.936e-09 ***
## duration 1 52.440 224.92 0.609 0.4352187
## avg_pollen 1 61.252 233.73 9.421 0.0021450 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ll1 <-update(livelar.mod.nb, .~. -duration)
drop1(ll1, test = "Chisq")
## Single term deletions
##
## Model:
## live_larvae ~ fungicide + crithidia + workers_alive + block +
## avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 51.138 224.90
## fungicide 1 52.618 224.38 1.480 0.223743
## crithidia 1 51.325 223.09 0.188 0.664965
## workers_alive 1 66.612 238.38 15.474 8.363e-05 ***
## block 8 107.238 265.00 56.100 2.697e-09 ***
## avg_pollen 1 60.958 232.72 9.820 0.001726 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(ll1)
##
## Call:
## glm.nb(formula = live_larvae ~ fungicide + crithidia + workers_alive +
## block + avg_pollen, data = brood, init.theta = 8.31087449,
## link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.8906 -1.0503 -0.3603 0.6087 2.1456
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.48898 0.50908 -0.961 0.336787
## fungicideTRUE 0.22321 0.18244 1.224 0.221140
## crithidiaTRUE 0.08251 0.18540 0.445 0.656290
## workers_alive 0.46356 0.11923 3.888 0.000101 ***
## block4 -0.53894 0.43472 -1.240 0.215077
## block6 -1.86957 0.68175 -2.742 0.006101 **
## block7 -0.52319 0.38118 -1.373 0.169885
## block8 -1.11085 0.39494 -2.813 0.004913 **
## block9 -0.63959 0.35012 -1.827 0.067733 .
## block10 0.62654 0.36247 1.729 0.083891 .
## block11 -1.41876 0.50792 -2.793 0.005218 **
## block12 0.44021 0.39404 1.117 0.263929
## avg_pollen 2.84629 0.88950 3.200 0.001375 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(8.3109) family taken to be 1)
##
## Null deviance: 298.876 on 35 degrees of freedom
## Residual deviance: 51.138 on 23 degrees of freedom
## AIC: 226.9
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 8.31
## Std. Err.: 4.54
##
## 2 x log-likelihood: -198.903
Anova(ll1)
## Analysis of Deviance Table (Type II tests)
##
## Response: live_larvae
## LR Chisq Df Pr(>Chisq)
## fungicide 1.480 1 0.223743
## crithidia 0.188 1 0.664965
## workers_alive 15.474 1 8.363e-05 ***
## block 56.100 8 2.697e-09 ***
## avg_pollen 9.820 1 0.001726 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
broodem <- emmeans(ll1, pairwise ~ crithidia, type = "response")
broodcld <- cld(object = broodem,
adjust = "Tukey",
Letters = letters,
alpha = 0.05)
broodcld
## crithidia response SE df asymp.LCL asymp.UCL .group
## FALSE 6.31 0.956 Inf 4.49 8.85 a
## TRUE 6.85 1.057 Inf 4.85 9.67 a
##
## Results are averaged over the levels of: fungicide, block
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## Intervals are back-transformed from the log scale
## Tests are performed on the log scale
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
livelarv_sum <- brood %>%
group_by(treatment) %>%
summarise(mb = mean(live_larvae),
nb = length(live_larvae),
sdb = sd(live_larvae)) %>%
mutate(seb = (sdb/sqrt(nb)))
livelarv_sum
## # A tibble: 4 × 5
## treatment mb nb sdb seb
## <fct> <dbl> <int> <dbl> <dbl>
## 1 1 20.7 9 19.0 6.34
## 2 2 15.1 9 11.0 3.68
## 3 3 12.8 9 19.5 6.52
## 4 4 14.9 9 18.7 6.23
livelarv_sum$plot <- livelarv_sum$mb + livelarv_sum$seb
plot(brood$treatment, brood$live_larvae)

ggplot(data = livelarv_sum, aes(x = treatment, y = mb, fill = treatment)) +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0, 0.4), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 35)) +
geom_errorbar(aes(ymin = mb - seb, ymax = mb + seb), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Average Live Pupae") +
theme_classic(base_size = 20) +
annotate(
geom = "text",
x = 1,
y = 34,
label = "P > 0.5",
size = 7
) +
scale_fill_manual(values = c("lightgreen", "lightblue", "grey", "lightblue")) +
scale_pattern_manual(values = c("none", "none", "none", "stripe")) + # Add stripes to the fourth column
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none")

Dead larvae count
dl.mod.pois <- glm(dead_larvae ~ fungicide + crithidia + avg_pollen + workers_alive + block + duration, data = brood, family = "poisson")
summary(dl.mod.pois) #overdisp
##
## Call:
## glm(formula = dead_larvae ~ fungicide + crithidia + avg_pollen +
## workers_alive + block + duration, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.2912 -1.2869 -0.6832 0.3491 3.0516
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -10.264220 4.789264 -2.143 0.0321 *
## fungicideTRUE 0.083851 0.320333 0.262 0.7935
## crithidiaTRUE -0.008702 0.317055 -0.027 0.9781
## avg_pollen 4.213135 1.807802 2.331 0.0198 *
## workers_alive 0.241475 0.216043 1.118 0.2637
## block4 -0.227251 0.816578 -0.278 0.7808
## block6 -0.193539 0.770278 -0.251 0.8016
## block7 0.715601 0.679101 1.054 0.2920
## block8 -0.690911 0.828415 -0.834 0.4043
## block9 0.701074 0.696017 1.007 0.3138
## block10 -0.985941 0.749115 -1.316 0.1881
## block11 -1.156822 1.109631 -1.043 0.2972
## block12 -0.185549 0.807885 -0.230 0.8183
## duration 0.173330 0.089374 1.939 0.0525 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 99.573 on 35 degrees of freedom
## Residual deviance: 69.971 on 22 degrees of freedom
## AIC: 144.73
##
## Number of Fisher Scoring iterations: 6
dl.mod <- glm.nb(dead_larvae ~ fungicide + crithidia + avg_pollen + workers_alive + block + duration, data = brood)
## Warning in glm.nb(dead_larvae ~ fungicide + crithidia + avg_pollen +
## workers_alive + : alternation limit reached
drop1(dl.mod, test = "Chisq")
## Single term deletions
##
## Model:
## dead_larvae ~ fungicide + crithidia + avg_pollen + workers_alive +
## block + duration
## Df Deviance AIC LRT Pr(>Chi)
## <none> 32.959 131.44
## fungicide 1 33.100 129.58 0.1413 0.70698
## crithidia 1 32.959 129.44 0.0007 0.97829
## avg_pollen 1 34.546 131.03 1.5875 0.20768
## workers_alive 1 33.888 130.37 0.9294 0.33501
## block 8 37.315 119.80 4.3565 0.82361
## duration 1 35.850 132.33 2.8916 0.08904 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dl1 <- update(dl.mod, .~. -block)
drop1(dl1, test = "Chisq")
## Single term deletions
##
## Model:
## dead_larvae ~ fungicide + crithidia + avg_pollen + workers_alive +
## duration
## Df Deviance AIC LRT Pr(>Chi)
## <none> 33.942 119.61
## fungicide 1 34.357 118.03 0.41527 0.5193
## crithidia 1 34.025 117.69 0.08335 0.7728
## avg_pollen 1 36.405 120.08 2.46344 0.1165
## workers_alive 1 35.135 118.80 1.19302 0.2747
## duration 1 34.731 118.40 0.78902 0.3744
dl2 <- update(dl1, .~. -duration)
drop1(dl2, test = "Chisq")
## Single term deletions
##
## Model:
## dead_larvae ~ fungicide + crithidia + avg_pollen + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 34.069 118.39
## fungicide 1 34.491 116.81 0.42200 0.5159
## crithidia 1 34.310 116.63 0.24113 0.6234
## avg_pollen 1 35.877 118.20 1.80740 0.1788
## workers_alive 1 34.709 117.03 0.63955 0.4239
dl3 <- update(dl2, .~. -workers_alive)
drop1(dl3, test = "Chisq")
## Single term deletions
##
## Model:
## dead_larvae ~ fungicide + crithidia + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 33.976 117.02
## fungicide 1 34.462 115.51 0.4862 0.48563
## crithidia 1 34.007 115.06 0.0316 0.85896
## avg_pollen 1 39.815 120.86 5.8390 0.01567 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(brood$treatment, brood$dead_larvae)

Anova(dl3)
## Analysis of Deviance Table (Type II tests)
##
## Response: dead_larvae
## LR Chisq Df Pr(>Chisq)
## fungicide 0.4862 1 0.48563
## crithidia 0.0316 1 0.85896
## avg_pollen 5.8390 1 0.01567 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(dl3)
##
## Call:
## glm.nb(formula = dead_larvae ~ fungicide + crithidia + avg_pollen,
## data = brood, init.theta = 0.694531903, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.5917 -1.0642 -0.8710 0.4214 1.5860
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.2997 0.7873 -1.651 0.0988 .
## fungicideTRUE 0.3838 0.5182 0.741 0.4589
## crithidiaTRUE 0.0926 0.5277 0.175 0.8607
## avg_pollen 2.8820 1.1724 2.458 0.0140 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(0.6945) family taken to be 1)
##
## Null deviance: 39.938 on 35 degrees of freedom
## Residual deviance: 33.976 on 32 degrees of freedom
## AIC: 119.02
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 0.695
## Std. Err.: 0.331
##
## 2 x log-likelihood: -109.023
dead pupae count
dp.mod.pois <- glm(dead_pupae ~ fungicide + crithidia + avg_pollen + workers_alive + duration, data = brood, family = "poisson")
summary(dp.mod.pois)
##
## Call:
## glm(formula = dead_pupae ~ fungicide + crithidia + avg_pollen +
## workers_alive + duration, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.1201 -0.3856 -0.1049 -0.0464 1.4458
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -23.6743 13.1053 -1.806 0.0708 .
## fungicideTRUE -0.1068 0.9890 -0.108 0.9140
## crithidiaTRUE 0.9183 1.1642 0.789 0.4302
## avg_pollen 15.2873 8.0731 1.894 0.0583 .
## workers_alive -1.1758 0.8133 -1.446 0.1483
## duration 0.3746 0.2278 1.644 0.1002
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 19.741 on 35 degrees of freedom
## Residual deviance: 10.051 on 30 degrees of freedom
## AIC: 32.051
##
## Number of Fisher Scoring iterations: 7
dp.mod <- glm.nb(dead_pupae ~ fungicide + crithidia + avg_pollen + workers_alive + duration, data = brood)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(dp.mod, test = "Chisq")
## Single term deletions
##
## Model:
## dead_pupae ~ fungicide + crithidia + avg_pollen + workers_alive +
## duration
## Df Deviance AIC LRT Pr(>Chi)
## <none> 10.051 32.051
## fungicide 1 10.062 30.063 0.0116 0.914168
## crithidia 1 10.687 30.688 0.6364 0.425029
## avg_pollen 1 18.853 38.854 8.8026 0.003008 **
## workers_alive 1 12.979 32.980 2.9288 0.087014 .
## duration 1 13.256 33.256 3.2053 0.073402 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dp1 <- update(dp.mod, .~. -duration)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(dp1, test = "Chisq")
## Single term deletions
##
## Model:
## dead_pupae ~ fungicide + crithidia + avg_pollen + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 13.256 33.256
## fungicide 1 13.489 31.490 0.2336 0.62883
## crithidia 1 13.410 31.411 0.1541 0.69468
## avg_pollen 1 19.183 37.183 5.9270 0.01491 *
## workers_alive 1 17.549 35.550 4.2932 0.03826 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(dp1)
## Analysis of Deviance Table (Type II tests)
##
## Response: dead_pupae
## LR Chisq Df Pr(>Chisq)
## fungicide 0.2336 1 0.62883
## crithidia 0.1541 1 0.69468
## avg_pollen 5.9270 1 0.01491 *
## workers_alive 4.2932 1 0.03826 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(dp1)
##
## Call:
## glm.nb(formula = dead_pupae ~ fungicide + crithidia + avg_pollen +
## workers_alive, data = brood, init.theta = 7846.456534, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.1378 -0.3987 -0.2465 -0.1208 1.3019
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.2686 1.6092 -2.031 0.0422 *
## fungicideTRUE 0.4393 0.9185 0.478 0.6324
## crithidiaTRUE 0.4173 1.0597 0.394 0.6938
## avg_pollen 8.6462 4.4149 1.958 0.0502 .
## workers_alive -1.0658 0.5938 -1.795 0.0726 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(7846.457) family taken to be 1)
##
## Null deviance: 19.740 on 35 degrees of freedom
## Residual deviance: 13.256 on 31 degrees of freedom
## AIC: 35.256
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 7846
## Std. Err.: 363756
## Warning while fitting theta: iteration limit reached
##
## 2 x log-likelihood: -23.256
plot(brood$treatment, brood$dead_pupae)

total larvae count
tl.mod.pois <- glm(total_larvae ~ fungicide + crithidia + avg_pollen + workers_alive + duration, data = brood, family = "poisson")
summary(tl.mod.pois)
##
## Call:
## glm(formula = total_larvae ~ fungicide + crithidia + avg_pollen +
## workers_alive + duration, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.5921 -2.5442 -0.6843 0.8945 5.5109
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.08609 0.82293 -3.750 0.000177 ***
## fungicideTRUE -0.08435 0.08169 -1.033 0.301766
## crithidiaTRUE 0.18685 0.08284 2.256 0.024101 *
## avg_pollen 3.82748 0.27731 13.802 < 2e-16 ***
## workers_alive 0.22489 0.05595 4.019 5.84e-05 ***
## duration 0.06806 0.01486 4.580 4.65e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 710.95 on 35 degrees of freedom
## Residual deviance: 217.27 on 30 degrees of freedom
## AIC: 354.1
##
## Number of Fisher Scoring iterations: 6
tl.mod <- glm.nb(total_larvae ~ fungicide + crithidia + avg_pollen + workers_alive + duration, data = brood)
drop1(tl.mod, test = "Chisq")
## Single term deletions
##
## Model:
## total_larvae ~ fungicide + crithidia + avg_pollen + workers_alive +
## duration
## Df Deviance AIC LRT Pr(>Chi)
## <none> 44.435 249.21
## fungicide 1 47.530 250.30 3.0954 0.07851 .
## crithidia 1 44.804 247.58 0.3699 0.54308
## avg_pollen 1 69.509 272.28 25.0744 5.516e-07 ***
## workers_alive 1 47.526 250.30 3.0914 0.07871 .
## duration 1 45.006 247.78 0.5711 0.44984
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
tl.mod1 <- update(tl.mod, .~. -duration)
drop1(tl.mod1, test = "Chisq")
## Single term deletions
##
## Model:
## total_larvae ~ fungicide + crithidia + avg_pollen + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 43.843 247.76
## fungicide 1 47.281 249.20 3.4379 0.06372 .
## crithidia 1 44.368 246.28 0.5250 0.46874
## avg_pollen 1 67.532 269.45 23.6883 1.133e-06 ***
## workers_alive 1 46.292 248.21 2.4490 0.11760
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
tl1 <- update(tl.mod1, .~. -workers_alive)
drop1(tl1, test = "Chisq")
## Single term deletions
##
## Model:
## total_larvae ~ fungicide + crithidia + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 43.813 248.13
## fungicide 1 46.281 248.60 2.468 0.1162
## crithidia 1 43.817 246.14 0.004 0.9516
## avg_pollen 1 92.798 295.12 48.985 2.579e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
tl2 <- update(tl1, .~. -crithidia)
drop1(tl2, test = "Chisq")
## Single term deletions
##
## Model:
## total_larvae ~ fungicide + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 43.803 246.14
## fungicide 1 46.268 246.60 2.465 0.1164
## avg_pollen 1 93.421 293.75 49.618 1.868e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(tl.mod, tl.mod1, tl1)
## df AIC
## tl.mod 7 251.2058
## tl.mod1 6 249.7599
## tl1 5 250.1334
anova(tl.mod1, tl1, test = "Chisq")
## Likelihood ratio tests of Negative Binomial Models
##
## Response: total_larvae
## Model theta Resid. df
## 1 fungicide + crithidia + avg_pollen 1.388644 32
## 2 fungicide + crithidia + avg_pollen + workers_alive 1.520016 31
## 2 x log-lik. Test df LR stat. Pr(Chi)
## 1 -240.1334
## 2 -237.7599 1 vs 2 1 2.373457 0.1234135
Anova(tl1)
## Analysis of Deviance Table (Type II tests)
##
## Response: total_larvae
## LR Chisq Df Pr(>Chisq)
## fungicide 2.468 1 0.1162
## crithidia 0.004 1 0.9516
## avg_pollen 48.985 1 2.579e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(tl1)
##
## Call:
## glm.nb(formula = total_larvae ~ fungicide + crithidia + avg_pollen,
## data = brood, init.theta = 1.388643983, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.8612 -1.3451 -0.4270 0.4856 1.4306
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.52648 0.48115 -1.094 0.2739
## fungicideTRUE 0.52458 0.31805 1.649 0.0991 .
## crithidiaTRUE 0.01889 0.32256 0.059 0.9533
## avg_pollen 6.06181 0.73581 8.238 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(1.3886) family taken to be 1)
##
## Null deviance: 94.065 on 35 degrees of freedom
## Residual deviance: 43.813 on 32 degrees of freedom
## AIC: 250.13
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 1.389
## Std. Err.: 0.448
##
## 2 x log-likelihood: -240.133
qqnorm(resid(tl.mod1));qqline(resid(tl.mod1))

plot(brood$treatment, brood$total_larvae)

total pupae
tp.mod.pois <- glm(total_pupae ~ fungicide + crithidia + avg_pollen + workers_alive + duration, data = brood, family = "poisson")
summary(tp.mod.pois)
##
## Call:
## glm(formula = total_pupae ~ fungicide + crithidia + avg_pollen +
## workers_alive + duration, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.4136 -1.0783 -0.3123 0.4326 2.9573
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -4.70478 1.48725 -3.163 0.001559 **
## fungicideTRUE -0.11071 0.14684 -0.754 0.450906
## crithidiaTRUE -0.18730 0.15421 -1.215 0.224525
## avg_pollen 3.57736 0.48383 7.394 1.43e-13 ***
## workers_alive 0.44154 0.11456 3.854 0.000116 ***
## duration 0.06339 0.02625 2.415 0.015736 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 251.819 on 35 degrees of freedom
## Residual deviance: 49.933 on 30 degrees of freedom
## AIC: 151.97
##
## Number of Fisher Scoring iterations: 6
tp.mod <- glm.nb(total_pupae ~ fungicide + crithidia + avg_pollen + workers_alive + duration, data = brood)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in glm.nb(total_pupae ~ fungicide + crithidia + avg_pollen +
## workers_alive + : alternation limit reached
drop1(tp.mod, test = "Chisq")
## Single term deletions
##
## Model:
## total_pupae ~ fungicide + crithidia + avg_pollen + workers_alive +
## duration
## Df Deviance AIC LRT Pr(>Chi)
## <none> 49.912 151.97
## fungicide 1 50.481 150.54 0.569 0.45079
## crithidia 1 51.409 151.47 1.497 0.22118
## avg_pollen 1 112.935 212.99 63.023 2.043e-15 ***
## workers_alive 1 66.728 166.78 16.816 4.118e-05 ***
## duration 1 55.640 155.70 5.728 0.01669 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qqnorm(resid(tp.mod));qqline(resid(tp.mod))

Anova(tp.mod)
## Analysis of Deviance Table (Type II tests)
##
## Response: total_pupae
## LR Chisq Df Pr(>Chisq)
## fungicide 0.569 1 0.45079
## crithidia 1.497 1 0.22118
## avg_pollen 63.023 1 2.043e-15 ***
## workers_alive 16.816 1 4.118e-05 ***
## duration 5.728 1 0.01669 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(tp.mod)
##
## Call:
## glm.nb(formula = total_pupae ~ fungicide + crithidia + avg_pollen +
## workers_alive + duration, data = brood, init.theta = 8477.73857,
## link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.4130 -1.0781 -0.3125 0.4323 2.9562
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -4.70524 1.48829 -3.162 0.001570 **
## fungicideTRUE -0.11053 0.14694 -0.752 0.451921
## crithidiaTRUE -0.18703 0.15430 -1.212 0.225464
## avg_pollen 3.57762 0.48405 7.391 1.46e-13 ***
## workers_alive 0.44155 0.11461 3.853 0.000117 ***
## duration 0.06339 0.02627 2.413 0.015811 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(8477.738) family taken to be 1)
##
## Null deviance: 251.656 on 35 degrees of freedom
## Residual deviance: 49.912 on 30 degrees of freedom
## AIC: 153.97
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 8478
## Std. Err.: 110861
## Warning while fitting theta: alternation limit reached
##
## 2 x log-likelihood: -139.969
plot(brood$treatment, brood$total_pupae)

total egg count
egg.mod.pois <- glm(eggs ~ fungicide + crithidia + avg_pollen + workers_alive + duration, data = brood, family = "poisson")
summary(egg.mod.pois)
##
## Call:
## glm(formula = eggs ~ fungicide + crithidia + avg_pollen + workers_alive +
## duration, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -6.271 -3.295 -0.419 1.565 10.143
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.14893 0.67314 0.221 0.8249
## fungicideTRUE 0.12523 0.07449 1.681 0.0927 .
## crithidiaTRUE 0.05861 0.07671 0.764 0.4448
## avg_pollen 1.73926 0.22538 7.717 1.19e-14 ***
## workers_alive 0.25345 0.04538 5.585 2.34e-08 ***
## duration 0.02166 0.01244 1.742 0.0816 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 713.26 on 35 degrees of freedom
## Residual deviance: 446.17 on 30 degrees of freedom
## AIC: 595.52
##
## Number of Fisher Scoring iterations: 5
egg.mod <- glm.nb(eggs ~ fungicide + crithidia + avg_pollen + workers_alive + duration, data = brood)
drop1(egg.mod, test = "Chisq")
## Single term deletions
##
## Model:
## eggs ~ fungicide + crithidia + avg_pollen + workers_alive + duration
## Df Deviance AIC LRT Pr(>Chi)
## <none> 43.917 283.18
## fungicide 1 45.280 282.54 1.3631 0.2430
## crithidia 1 43.938 281.20 0.0208 0.8853
## avg_pollen 1 46.480 283.74 2.5624 0.1094
## workers_alive 1 47.936 285.20 4.0188 0.0450 *
## duration 1 43.920 281.18 0.0024 0.9613
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
em1 <- update(egg.mod, .~. -duration)
drop1(em1, test = "Chisq")
## Single term deletions
##
## Model:
## eggs ~ fungicide + crithidia + avg_pollen + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 43.916 281.18
## fungicide 1 45.286 280.55 1.3697 0.24186
## crithidia 1 43.935 279.20 0.0191 0.89005
## avg_pollen 1 46.478 281.74 2.5623 0.10944
## workers_alive 1 48.379 283.64 4.4628 0.03464 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
em2 <- update(em1, .~. -avg_pollen)
drop1(em2, test = "Chisq")
## Single term deletions
##
## Model:
## eggs ~ fungicide + crithidia + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 43.367 281.62
## fungicide 1 43.939 280.19 0.5719 0.4495
## crithidia 1 43.482 279.73 0.1144 0.7352
## workers_alive 1 58.565 294.82 15.1974 9.684e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(em2)
## Analysis of Deviance Table (Type II tests)
##
## Response: eggs
## LR Chisq Df Pr(>Chisq)
## fungicide 0.5719 1 0.4495
## crithidia 0.1144 1 0.7352
## workers_alive 15.1974 1 9.684e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(em2)
##
## Call:
## glm.nb(formula = eggs ~ fungicide + crithidia + workers_alive,
## data = brood, init.theta = 0.9210361052, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.5071 -1.0676 -0.1225 0.3527 1.6103
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.7006 0.6135 1.142 0.253
## fungicideTRUE 0.2787 0.3643 0.765 0.444
## crithidiaTRUE -0.1241 0.3840 -0.323 0.747
## workers_alive 0.5793 0.1265 4.579 4.67e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(0.921) family taken to be 1)
##
## Null deviance: 59.183 on 35 degrees of freedom
## Residual deviance: 43.367 on 32 degrees of freedom
## AIC: 283.62
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 0.921
## Std. Err.: 0.251
##
## 2 x log-likelihood: -273.620
plot(brood$treatment, brood$eggs)

total honey pot
hp.mod <- glm.nb(honey_pots ~ fungicide + crithidia + avg_pollen + workers_alive, data = brood)
hp.mod.pois <- glm.nb(honey_pots ~ fungicide + crithidia + avg_pollen + workers_alive, data = brood)
summary(hp.mod.pois)
##
## Call:
## glm.nb(formula = honey_pots ~ fungicide + crithidia + avg_pollen +
## workers_alive, data = brood, init.theta = 19.67711085, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9346 -0.8011 -0.3146 0.3049 2.1513
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.4199 0.4270 -0.983 0.32542
## fungicideTRUE 0.4100 0.2147 1.910 0.05614 .
## crithidiaTRUE -0.2156 0.2246 -0.960 0.33705
## avg_pollen 1.7467 0.6130 2.849 0.00438 **
## workers_alive 0.1452 0.1121 1.296 0.19503
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(19.6771) family taken to be 1)
##
## Null deviance: 67.908 on 35 degrees of freedom
## Residual deviance: 35.669 on 31 degrees of freedom
## AIC: 143.06
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 19.7
## Std. Err.: 30.4
##
## 2 x log-likelihood: -131.059
anova(hp.mod, hp.mod.pois, test = "Chisq")
## Likelihood ratio tests of Negative Binomial Models
##
## Response: honey_pots
## Model theta Resid. df
## 1 fungicide + crithidia + avg_pollen + workers_alive 19.67711 31
## 2 fungicide + crithidia + avg_pollen + workers_alive 19.67711 31
## 2 x log-lik. Test df LR stat. Pr(Chi)
## 1 -131.0589
## 2 -131.0589 1 vs 2 0 0 1
AIC(hp.mod, hp.mod.pois)
## df AIC
## hp.mod 6 143.0589
## hp.mod.pois 6 143.0589
drop1(hp.mod.pois, test = "Chisq")
## Single term deletions
##
## Model:
## honey_pots ~ fungicide + crithidia + avg_pollen + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 35.669 141.06
## fungicide 1 39.320 142.71 3.6505 0.056053 .
## crithidia 1 36.596 139.99 0.9269 0.335659
## avg_pollen 1 43.770 147.16 8.1004 0.004425 **
## workers_alive 1 37.407 140.80 1.7372 0.187489
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
hp1 <- update(hp.mod.pois, .~. -workers_alive)
drop1(hp1, test = "Chisq")
## Single term deletions
##
## Model:
## honey_pots ~ fungicide + crithidia + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 36.875 140.79
## fungicide 1 40.087 142.00 3.2115 0.07312 .
## crithidia 1 38.392 140.31 1.5173 0.21803
## avg_pollen 1 59.717 161.63 22.8423 1.758e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(hp.mod, hp1)
## Likelihood ratio tests of Negative Binomial Models
##
## Response: honey_pots
## Model theta Resid. df
## 1 fungicide + crithidia + avg_pollen 17.57633 32
## 2 fungicide + crithidia + avg_pollen + workers_alive 19.67711 31
## 2 x log-lik. Test df LR stat. Pr(Chi)
## 1 -132.7911
## 2 -131.0589 1 vs 2 1 1.732166 0.1881346
Anova(hp.mod)
## Analysis of Deviance Table (Type II tests)
##
## Response: honey_pots
## LR Chisq Df Pr(>Chisq)
## fungicide 3.6505 1 0.056053 .
## crithidia 0.9269 1 0.335659
## avg_pollen 8.1004 1 0.004425 **
## workers_alive 1.7372 1 0.187489
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(hp.mod, hp1)
## df AIC
## hp.mod 6 143.0589
## hp1 5 142.7911
Anova(hp1)
## Analysis of Deviance Table (Type II tests)
##
## Response: honey_pots
## LR Chisq Df Pr(>Chisq)
## fungicide 3.2115 1 0.07312 .
## crithidia 1.5173 1 0.21803
## avg_pollen 22.8423 1 1.758e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(hp1)
##
## Call:
## glm.nb(formula = honey_pots ~ fungicide + crithidia + avg_pollen,
## data = brood, init.theta = 17.5763296, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0615 -0.7252 -0.3248 0.4896 2.2243
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.08803 0.33089 -0.266 0.7902
## fungicideTRUE 0.38631 0.21588 1.789 0.0735 .
## crithidiaTRUE -0.27473 0.22410 -1.226 0.2202
## avg_pollen 2.28998 0.46852 4.888 1.02e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(17.5763) family taken to be 1)
##
## Null deviance: 66.981 on 35 degrees of freedom
## Residual deviance: 36.875 on 32 degrees of freedom
## AIC: 142.79
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 17.6
## Std. Err.: 25.2
##
## 2 x log-likelihood: -132.791
hpem_contrast <- emmeans(hp1, pairwise ~ fungicide, type = "response")
hpem_contrast
## $emmeans
## fungicide response SE df asymp.LCL asymp.UCL
## FALSE 2.09 0.356 Inf 1.49 2.91
## TRUE 3.07 0.457 Inf 2.29 4.11
##
## Results are averaged over the levels of: crithidia
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
##
## $contrasts
## contrast ratio SE df null z.ratio p.value
## FALSE / TRUE 0.68 0.147 Inf 1 -1.789 0.0735
##
## Results are averaged over the levels of: crithidia
## Tests are performed on the log scale
hpem <- emmeans(hp1, pairwise ~ fungicide*crithidia, type = "response")
hpem
## $emmeans
## fungicide crithidia response SE df asymp.LCL asymp.UCL
## FALSE FALSE 2.39 0.473 Inf 1.63 3.52
## TRUE FALSE 3.52 0.622 Inf 2.49 4.98
## FALSE TRUE 1.82 0.383 Inf 1.20 2.75
## TRUE TRUE 2.68 0.524 Inf 1.82 3.93
##
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
##
## $contrasts
## contrast ratio SE df null z.ratio p.value
## FALSE FALSE / TRUE FALSE 0.680 0.147 Inf 1 -1.789 0.2783
## FALSE FALSE / FALSE TRUE 1.316 0.295 Inf 1 1.226 0.6103
## FALSE FALSE / TRUE TRUE 0.894 0.281 Inf 1 -0.355 0.9846
## TRUE FALSE / FALSE TRUE 1.937 0.597 Inf 1 2.144 0.1394
## TRUE FALSE / TRUE TRUE 1.316 0.295 Inf 1 1.226 0.6103
## FALSE TRUE / TRUE TRUE 0.680 0.147 Inf 1 -1.789 0.2783
##
## P value adjustment: tukey method for comparing a family of 4 estimates
## Tests are performed on the log scale
hpem.df <- as.data.frame(hpem$emmeans)
hpem.df
## fungicide crithidia response SE df asymp.LCL asymp.UCL
## FALSE FALSE 2.393723 0.4725121 Inf 1.625736 3.524504
## TRUE FALSE 3.522452 0.6223151 Inf 2.491509 4.979981
## FALSE TRUE 1.818697 0.3827489 Inf 1.203990 2.747246
## TRUE TRUE 2.676278 0.5235407 Inf 1.823967 3.926862
##
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
hpem.df$treatment <- c(1, 2, 4, 3)
hpem.df$treatment <-as.factor(hpem.df$treatment)
hp_sum <- brood %>%
group_by(treatment) %>%
summarize(m = mean(honey_pots),
sd = sd(honey_pots),
l = length(honey_pots)) %>%
mutate(se = sqrt(sd/l))
hp_sum
## # A tibble: 4 × 5
## treatment m sd l se
## <fct> <dbl> <dbl> <int> <dbl>
## 1 1 3.33 2.5 9 0.527
## 2 2 4.11 3.02 9 0.579
## 3 3 2.56 2.24 9 0.499
## 4 4 1.89 1.90 9 0.460
hpcld <- cld(object = hpem,
adjust = "Tukey",
Letters = letters,
alpha = 0.05)
hpcld
## fungicide crithidia response SE df asymp.LCL asymp.UCL .group
## FALSE TRUE 1.82 0.383 Inf 1.08 3.07 a
## FALSE FALSE 2.39 0.473 Inf 1.46 3.91 a
## TRUE TRUE 2.68 0.524 Inf 1.64 4.36 a
## TRUE FALSE 3.52 0.622 Inf 2.27 5.47 a
##
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## Intervals are back-transformed from the log scale
## P value adjustment: tukey method for comparing a family of 4 estimates
## Tests are performed on the log scale
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
plot(brood$treatment, brood$honey_pots)

ggplot(data = hpem.df, aes(x = treatment, y = response, fill = treatment)) +
geom_col_pattern(
aes(pattern_density = treatment),
pattern = "stripe", # Set a common pattern type, but differentiate density
pattern_density = c(0, 0, 0, 0.4), # Add density for the third column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 5.5)) +
geom_errorbar(aes(ymin = response - SE, ymax = response + SE), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Average Honeypots") +
theme_classic(base_size = 20) +
annotate(
geom = "text",
x = 1,
y = 4,
label = "P = 0.05",
size = 7
) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_density_manual(values = c(0, 0, 0, 0.4)) +
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none") +
geom_segment(x = 2, xend = 3, y = 4.6, yend = 4.6,
lineend = "round", linejoin = "round") +
geom_segment(x = 2, xend = 2, y = 4.4, yend = 4.8,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 3, y = 4.4, yend = 4.8,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 4, y = 5.2, yend = 5.2,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 1, y = 5, yend = 5.4,
lineend = "round", linejoin = "round") +
geom_segment(x = 4, xend = 4, y = 5, yend = 5.4,
lineend = "round", linejoin = "round") +
geom_text(x = 2.5, y = 4.5, label = "b", size = 6, vjust = -0.5) +
geom_text(x = 2.5, y = 5.2, label = "a", size = 6, vjust = -0.5)

total drone count
plot(brood$treatment, brood$drones)

dronecount.mod <- glm(total_drones ~ fungicide + crithidia + workers_alive + block + duration + avg_pollen, data = brood, family = "poisson")
summary(dronecount.mod) #overdisp
##
## Call:
## glm(formula = total_drones ~ fungicide + crithidia + workers_alive +
## block + duration + avg_pollen, family = "poisson", data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9548 -0.8831 -0.1200 0.2351 2.0003
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.569e+00 1.411e+00 1.821 0.0686 .
## fungicideTRUE 3.633e-02 1.374e-01 0.264 0.7915
## crithidiaTRUE 2.629e-02 1.351e-01 0.195 0.8457
## workers_alive 1.418e-01 1.005e-01 1.411 0.1583
## block4 -2.358e-01 3.810e-01 -0.619 0.5360
## block6 -1.760e+01 1.728e+03 -0.010 0.9919
## block7 5.448e-02 3.538e-01 0.154 0.8776
## block8 -3.568e-01 3.738e-01 -0.955 0.3398
## block9 2.143e-01 3.289e-01 0.652 0.5146
## block10 8.056e-01 3.505e-01 2.298 0.0215 *
## block11 2.199e-01 3.944e-01 0.558 0.5771
## block12 -9.284e-04 4.101e-01 -0.002 0.9982
## duration -6.552e-02 2.833e-02 -2.312 0.0208 *
## avg_pollen 3.210e+00 6.942e-01 4.624 3.77e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 308.730 on 35 degrees of freedom
## Residual deviance: 42.559 on 22 degrees of freedom
## AIC: 171.75
##
## Number of Fisher Scoring iterations: 15
dronecount.mod.nb <- glm.nb(total_drones ~ fungicide + crithidia + workers_alive + block + duration + avg_pollen, data = brood)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in glm.nb(total_drones ~ fungicide + crithidia + workers_alive + :
## alternation limit reached
qqnorm(resid(dronecount.mod));qqline(resid(dronecount.mod))

qqnorm(resid(dronecount.mod.nb));qqline(resid(dronecount.mod.nb))

anova(dronecount.mod, dronecount.mod.nb, test = "Chisq")
## Analysis of Deviance Table
##
## Model 1: total_drones ~ fungicide + crithidia + workers_alive + block +
## duration + avg_pollen
## Model 2: total_drones ~ fungicide + crithidia + workers_alive + block +
## duration + avg_pollen
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 22 42.559
## 2 22 42.554 0 0.0050672
AIC(dronecount.mod, dronecount.mod.nb)
## df AIC
## dronecount.mod 14 171.7458
## dronecount.mod.nb 15 173.7469
dronecount.mod.int <- glm.nb(total_drones ~ fungicide + crithidia + workers_alive + block + duration + avg_pollen, data = brood)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in glm.nb(total_drones ~ fungicide + crithidia + workers_alive + :
## alternation limit reached
drop1(dronecount.mod.int, test = "Chisq")
## Single term deletions
##
## Model:
## total_drones ~ fungicide + crithidia + workers_alive + block +
## duration + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 42.554 171.75
## fungicide 1 42.624 169.82 0.070 0.79147
## crithidia 1 42.592 169.78 0.038 0.84583
## workers_alive 1 44.579 171.77 2.025 0.15470
## block 8 81.306 194.50 38.752 5.464e-06 ***
## duration 1 47.567 174.76 5.013 0.02516 *
## avg_pollen 1 65.390 192.58 22.836 1.765e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dc1 <- update(dronecount.mod.int, .~. -workers_alive)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(dc1, test = "Chisq")
## Single term deletions
##
## Model:
## total_drones ~ fungicide + crithidia + block + duration + avg_pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 44.579 171.77
## fungicide 1 44.581 169.77 0.002 0.968223
## crithidia 1 44.583 169.78 0.003 0.953432
## block 8 85.579 196.77 40.999 2.085e-06 ***
## duration 1 51.401 176.59 6.822 0.009006 **
## avg_pollen 1 94.523 219.72 49.944 1.582e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(dronecount.mod.int)
## Analysis of Deviance Table (Type II tests)
##
## Response: total_drones
## LR Chisq Df Pr(>Chisq)
## fungicide 0.070 1 0.79147
## crithidia 0.038 1 0.84583
## workers_alive 2.025 1 0.15470
## block 38.752 8 5.464e-06 ***
## duration 5.013 1 0.02516 *
## avg_pollen 22.836 1 1.765e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(brood$treatment, brood$total_drones)

qqnorm(resid(dc1));qqline(resid(dc1))

summary(dc1)
##
## Call:
## glm.nb(formula = total_drones ~ fungicide + crithidia + block +
## duration + avg_pollen, data = brood, init.theta = 48824.30615,
## link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.91115 -0.96690 -0.04188 0.30977 2.00077
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.254e+00 1.288e+00 2.526 0.01155 *
## fungicideTRUE -5.323e-03 1.336e-01 -0.040 0.96822
## crithidiaTRUE 7.849e-03 1.344e-01 0.058 0.95343
## block4 -3.822e-01 3.708e-01 -1.031 0.30274
## block6 -1.915e+01 3.649e+03 -0.005 0.99581
## block7 -6.464e-02 3.471e-01 -0.186 0.85226
## block8 -4.638e-01 3.712e-01 -1.249 0.21159
## block9 2.513e-01 3.280e-01 0.766 0.44362
## block10 6.737e-01 3.344e-01 2.015 0.04396 *
## block11 1.909e-01 3.938e-01 0.485 0.62781
## block12 -2.884e-01 3.654e-01 -0.789 0.42986
## duration -7.220e-02 2.697e-02 -2.677 0.00743 **
## avg_pollen 3.800e+00 5.659e-01 6.714 1.9e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(48824.31) family taken to be 1)
##
## Null deviance: 308.688 on 35 degrees of freedom
## Residual deviance: 44.579 on 23 degrees of freedom
## AIC: 173.77
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 48824
## Std. Err.: 812854
## Warning while fitting theta: iteration limit reached
##
## 2 x log-likelihood: -145.772
Anova(dc1)
## Analysis of Deviance Table (Type II tests)
##
## Response: total_drones
## LR Chisq Df Pr(>Chisq)
## fungicide 0.002 1 0.968223
## crithidia 0.003 1 0.953432
## block 40.999 8 2.085e-06 ***
## duration 6.822 1 0.009006 **
## avg_pollen 49.944 1 1.582e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drones_sum <- brood %>%
group_by(treatment) %>%
summarise(mb = mean(total_drones),
nb = length(total_drones),
sdb = sd(total_drones)) %>%
mutate(seb = (sdb/sqrt(nb)))
drones_sum
## # A tibble: 4 × 5
## treatment mb nb sdb seb
## <fct> <dbl> <int> <dbl> <dbl>
## 1 1 11.3 9 7.84 2.61
## 2 2 7.67 9 7.37 2.46
## 3 3 5.44 9 8.16 2.72
## 4 4 6.89 9 7.18 2.39
drones_sum$plot <- drones_sum$mb + drones_sum$seb
ggplot(data = drones_sum, aes(x = treatment, y = mb, fill = treatment)) +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0.4, 0), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
coord_cartesian(ylim = c(0, 17)) +
geom_errorbar(aes(ymin = mb - seb, ymax = mb + seb), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Average Adults Males") +
annotate(
geom = "text",
x = c(1, 2, 3, 4),
y = drones_sum$plot + 1, # Adjust the y-position as needed
label = c("a", "a", "a", "a"),
size = 8
) +
theme_classic(base_size = 20) +
annotate(
geom = "text",
x = 1,
y = 16,
label = "P > 0.5",
size = 7
) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_manual(values = c("none", "none", "stripe", "none")) + # Add stripes to the fourth column
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none")

proportion larvae and pupae survival
proportion larvae
plmod <- glm(cbind(live_larvae, dead_larvae) ~ fungicide + crithidia + avg_pollen + block + duration + workers_alive, data = brood, family = binomial("logit"))
Anova(plmod)
## Analysis of Deviance Table (Type II tests)
##
## Response: cbind(live_larvae, dead_larvae)
## LR Chisq Df Pr(>Chisq)
## fungicide 0.2335 1 0.628962
## crithidia 0.0073 1 0.931992
## avg_pollen 1.3257 1 0.249572
## block 26.0519 8 0.001029 **
## duration 5.9041 1 0.015106 *
## workers_alive 1.1226 1 0.289357
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(plmod, test = "Chisq")
## Single term deletions
##
## Model:
## cbind(live_larvae, dead_larvae) ~ fungicide + crithidia + avg_pollen +
## block + duration + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 46.944 114.62
## fungicide 1 47.178 112.85 0.2335 0.628962
## crithidia 1 46.952 112.62 0.0073 0.931992
## avg_pollen 1 48.270 113.94 1.3257 0.249572
## block 8 72.996 124.67 26.0519 0.001029 **
## duration 1 52.848 118.52 5.9041 0.015106 *
## workers_alive 1 48.067 113.74 1.1226 0.289357
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plmod1 <- update(plmod, .~. -workers_alive)
drop1(plmod1, test = "Chisq")
## Single term deletions
##
## Model:
## cbind(live_larvae, dead_larvae) ~ fungicide + crithidia + avg_pollen +
## block + duration
## Df Deviance AIC LRT Pr(>Chi)
## <none> 48.067 113.74
## fungicide 1 48.310 111.98 0.2435 0.621688
## crithidia 1 48.119 111.79 0.0525 0.818706
## avg_pollen 1 48.596 112.27 0.5290 0.467034
## block 8 73.013 122.69 24.9462 0.001588 **
## duration 1 58.565 122.24 10.4982 0.001195 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plmod2 <- update(plmod1, .~. -avg_pollen)
drop1(plmod2, test = "Chisq")
## Single term deletions
##
## Model:
## cbind(live_larvae, dead_larvae) ~ fungicide + crithidia + block +
## duration
## Df Deviance AIC LRT Pr(>Chi)
## <none> 48.596 112.27
## fungicide 1 48.829 110.50 0.2330 0.6292730
## crithidia 1 48.616 110.29 0.0199 0.8877947
## block 8 77.731 125.40 29.1347 0.0003003 ***
## duration 1 59.635 121.31 11.0388 0.0008922 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(plmod2)
## Analysis of Deviance Table (Type II tests)
##
## Response: cbind(live_larvae, dead_larvae)
## LR Chisq Df Pr(>Chisq)
## fungicide 0.2330 1 0.6292730
## crithidia 0.0199 1 0.8877947
## block 29.1347 8 0.0003003 ***
## duration 11.0388 1 0.0008922 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(plmod2)
##
## Call:
## glm(formula = cbind(live_larvae, dead_larvae) ~ fungicide + crithidia +
## block + duration, family = binomial("logit"), data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.3237 -0.5519 0.0000 0.7894 2.5069
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 14.60178 3.97877 3.670 0.000243 ***
## fungicideTRUE 0.17912 0.37191 0.482 0.630077
## crithidiaTRUE -0.04958 0.35142 -0.141 0.887792
## block4 -1.42228 0.88102 -1.614 0.106452
## block6 -1.56753 1.01330 -1.547 0.121875
## block7 -1.97885 0.86417 -2.290 0.022028 *
## block8 -1.37953 0.92912 -1.485 0.137603
## block9 -2.07110 0.86256 -2.401 0.016345 *
## block10 1.04134 0.65380 1.593 0.111216
## block11 -1.44815 1.30648 -1.108 0.267675
## block12 -0.08539 0.76238 -0.112 0.910824
## duration -0.26367 0.08352 -3.157 0.001595 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 79.536 on 27 degrees of freedom
## Residual deviance: 48.596 on 16 degrees of freedom
## AIC: 112.27
##
## Number of Fisher Scoring iterations: 5
plot(plmod2)
## Warning: not plotting observations with leverage one:
## 2




proportion pupae
ppmod <- glm(cbind(live_pupae, dead_pupae) ~ fungicide + crithidia + avg_pollen + block + duration + workers_alive, data = brood, family = binomial("logit"))
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Anova(ppmod)
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Analysis of Deviance Table (Type II tests)
##
## Response: cbind(live_pupae, dead_pupae)
## LR Chisq Df Pr(>Chisq)
## fungicide 0.47 1 0.4948
## crithidia 0.00 1 1.0000
## avg_pollen 0.00 1 1.0000
## block 7.89 8 0.4447
## duration 334.66 1 <2e-16 ***
## workers_alive 5.85 1 0.0156 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
drop1(ppmod, test = "Chisq")
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Single term deletions
##
## Model:
## cbind(live_pupae, dead_pupae) ~ fungicide + crithidia + avg_pollen +
## block + duration + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 0.00 36.63
## fungicide 1 0.47 35.10 0.47 0.4948
## crithidia 1 0.00 34.63 0.00 1.0000
## avg_pollen 1 0.00 34.63 0.00 1.0000
## block 8 7.89 28.52 7.89 0.4447
## duration 1 334.66 369.29 334.66 <2e-16 ***
## workers_alive 1 5.85 40.48 5.85 0.0156 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ppmod1 <- update(ppmod, .~. -block)
drop1(ppmod1, test = "Chisq")
## Single term deletions
##
## Model:
## cbind(live_pupae, dead_pupae) ~ fungicide + crithidia + avg_pollen +
## duration + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 7.8857 28.518
## fungicide 1 8.5302 27.163 0.6445 0.42207
## crithidia 1 9.3781 28.011 1.4925 0.22184
## avg_pollen 1 11.8154 30.448 3.9298 0.04744 *
## duration 1 10.9993 29.632 3.1137 0.07764 .
## workers_alive 1 14.4788 33.112 6.5931 0.01024 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ppmod2 <- update(ppmod1, .~. -duration)
drop1(ppmod2, test = "Chisq")
## Single term deletions
##
## Model:
## cbind(live_pupae, dead_pupae) ~ fungicide + crithidia + avg_pollen +
## workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 10.999 29.632
## fungicide 1 11.021 27.653 0.0211 0.884443
## crithidia 1 11.486 28.119 0.4864 0.485529
## avg_pollen 1 12.481 29.114 1.4817 0.223507
## workers_alive 1 18.067 34.699 7.0672 0.007851 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ppmod3 <- update(ppmod2, .~. -avg_pollen)
drop1(ppmod3, test = "Chisq")
## Single term deletions
##
## Model:
## cbind(live_pupae, dead_pupae) ~ fungicide + crithidia + workers_alive
## Df Deviance AIC LRT Pr(>Chi)
## <none> 12.481 29.114
## fungicide 1 12.559 27.192 0.0779 0.78011
## crithidia 1 12.525 27.158 0.0444 0.83313
## workers_alive 1 18.536 33.169 6.0550 0.01387 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(ppmod3)
## Analysis of Deviance Table (Type II tests)
##
## Response: cbind(live_pupae, dead_pupae)
## LR Chisq Df Pr(>Chisq)
## fungicide 0.0779 1 0.78011
## crithidia 0.0444 1 0.83313
## workers_alive 6.0550 1 0.01387 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(ppmod3)
##
## Call:
## glm(formula = cbind(live_pupae, dead_pupae) ~ fungicide + crithidia +
## workers_alive, family = binomial("logit"), data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.7274 0.0000 0.2950 0.4739 0.9934
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.06189 2.02471 0.031 0.976
## fungicideTRUE 0.32433 1.17111 0.277 0.782
## crithidiaTRUE -0.23659 1.11658 -0.212 0.832
## workers_alive 0.86841 0.36701 2.366 0.018 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 20.674 on 24 degrees of freedom
## Residual deviance: 12.481 on 21 degrees of freedom
## AIC: 29.114
##
## Number of Fisher Scoring iterations: 6
proportion larvae and pupae
brood$live.lp <- brood$live_larvae + brood$live_pupae
brood$dead.lp <- brood$dead_larvae + brood$dead_pupae
lp.mod <- glm(cbind(live.lp, dead.lp) ~ fungicide + crithidia + block + duration, data = brood, family = binomial("logit"))
drop1(lp.mod, test = "Chisq")
## Single term deletions
##
## Model:
## cbind(live.lp, dead.lp) ~ fungicide + crithidia + block + duration
## Df Deviance AIC LRT Pr(>Chi)
## <none> 49.967 117.75
## fungicide 1 50.195 115.98 0.2287 0.6324816
## crithidia 1 50.106 115.89 0.1398 0.7085134
## block 8 71.401 123.19 21.4348 0.0060778 **
## duration 1 60.986 126.78 11.0197 0.0009015 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(lp.mod)
##
## Call:
## glm(formula = cbind(live.lp, dead.lp) ~ fungicide + crithidia +
## block + duration, family = binomial("logit"), data = brood)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.7214 -0.2108 0.0000 0.8444 2.4278
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 14.4401 3.7762 3.824 0.000131 ***
## fungicideTRUE 0.1698 0.3558 0.477 0.633193
## crithidiaTRUE -0.1214 0.3245 -0.374 0.708384
## block4 -1.5238 0.8558 -1.781 0.074988 .
## block6 -1.7535 0.9540 -1.838 0.066072 .
## block7 -1.9081 0.8343 -2.287 0.022188 *
## block8 -1.2544 0.9113 -1.376 0.168680
## block9 -1.9538 0.8137 -2.401 0.016340 *
## block10 0.4782 0.6109 0.783 0.433707
## block11 -1.3380 1.2701 -1.053 0.292157
## block12 -0.5217 0.7178 -0.727 0.467398
## duration -0.2509 0.0791 -3.172 0.001516 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 76.309 on 27 degrees of freedom
## Residual deviance: 49.967 on 16 degrees of freedom
## AIC: 117.76
##
## Number of Fisher Scoring iterations: 5
Anova(lp.mod)
## Analysis of Deviance Table (Type II tests)
##
## Response: cbind(live.lp, dead.lp)
## LR Chisq Df Pr(>Chisq)
## fungicide 0.2287 1 0.6324816
## crithidia 0.1398 1 0.7085134
## block 21.4348 8 0.0060778 **
## duration 11.0197 1 0.0009015 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Drones health metric
Dry Weight
drones$fungicide <- as.factor(drones$fungicide)
drones$crithidia <- as.factor(drones$crithidia)
plot(drones$treatment, drones$dry_weight)

plot(drones_rf$treatment, drones_rf$dry_weight)

plot(brood$treatment, brood$drones)

shapiro.test(drones$dry_weight)
##
## Shapiro-Wilk normality test
##
## data: drones$dry_weight
## W = 0.99166, p-value = 0.1135
hist(drones$dry_weight)

range(drones$dry_weight)
## [1] 0.0166 0.0541
dry <- lmer(dry_weight ~ fungicide + crithidia + workers_alive + block + emerge + (1|colony), data = drones)
drop1(dry, test = "Chisq")
## Single term deletions
##
## Model:
## dry_weight ~ fungicide + crithidia + workers_alive + block +
## emerge + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -1999.9
## fungicide 1 -2001.7 0.1493 0.69923
## crithidia 1 -1997.3 4.5582 0.03276 *
## workers_alive 1 -2000.1 1.7920 0.18069
## block 7 -1997.3 16.6047 0.02013 *
## emerge 1 -1998.7 3.1875 0.07420 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dry1 <- update(dry, .~. -workers_alive)
drop1(dry1, test= "Chisq")
## Single term deletions
##
## Model:
## dry_weight ~ fungicide + crithidia + block + emerge + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -2000.1
## fungicide 1 -2001.2 0.9199 0.33749
## crithidia 1 -1998.5 3.5794 0.05850 .
## block 7 -1998.1 16.0008 0.02511 *
## emerge 1 -1998.1 3.9614 0.04656 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dry2 <- update(dry1, .~. -block)
drop1(dry2, test = "Chisq")
## Single term deletions
##
## Model:
## dry_weight ~ fungicide + crithidia + emerge + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -1998.1
## fungicide 1 -1999.9 0.1553 0.69350
## crithidia 1 -1999.3 0.7209 0.39585
## emerge 1 -1993.8 6.2922 0.01213 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(dry2)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: dry_weight
## Chisq Df Pr(>Chisq)
## fungicide 0.1985 1 0.65596
## crithidia 0.6241 1 0.42951
## emerge 6.0119 1 0.01421 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(dry2)
## Linear mixed model fit by REML ['lmerMod']
## Formula: dry_weight ~ fungicide + crithidia + emerge + (1 | colony)
## Data: drones
##
## REML criterion at convergence: -1958.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.86701 -0.59248 -0.03622 0.60958 2.58281
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 6.923e-06 0.002631
## Residual 4.271e-05 0.006535
## Number of obs: 281, groups: colony, 24
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.0522562 0.0059986 8.711
## fungicide1 -0.0006294 0.0014127 -0.446
## crithidia1 0.0011136 0.0014096 0.790
## emerge -0.0003927 0.0001602 -2.452
##
## Correlation of Fixed Effects:
## (Intr) fngcd1 crthd1
## fungicide1 0.073
## crithidia1 -0.072 -0.002
## emerge -0.983 -0.177 -0.023
sum_dry <- drones %>%
group_by(treatment) %>%
summarise(m = mean(dry_weight),
sd = sd(dry_weight),
n = length(dry_weight)) %>%
mutate(se = sd/sqrt(n))
sum_dry
## # A tibble: 4 × 5
## treatment m sd n se
## <fct> <dbl> <dbl> <int> <dbl>
## 1 1 0.0373 0.00752 102 0.000745
## 2 2 0.0376 0.00653 69 0.000786
## 3 3 0.0378 0.00706 49 0.00101
## 4 4 0.0393 0.00665 61 0.000852
Radial Cell
drones.na <- na.omit(drones)
drones.na$alive <- as.logical(drones.na$`alive?`)
shapiro.test(drones$radial_cell)
##
## Shapiro-Wilk normality test
##
## data: drones$radial_cell
## W = 0.97715, p-value = 0.0001916
hist(drones$radial_cell)

descdist(drones.na$radial_cell, discrete = FALSE)

## summary statistics
## ------
## min: 2073.526 max: 3083.439
## median: 2710.923
## mean: 2694.575
## estimated sd: 171.6365
## estimated skewness: -0.5726179
## estimated kurtosis: 4.019655
range(drones$radial_cell)
## [1] NA NA
drones.na$square <- drones.na$radial_cell^3
shapiro.test(drones.na$square)
##
## Shapiro-Wilk normality test
##
## data: drones.na$square
## W = 0.99215, p-value = 0.1516
hist(drones.na$square)
drones.na$log <- log(drones.na$radial_cell)
shapiro.test(drones.na$log)
##
## Shapiro-Wilk normality test
##
## data: drones.na$log
## W = 0.95963, p-value = 5.927e-07
hist(drones.na$square)

rad_mod <- lmer(square ~ fungicide + crithidia + workers_alive + block + mean.pollen + emerge + alive + (1|colony), data = drones.na)
drop1(rad_mod, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + workers_alive + block + mean.pollen +
## emerge + alive + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12934
## fungicide 1 12939 7.2355 0.007148 **
## crithidia 1 12933 1.3953 0.237507
## workers_alive 1 12934 1.7286 0.188584
## block 7 12932 11.7617 0.108673
## mean.pollen 1 12935 3.3474 0.067311 .
## emerge 1 12936 4.4149 0.035627 *
## alive 1 12933 1.4090 0.235217
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rm1 <- update(rad_mod, .~. -block)
drop1(rm1, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + workers_alive + mean.pollen +
## emerge + alive + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12932
## fungicide 1 12932 2.9510 0.085825 .
## crithidia 1 12930 0.7704 0.380101
## workers_alive 1 12930 0.2499 0.617119
## mean.pollen 1 12930 0.2225 0.637150
## emerge 1 12936 6.7496 0.009377 **
## alive 1 12930 0.7498 0.386527
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rm2 <- update(rm1, .~. -workers_alive)
drop1(rm2, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + mean.pollen + emerge + alive +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12930
## fungicide 1 12931 3.5558 0.05934 .
## crithidia 1 12928 0.6686 0.41353
## mean.pollen 1 12928 0.6137 0.43340
## emerge 1 12935 7.0223 0.00805 **
## alive 1 12929 0.7897 0.37419
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rm3 <- update(rm2, .~. -mean.pollen)
drop1(rm3, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + emerge + alive + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12928
## fungicide 1 12930 3.6326 0.056657 .
## crithidia 1 12927 0.5522 0.457427
## emerge 1 12935 8.1007 0.004425 **
## alive 1 12927 0.8091 0.368391
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rm4 <- update(rm3, .~. -alive)
drop1(rm4, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + emerge + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12927
## fungicide 1 12929 3.8119 0.050889 .
## crithidia 1 12926 0.6516 0.419537
## emerge 1 12933 7.9923 0.004698 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(rm4)
## Linear mixed model fit by REML ['lmerMod']
## Formula: square ~ fungicide + crithidia + emerge + (1 | colony)
## Data: drones.na
##
## REML criterion at convergence: 12752
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9415 -0.5357 0.0455 0.5915 2.9574
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 8.620e+17 9.284e+08
## Residual 1.189e+19 3.448e+09
## Number of obs: 276, groups: colony, 24
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 2.858e+10 3.044e+09 9.388
## fungicide1 -1.143e+09 6.022e+08 -1.898
## crithidia1 4.190e+08 5.965e+08 0.703
## emerge -2.274e+08 8.179e+07 -2.781
##
## Correlation of Fixed Effects:
## (Intr) fngcd1 crthd1
## fungicide1 0.123
## crithidia1 -0.055 -0.009
## emerge -0.989 -0.206 -0.022
Anova(rm4)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: square
## Chisq Df Pr(>Chisq)
## fungicide 3.6022 1 0.057704 .
## crithidia 0.4935 1 0.482353
## emerge 7.7324 1 0.005424 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rad_mod <- lmer(square ~ fungicide + crithidia + workers_alive + block + mean.pollen + days_active + alive + (1|colony), data = drones.na)
drop1(rad_mod, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + workers_alive + block + mean.pollen +
## days_active + alive + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12938
## fungicide 1 12946 9.4396 0.002124 **
## crithidia 1 12938 2.0127 0.155989
## workers_alive 1 12939 2.5934 0.107306
## block 7 12938 13.9266 0.052503 .
## mean.pollen 1 12940 3.3790 0.066032 .
## days_active 1 12936 0.0170 0.896404
## alive 1 12938 1.2506 0.263436
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rm1 <- update(rad_mod, .~. -days_active)
drop1(rm1, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + workers_alive + block + mean.pollen +
## alive + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12936
## fungicide 1 12944 9.8595 0.00169 **
## crithidia 1 12936 2.0132 0.15593
## workers_alive 1 12937 2.6202 0.10551
## block 7 12936 14.0964 0.04949 *
## mean.pollen 1 12938 3.4592 0.06290 .
## alive 1 12936 1.2552 0.26255
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rm2 <- update(rm1, .~. -block)
drop1(rm2, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + workers_alive + mean.pollen +
## alive + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12936
## fungicide 1 12939 4.4893 0.03411 *
## crithidia 1 12935 0.7453 0.38796
## workers_alive 1 12935 0.5227 0.46970
## mean.pollen 1 12935 0.6837 0.40833
## alive 1 12935 0.6207 0.43080
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rm3 <- update(rm2, .~. -workers_alive)
drop1(rm3, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + mean.pollen + alive + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12935
## fungicide 1 12938 5.5520 0.01846 *
## crithidia 1 12934 0.5944 0.44074
## mean.pollen 1 12935 1.6920 0.19333
## alive 1 12934 0.6684 0.41362
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rm5 <- update(rm3, .~. -alive)
drop1(rm5, test = "Chisq")
## Single term deletions
##
## Model:
## square ~ fungicide + crithidia + mean.pollen + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> 12934
## fungicide 1 12937 5.7439 0.01655 *
## crithidia 1 12932 0.6878 0.40693
## mean.pollen 1 12933 1.7244 0.18913
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rm6 <- update(rm5, .~. -mean.pollen)
summary(rm6)
## Linear mixed model fit by REML ['lmerMod']
## Formula: square ~ fungicide + crithidia + (1 | colony)
## Data: drones.na
##
## REML criterion at convergence: 12797.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.85719 -0.55413 0.02787 0.61341 2.71516
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 1.111e+18 1.054e+09
## Residual 1.208e+19 3.475e+09
## Number of obs: 276, groups: colony, 24
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 2.022e+10 4.863e+08 41.589
## fungicide1 -1.526e+09 6.296e+08 -2.424
## crithidia1 3.586e+08 6.373e+08 0.563
##
## Correlation of Fixed Effects:
## (Intr) fngcd1
## fungicide1 -0.559
## crithidia1 -0.518 -0.011
Anova(rm6)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: square
## Chisq Df Pr(>Chisq)
## fungicide 5.8751 1 0.01536 *
## crithidia 0.3165 1 0.57371
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(rm4, rm6, test = "Chisq")
## Data: drones.na
## Models:
## rm6: square ~ fungicide + crithidia + (1 | colony)
## rm4: square ~ fungicide + crithidia + emerge + (1 | colony)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## rm6 5 12933 12951 -6461.6 12923
## rm4 6 12927 12949 -6457.6 12915 7.9923 1 0.004698 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(rm4, rm6)
## df AIC
## rm4 6 12764.01
## rm6 5 12807.83
qqnorm(resid(rad_mod));qqline(resid(rad_mod))

qqnorm(resid(rm4));qqline(resid(rm4))

qqnorm(resid(rm6));qqline(resid(rm6))

Anova(rm3)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: square
## Chisq Df Pr(>Chisq)
## fungicide 5.0629 1 0.02444 *
## crithidia 0.4090 1 0.52249
## mean.pollen 1.5012 1 0.22049
## alive 0.7139 1 0.39815
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rem <- emmeans(rm6, pairwise ~ fungicide, type = "response")
rem
## $emmeans
## fungicide emmean SE df lower.CL upper.CL
## 0 2.04e+10 4.22e+08 17.1 1.95e+10 2.13e+10
## 1 1.89e+10 4.82e+08 21.1 1.79e+10 1.99e+10
##
## Results are averaged over the levels of: crithidia
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## fungicide0 - fungicide1 1.53e+09 6.34e+08 19.1 2.405 0.0265
##
## Results are averaged over the levels of: crithidia
## Degrees-of-freedom method: kenward-roger
re <- setDT(as.data.frame(rem$emmeans))
cont_radial <- setDT(as.data.frame(rem$contrasts))
rad.cld <- cld(object =rem,
adjust = "Tukey",
Letters = letters,
alpha = 0.05)
rad.cld
## fungicide emmean SE df lower.CL upper.CL .group
## 1 1.89e+10 4.82e+08 21.1 1.77e+10 2.00e+10 a
## 0 2.04e+10 4.22e+08 17.1 1.94e+10 2.14e+10 b
##
## Results are averaged over the levels of: crithidia
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
sum_radial <- drones_rf %>%
group_by(treatment) %>%
summarise(m = mean(radial_cell),
sd = sd(radial_cell),
n = length(radial_cell)) %>%
mutate(se = sd/sqrt(n))
sum_radial
## # A tibble: 4 × 5
## treatment m sd n se
## <fct> <dbl> <dbl> <int> <dbl>
## 1 1 2699. 182. 99 18.3
## 2 2 2664. 174. 68 21.1
## 3 3 2660. 173. 49 24.7
## 4 4 2750. 136. 60 17.5
sum_radial$plot <- sum_radial$m + sum_radial$se
ggplot(sum_radial, aes(x = treatment, y = m, fill = treatment)) +
geom_bar(stat = "identity", color = "black") +
scale_fill_viridis_d() +
geom_errorbar(aes(ymin = m - se, ymax = m + se), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Radial Cell Length (um)") +
theme_classic(base_size = 20) +
coord_cartesian(ylim=c(2620, 2800)) +
annotate(geom = "text",
x = 1, y = 3 ,
label = "P > 0.05",
size = 8) +
theme(legend.position = "none",
axis.text = element_text(size = 20), # Set axis label font size
axis.title = element_text(size = 20)) + # Set axis title font size
theme(text = element_text(size = 20)) +
annotate(geom = "text",
label = "P = 0.06",
x = 1, y = 2762,
size = 7)

Relative Fat (original units g/um)
drones_rf$fungicide <-as.factor(drones_rf$fungicide)
drones_rf$crithidia <- as.factor(drones_rf$crithidia)
shapiro.test(drones_rf$relative_fat_original)
##
## Shapiro-Wilk normality test
##
## data: drones_rf$relative_fat_original
## W = 0.97273, p-value = 4.049e-05
hist(drones_rf$relative_fat_original)

plot(drones_rf$treatment, drones_rf$relative_fat_original)

range(drones_rf$relative_fat_original)
## [1] 1.78e-07 3.40e-06
drones_rf$log_ref <- log(drones_rf$relative_fat_original)
shapiro.test(drones_rf$log_ref)
##
## Shapiro-Wilk normality test
##
## data: drones_rf$log_ref
## W = 0.94339, p-value = 8.074e-09
drones_rf$squarerf <- sqrt(drones_rf$relative_fat_original)
shapiro.test(drones_rf$squarerf)
##
## Shapiro-Wilk normality test
##
## data: drones_rf$squarerf
## W = 0.99031, p-value = 0.06387
rf_mod <- lmer(squarerf ~ fungicide + crithidia + block + mean.pollen + workers_alive + emerge + (1|colony), data = drones_rf)
drop1(rf_mod, test = "Chisq")
## Single term deletions
##
## Model:
## squarerf ~ fungicide + crithidia + block + mean.pollen + workers_alive +
## emerge + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -3926.8
## fungicide 1 -3927.2 1.5763 0.2092949
## crithidia 1 -3926.6 2.1577 0.1418577
## block 7 -3922.1 18.6722 0.0092788 **
## mean.pollen 1 -3928.1 0.6181 0.4317364
## workers_alive 1 -3928.7 0.0348 0.8519805
## emerge 1 -3916.1 12.6298 0.0003796 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rf1 <- update(rf_mod, .~. -mean.pollen)
drop1(rf1, test = "Chisq")
## Single term deletions
##
## Model:
## squarerf ~ fungicide + crithidia + block + workers_alive + emerge +
## (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -3928.1
## fungicide 1 -3928.8 1.3699 0.2418298
## crithidia 1 -3927.9 2.2779 0.1312301
## block 7 -3922.2 19.9284 0.0057265 **
## workers_alive 1 -3929.8 0.3342 0.5632243
## emerge 1 -3917.5 12.6776 0.0003701 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rf2 <- update(rf1, .~. -workers_alive)
drop1(rf2, test = "Chisq")
## Single term deletions
##
## Model:
## squarerf ~ fungicide + crithidia + block + emerge + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -3929.8
## fungicide 1 -3930.7 1.0627 0.3025989
## crithidia 1 -3929.1 2.6716 0.1021510
## block 7 -3924.2 19.6016 0.0064976 **
## emerge 1 -3919.5 12.3463 0.0004419 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rf3 <- update(rf2, .~. -block)
drop1(rf3, test = "Chisq")
## Single term deletions
##
## Model:
## squarerf ~ fungicide + crithidia + emerge + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -3924.2
## fungicide 1 -3926.2 0.0054 0.94158
## crithidia 1 -3922.0 4.2162 0.04004 *
## emerge 1 -3908.2 17.9955 2.214e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rf4 <- update(rf3, .~. -crithidia)
drop1(rf4, test = "Chisq")
## Single term deletions
##
## Model:
## squarerf ~ fungicide + emerge + (1 | colony)
## npar AIC LRT Pr(Chi)
## <none> -3922.0
## fungicide 1 -3924.0 0.0137 0.9068
## emerge 1 -3906.6 17.3510 3.107e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(rf_mod)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: squarerf
## Chisq Df Pr(>Chisq)
## fungicide 0.8451 1 0.3579549
## crithidia 1.7576 1 0.1849263
## block 11.6312 7 0.1133564
## mean.pollen 0.0127 1 0.9101582
## workers_alive 0.0298 1 0.8628689
## emerge 14.1663 1 0.0001673 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(rf4)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: squarerf
## Chisq Df Pr(>Chisq)
## fungicide 0.0213 1 0.8839
## emerge 17.9437 1 2.275e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(rf3)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: squarerf
## Chisq Df Pr(>Chisq)
## fungicide 0.0149 1 0.90287
## crithidia 3.9457 1 0.04699 *
## emerge 18.5688 1 1.639e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(rf3)
## Linear mixed model fit by REML ['lmerMod']
## Formula: squarerf ~ fungicide + crithidia + emerge + (1 | colony)
## Data: drones_rf
##
## REML criterion at convergence: -3857.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.8428 -0.5043 0.0419 0.5569 3.9576
##
## Random effects:
## Groups Name Variance Std.Dev.
## colony (Intercept) 8.144e-09 9.024e-05
## Residual 3.419e-08 1.849e-04
## Number of obs: 276, groups: colony, 24
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 1.789e-03 1.769e-04 10.113
## fungicide1 -5.541e-06 4.541e-05 -0.122
## crithidia1 9.031e-05 4.546e-05 1.986
## emerge -2.031e-05 4.714e-06 -4.309
##
## Correlation of Fixed Effects:
## (Intr) fngcd1 crthd1
## fungicide1 0.046
## crithidia1 -0.070 0.002
## emerge -0.980 -0.162 -0.035
anova(rf3, rf4, test = "Chisq")
## Data: drones_rf
## Models:
## rf4: squarerf ~ fungicide + emerge + (1 | colony)
## rf3: squarerf ~ fungicide + crithidia + emerge + (1 | colony)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## rf4 5 -3922.0 -3903.9 1966.0 -3932.0
## rf3 6 -3924.2 -3902.5 1968.1 -3936.2 4.2162 1 0.04004 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(rf3, rf4)
## df AIC
## rf3 6 -3845.295
## rf4 5 -3861.588
qqnorm(resid(rf3));qqline(resid(rf3))

qqnorm(resid(rf4));qqline(resid(rf4))

rf_em <- emmeans(rf3, pairwise ~ crithidia*fungicide, type = "response")
rf_em
## $emmeans
## crithidia fungicide emmean SE df lower.CL upper.CL
## 0 0 0.00103 3.55e-05 17.8 0.000955 0.0011
## 1 0 0.00112 4.07e-05 19.3 0.001035 0.0012
## 0 1 0.00102 3.84e-05 22.1 0.000944 0.0011
## 1 1 0.00111 4.33e-05 22.1 0.001024 0.0012
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio
## crithidia0 fungicide0 - crithidia1 fungicide0 -9.03e-05 4.56e-05 19.8 -1.979
## crithidia0 fungicide0 - crithidia0 fungicide1 5.54e-06 4.56e-05 20.9 0.122
## crithidia0 fungicide0 - crithidia1 fungicide1 -8.48e-05 6.46e-05 20.1 -1.312
## crithidia1 fungicide0 - crithidia0 fungicide1 9.59e-05 6.44e-05 20.6 1.488
## crithidia1 fungicide0 - crithidia1 fungicide1 5.54e-06 4.56e-05 20.9 0.122
## crithidia0 fungicide1 - crithidia1 fungicide1 -9.03e-05 4.56e-05 19.8 -1.979
## p.value
## 0.2291
## 0.9993
## 0.5660
## 0.4621
## 0.9993
## 0.2291
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
rf_e <- setDT(as.data.frame(rf_em$emmeans))
rf_ce <- setDT(as.data.frame(rf_em$contrasts))
rf_em
## $emmeans
## crithidia fungicide emmean SE df lower.CL upper.CL
## 0 0 0.00103 3.55e-05 17.8 0.000955 0.0011
## 1 0 0.00112 4.07e-05 19.3 0.001035 0.0012
## 0 1 0.00102 3.84e-05 22.1 0.000944 0.0011
## 1 1 0.00111 4.33e-05 22.1 0.001024 0.0012
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio
## crithidia0 fungicide0 - crithidia1 fungicide0 -9.03e-05 4.56e-05 19.8 -1.979
## crithidia0 fungicide0 - crithidia0 fungicide1 5.54e-06 4.56e-05 20.9 0.122
## crithidia0 fungicide0 - crithidia1 fungicide1 -8.48e-05 6.46e-05 20.1 -1.312
## crithidia1 fungicide0 - crithidia0 fungicide1 9.59e-05 6.44e-05 20.6 1.488
## crithidia1 fungicide0 - crithidia1 fungicide1 5.54e-06 4.56e-05 20.9 0.122
## crithidia0 fungicide1 - crithidia1 fungicide1 -9.03e-05 4.56e-05 19.8 -1.979
## p.value
## 0.2291
## 0.9993
## 0.5660
## 0.4621
## 0.9993
## 0.2291
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
rf_e
## crithidia fungicide emmean SE df lower.CL
## 1: 0 0 0.001029495 3.550520e-05 17.79935 0.0009548407
## 2: 1 0 0.001119806 4.067936e-05 19.26722 0.0010347432
## 3: 0 1 0.001023954 3.837426e-05 22.04877 0.0009443804
## 4: 1 1 0.001114265 4.334502e-05 22.07399 0.0010243905
## upper.CL
## 1: 0.001104149
## 2: 0.001204869
## 3: 0.001103527
## 4: 0.001204140
rf_ce
## contrast estimate SE
## 1: crithidia0 fungicide0 - crithidia1 fungicide0 -9.031152e-05 4.563038e-05
## 2: crithidia0 fungicide0 - crithidia0 fungicide1 5.541136e-06 4.558328e-05
## 3: crithidia0 fungicide0 - crithidia1 fungicide1 -8.477039e-05 6.459089e-05
## 4: crithidia1 fungicide0 - crithidia0 fungicide1 9.585266e-05 6.440459e-05
## 5: crithidia1 fungicide0 - crithidia1 fungicide1 5.541136e-06 4.558328e-05
## 6: crithidia0 fungicide1 - crithidia1 fungicide1 -9.031152e-05 4.563038e-05
## df t.ratio p.value
## 1: 19.82692 -1.9791972 0.2290557
## 2: 20.88428 0.1215607 0.9993362
## 3: 20.10602 -1.3124202 0.5659652
## 4: 20.58874 1.4882893 0.4621385
## 5: 20.88428 0.1215607 0.9993362
## 6: 19.82692 -1.9791972 0.2290557
rf_e$treatment <- c(1, 4, 2, 3)
rf_e$treatment <- as.factor(rf_e$treatment)
rf_sum <- drones_rf %>%
group_by(treatment) %>%
summarise(m = mean(relative_fat_original),
sd = sd(relative_fat_original),
n = length(relative_fat_original)) %>%
mutate(se = sd/sqrt(n))
rf_sum
## # A tibble: 4 × 5
## treatment m sd n se
## <fct> <dbl> <dbl> <int> <dbl>
## 1 1 0.00000115 0.000000438 99 0.0000000440
## 2 2 0.00000111 0.000000408 68 0.0000000495
## 3 3 0.00000129 0.000000508 49 0.0000000726
## 4 4 0.00000128 0.000000435 60 0.0000000561
rf_sum$plot <- rf_sum$m + rf_sum$se
ggplot(rf_e, aes(x = treatment, y = emmean, fill = treatment)) +
geom_bar(stat = "identity", color = "black") +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0, 0.4), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
scale_fill_viridis_d() +
geom_errorbar(aes(ymin = emmean - SE, ymax = emmean + SE), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Square Root (Relative Fat (g/mm))") +
theme_classic(base_size = 20) +
coord_cartesian(ylim=c(0.0009, 0.00121)) +
annotate(geom = "text",
x = 1, y = 0.00119,
label = "P = 0.05",
size = 8) +
theme(legend.position = "none",
axis.text = element_text(size = 16), # Set axis label font size
axis.title = element_text(size = 16)) + # Set axis title font size
theme(text = element_text(size = 16)) +
scale_x_discrete(labels = custom_labels) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_manual(values = c("none", "none", "stripe", "none")) +
geom_segment(x = 1, xend = 2, y = 0.0011, yend = 0.0011,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 1, y = 0.00109, yend = 0.00111,
lineend = "round", linejoin = "round") +
geom_segment(x = 2, xend = 2, y = 0.00109, yend = 0.00111,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 4, y = 0.0012, yend = 0.0012,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 3, y = 0.00119, yend = 0.00121,
lineend = "round", linejoin = "round") +
geom_segment(x = 4, xend = 4, y = 0.00119, yend = 0.00121,
lineend = "round", linejoin = "round") +
geom_text(x = 1.5, y = 0.00111, label = "a", size = 6, vjust = -0.5) +
geom_text(x = 3.5, y = 0.001201, label = "b", size = 6, vjust = -0.5) +
theme(legend.position = "none")

Emerge days
drones$fungicide <- as.logical(drones$fungicide)
drones$crithidia <- as.logical(drones$crithidia)
em.mod <- glm(emerge ~ fungicide + crithidia + dry_weight + live_weight + workers_alive + mean.pollen, data = drones.na, family = "poisson")
summary(em.mod)
##
## Call:
## glm(formula = emerge ~ fungicide + crithidia + dry_weight + live_weight +
## workers_alive + mean.pollen, family = "poisson", data = drones.na)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.98926 -0.33225 0.00052 0.28013 1.76734
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.739837 0.083374 44.856 <2e-16 ***
## fungicide1 0.033579 0.020613 1.629 0.103
## crithidia1 -0.003914 0.020394 -0.192 0.848
## dry_weight -1.691845 1.430164 -1.183 0.237
## live_weight 0.015777 0.023522 0.671 0.502
## workers_alive -0.008052 0.014627 -0.551 0.582
## mean.pollen -0.073468 0.063707 -1.153 0.249
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 58.303 on 275 degrees of freedom
## Residual deviance: 48.891 on 269 degrees of freedom
## AIC: 1570.1
##
## Number of Fisher Scoring iterations: 3
em.mod <- glm.nb(emerge ~ fungicide + crithidia + dry_weight + live_weight + workers_alive + mean.pollen, data = drones.na)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
summary(em.mod)
##
## Call:
## glm.nb(formula = emerge ~ fungicide + crithidia + dry_weight +
## live_weight + workers_alive + mean.pollen, data = drones.na,
## init.theta = 3809154.841, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.98925 -0.33225 0.00052 0.28013 1.76733
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.739837 0.083375 44.856 <2e-16 ***
## fungicide1 0.033579 0.020613 1.629 0.103
## crithidia1 -0.003914 0.020394 -0.192 0.848
## dry_weight -1.691845 1.430174 -1.183 0.237
## live_weight 0.015777 0.023523 0.671 0.502
## workers_alive -0.008052 0.014627 -0.551 0.582
## mean.pollen -0.073468 0.063708 -1.153 0.249
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(3809155) family taken to be 1)
##
## Null deviance: 58.303 on 275 degrees of freedom
## Residual deviance: 48.890 on 269 degrees of freedom
## AIC: 1572.1
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 3809155
## Std. Err.: 44034635
## Warning while fitting theta: iteration limit reached
##
## 2 x log-likelihood: -1556.135
drop1(em.mod, test = "Chisq")
## Single term deletions
##
## Model:
## emerge ~ fungicide + crithidia + dry_weight + live_weight + workers_alive +
## mean.pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 48.890 1570.1
## fungicide 1 51.540 1570.8 2.64962 0.1036
## crithidia 1 48.927 1568.2 0.03685 0.8478
## dry_weight 1 50.288 1569.5 1.39821 0.2370
## live_weight 1 49.341 1568.6 0.45110 0.5018
## workers_alive 1 49.193 1568.4 0.30289 0.5821
## mean.pollen 1 50.217 1569.5 1.32744 0.2493
em1 <- update(em.mod, .~. -workers_alive)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(em1, test = "Chisq")
## Single term deletions
##
## Model:
## emerge ~ fungicide + crithidia + dry_weight + live_weight + mean.pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 49.193 1568.4
## fungicide 1 52.544 1569.8 3.3507 0.06718 .
## crithidia 1 49.214 1566.5 0.0209 0.88504
## dry_weight 1 50.643 1567.9 1.4496 0.22859
## live_weight 1 49.705 1567.0 0.5125 0.47407
## mean.pollen 1 51.782 1569.0 2.5893 0.10759
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
em2 <- update(em1, .~. -live_weight)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(em2, test = "Chisq")
## Single term deletions
##
## Model:
## emerge ~ fungicide + crithidia + dry_weight + mean.pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 49.705 1567.0
## fungicide 1 53.137 1568.4 3.4317 0.06396 .
## crithidia 1 49.720 1565.0 0.0147 0.90334
## dry_weight 1 51.140 1566.4 1.4348 0.23098
## mean.pollen 1 52.707 1568.0 3.0014 0.08319 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
em3 <- update(em2, .~. -dry_weight)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
drop1(em3, test = "Chisq")
## Single term deletions
##
## Model:
## emerge ~ fungicide + crithidia + mean.pollen
## Df Deviance AIC LRT Pr(>Chi)
## <none> 51.140 1566.4
## fungicide 1 54.822 1568.1 3.6820 0.05500 .
## crithidia 1 51.192 1564.4 0.0521 0.81952
## mean.pollen 1 54.631 1567.9 3.4905 0.06172 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
em4 <- update(em3, .~. -mean.pollen)
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
## control$trace > : iteration limit reached
## Warning in glm.nb(formula = emerge ~ fungicide + crithidia, data = drones.na, :
## alternation limit reached
Anova(em4)
## Analysis of Deviance Table (Type II tests)
##
## Response: emerge
## LR Chisq Df Pr(>Chisq)
## fungicide 3.6718 1 0.05534 .
## crithidia 0.0054 1 0.94153
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(em4)
##
## Call:
## glm.nb(formula = emerge ~ fungicide + crithidia, data = drones.na,
## init.theta = 3366696.841, link = log)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.86749 -0.30028 -0.02929 0.28290 1.97226
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.605679 0.015123 238.421 <2e-16 ***
## fungicide1 0.038133 0.019883 1.918 0.0551 .
## crithidia1 -0.001478 0.020155 -0.073 0.9415
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Negative Binomial(3366782) family taken to be 1)
##
## Null deviance: 58.302 on 275 degrees of freedom
## Residual deviance: 54.631 on 273 degrees of freedom
## AIC: 1569.9
##
## Number of Fisher Scoring iterations: 1
##
##
## Theta: 3366697
## Std. Err.: 37068676
## Warning while fitting theta: alternation limit reached
##
## 2 x log-likelihood: -1561.876
emem <- emmeans(em4, pairwise ~ fungicide, type = "response")
emem
## $emmeans
## fungicide response SE df asymp.LCL asymp.UCL
## 0 36.8 0.489 Inf 35.8 37.8
## 1 38.2 0.575 Inf 37.1 39.4
##
## Results are averaged over the levels of: crithidia
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
##
## $contrasts
## contrast ratio SE df null z.ratio p.value
## fungicide0 / fungicide1 0.963 0.0191 Inf 1 -1.918 0.0551
##
## Results are averaged over the levels of: crithidia
## Tests are performed on the log scale
emcld <- cld(object = emem,
adjust = "Tukey",
Letters = letters,
alpha = 0.05)
emcld
## fungicide response SE df asymp.LCL asymp.UCL .group
## 0 36.8 0.489 Inf 35.7 37.9 a
## 1 38.2 0.575 Inf 36.9 39.5 a
##
## Results are averaged over the levels of: crithidia
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## Intervals are back-transformed from the log scale
## Tests are performed on the log scale
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
pairs(emem)
## contrast ratio SE df null z.ratio p.value
## fungicide0 / fungicide1 0.963 0.0191 Inf 1 -1.918 0.0551
##
## Results are averaged over the levels of: crithidia
## Tests are performed on the log scale
em_sum <- drones %>%
group_by(treatment) %>%
summarise(m = mean(emerge),
sd = sd(emerge),
n = length(emerge)) %>%
mutate(se = sd/sqrt(n))
em_sum
## # A tibble: 4 × 5
## treatment m sd n se
## <fct> <dbl> <dbl> <int> <dbl>
## 1 1 37.0 2.41 102 0.238
## 2 2 38.1 2.54 69 0.306
## 3 3 38.4 4.08 49 0.583
## 4 4 36.5 2.23 61 0.286
em_sum$plot <- em_sum$m + em_sum$se
ggplot(em_sum, aes(x = treatment, y = m, fill = treatment)) +
geom_bar(stat = "identity", color = "black") +
geom_col_pattern(
aes(pattern = treatment),
pattern_density = c(0, 0, 0.4, 0), # Add density for the fourth column
pattern_spacing = 0.03,
position = position_dodge(0.9)
) +
scale_fill_viridis_d() +
geom_errorbar(aes(ymin = m - se, ymax = m + se), width = 0.2, position = position_dodge(0.9)) +
labs(x = "Treatment", y = "Days") +
theme_classic(base_size = 20) +
coord_cartesian(ylim=c(35, 41)) +
annotate(geom = "text",
x = 1, y = 39,
label = "P = 0.05",
size = 8) +
theme(legend.position = "none",
axis.text = element_text(size = 20), # Set axis label font size
axis.title = element_text(size = 20)) + # Set axis title font size
theme(text = element_text(size = 20)) +
scale_fill_manual(values = c("lightgreen", "lightblue", "lightblue", "grey")) +
scale_pattern_manual(values = c("none", "none", "stripe", "none")) + # Add stripes to the fourth column
scale_x_discrete(labels = custom_labels) +
theme(legend.position = "none") +
geom_segment(x = 2, xend = 3, y = 39.6, yend = 39.6,
lineend = "round", linejoin = "round") +
geom_segment(x = 2, xend = 2, y = 39.4, yend = 39.8,
lineend = "round", linejoin = "round") +
geom_segment(x = 3, xend = 3, y = 39.4, yend = 39.8,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 4, y = 40.1, yend = 40.1,
lineend = "round", linejoin = "round") +
geom_segment(x = 1, xend = 1, y = 39.9, yend = 40.3,
lineend = "round", linejoin = "round") +
geom_segment(x = 4, xend = 4, y = 39.9, yend = 40.3,
lineend = "round", linejoin = "round") +
geom_text(x = 2.5, y = 39.65, label = "b", size = 6, vjust = -0.5) +
geom_text(x = 2.5, y = 40.15, label = "a", size = 6, vjust = -0.5)

LS0tDQp0aXRsZTogIkJ1bWJsZSBiZWUgZGlzZWFzZSBkeW5hbWljcyINCmF1dGhvcjogIkVtaWx5IFJ1bm5pb24iDQpkYXRlOiAiRGF0YSBDb2xsZWN0ZWQgMjAyMiINCm91dHB1dDoNCiAgaHRtbF9kb2N1bWVudDoNCiAgICB0b2M6IHRydWUNCiAgICB0b2NfZGVwdGg6IDQNCiAgICBudW1iZXJfc2VjdGlvbnM6IGZhbHNlDQogICAgdG9jX2Zsb2F0OiB0cnVlDQogICAgdGhlbWU6IGpvdXJuYWwNCiAgICBjb2RlX2Rvd25sb2FkOiB0cnVlDQotLS0NCg0KYGBge3Igc2V0dXAsIGluY2x1ZGU9RkFMU0V9DQprbml0cjo6b3B0c19jaHVuayRzZXQobWVzc2FnZSA9IEZBTFNFKQ0KYGBgDQoNCg0KYGBge3IgbG9hZCBsaWJyYXJpZXMsIGluY2x1ZGU9RkFMU0V9DQpsaWJyYXJ5KHJlYWRyKQ0KbGlicmFyeSh2aXJpZGlzTGl0ZSkNCmxpYnJhcnkoc3RhdHMpDQpsaWJyYXJ5KGdncGxvdDIpDQpsaWJyYXJ5KGNhcikNCmxpYn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JT4lDQogIGdyb3VwX2J5KGNvbG9ueSkgJT4lDQogIHN1bW1hcmlzZShhdmcucG9sID0gbWVhbih3aG9sZV9kaWYpKQ0KDQpkdXJhdGlvbiA8LSBtZXJnZShkdXJhdGlvbiwgYXZnLnBvbCwgYnkgPSAiY29sb255IiwgYWxsID0gRkFMU0UpDQoNCm5ld19kYXRhZnJhbWUgPC0gZHVyYXRpb25bYygnY29sb255JywgJ2RheXNfYWN0aXZlJyldDQpicm9vZCA8LSBtZXJnZShxcm9fc2ltcGxlLCBicm9vZCwgYnkgPSAiY29sb255IiwgYWxsID0gRkFMU0UpDQp3b3JrZXJzIDwtIG1lcmdlKG5ld19kYXRhZnJhbWUsIHdvcmtlcnMsIGJ5ID0gImNvbG9ueSIsIGFsbCA9IEZBTFNFKQ0KDQphbGxfYmVlcyA8LSByZWFkX2NzdigicXBjcl9pbm9jX2JlZXMuY3N2IiwgY29sX3R5cGVzID0gY29scyh0cmVhdG1lbnQgPSBjb2xfZmFjdG9yKGxldmVscyA9IGMoIjEiLCANCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiMiIsICIzIiwgIjQiKSksIHJlcGxpY2F0ZSA9IGNvbF9mYWN0b3IobGV2ZWxzID0gYygiMSIsIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI0IiwgIjYiLCAiNyIsICI4IiwgIjkiLCAiMTAiLCAiMTEiLCANCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiMTIiKSksIHN0YXJ0ID0gY29sX2RhdGUoZm9ybWF0ID0gIiVtLyVkLyVZIiksIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSW5ub2N1bGF0aW9uX2RhdGUgPSBjb2xfZGF0ZShmb3JtYXQgPSAiJW0vJWQvJVkiKSwgDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRlID0gY29sX2RhdGUoZm9ybWF0ID0gIiVtLyVkLyVZIiksIGNlbnNvcl9zdGF0dXMgPSBjb2xfZmFjdG9yKGxldmVscyA9IGMoIjEiLCIyIikpKSkNCg0KYWxsX2JlZXMkY29sb255IDwtIGFzLmZhY3RvcihhbGxfYmVlcyRjb2xvbnkpDQphbGxfYmVlcyRiZWVfaWQgPC0gYXMuZmFjdG9yKGFsbF9iZWVzJGJlZV9pZCkNCg0KDQp3b3JrZXJzX2Zvcl9xcGNyX21lcmdlIDwtIHJlYWRfY3N2KCJ3b3JrZXJzX2ZvciBxcGNyIG1lcmdlLmNzdiIsIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZXMgPSBjb2xzKGZ1bmdpY2lkZSA9IGNvbF9sb2dpY2FsKCksIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyaXRoaWRpYSA9IGNvbF9sb2dpY2FsKCksIGlub2N1bGF0ZV9yb3VuZCA9IGNvbF9mYWN0b3IobGV2ZWxzID0gYygiMSIsIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiMiIsICIzIikpLCBpbm9jdWxhdGUgPSBjb2xfbG9naWNhbCgpLCANCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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