0

I have run an experiment investigating how fructose concentration changes for mosquitoes held in four different preservative methods over 3 time periods (days 7, 14 and 21).

Here's what my data looks like:

'data.frame':   120 obs. of  4 variables:
 $ treatment             : Factor w/ 5 levels "C_ETOH","Frozen",..: 5 5 5 5 5 5 5 5 1 1 ...
 $ day                   : int  7 7 7 7 7 7 7 7 7 7 ...
 $ mean_absorbance       : num  0.472 0.652 0.284 0.421 0.693 ...
 $ fructose_concentration: num  0.559 0.802 0.305 0.49 0.857 ...

The fructose concentration residuals did not violate linearity, so I fit a glm() to my data

PRES_data_glm <- glm(fructose_concentration ~ day*treatment, data = PRES_data)

Running an ANOVA on the model showed there was a significant effect of treatment and an interaction with day and treatment.

Anova(PRES_data_glm)
Analysis of Deviance Table (Type II tests)

Response: fructose_concentration LR Chisq Df Pr(>Chisq)
day 3.415 1 0.0646 .
treatment 65.576 4 1.946e-13 *** day:treatment 41.057 4 2.616e-08 ***


Signif. codes: 0 ‘*’ 0.001 ‘’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

I want to use emmeans to examine the effect of each preservation method on each day and across days.

Unfortunately, many of the emmeans comparisons (and contrasts) I try only produce the day 14 comparison with the treatments.

comparisons_PRES <- emmeans(PRES_data_glm, pairwise ~ day*treatment)
comparisons_PRES

$emmeans day treatment emmean SE df asymp.LCL asymp.UCL 14 C_ETOH 0.522 0.0451 Inf 0.434 0.611 14 Frozen 0.845 0.0451 Inf 0.757 0.934 14 HF 0.841 0.0451 Inf 0.752 0.929 14 KOD 0.990 0.0451 Inf 0.901 1.078 14 W_ETOH 0.654 0.0451 Inf 0.566 0.743

Confidence level used: 0.95

$contrasts contrast estimate SE df z.ratio p.value 14,C_ETOH - 14,Frozen -0.32305 0.0638 Inf -5.061 <.0001 14,C_ETOH - 14,HF -0.31834 0.0638 Inf -4.987 <.0001 14,C_ETOH - 14,KOD -0.46721 0.0638 Inf -7.320 <.0001 14,C_ETOH - 14,W_ETOH -0.13202 0.0638 Inf -2.068 0.2339 14,Frozen - 14,HF 0.00471 0.0638 Inf 0.074 1.0000 14,Frozen - 14,KOD -0.14415 0.0638 Inf -2.258 0.1586 14,Frozen - 14,W_ETOH 0.19103 0.0638 Inf 2.993 0.0232 14,HF - 14,KOD -0.14886 0.0638 Inf -2.332 0.1347 14,HF - 14,W_ETOH 0.18632 0.0638 Inf 2.919 0.0289 14,KOD - 14,W_ETOH 0.33518 0.0638 Inf 5.251 <.0001

P value adjustment: tukey method for comparing a family of 5 estimates

I have tried the suggestions outlined in the answer of a previous post, Pairwise comparisons via emmeans

pairs(comparisons_PRES, simple = "each")

But it is only giving me the day 14 comparisons (I suspect it may be to do with how I have written the emmeans comparison). Any help would be much appreciate.

  • Please note in the model summary that day has only 1 d.f. That's because you have put it in the model as a numeric predictor, and apparently its average value is 14. Replace day by factor(day) in the data, re-fit the model, and re-do all the summaries and EMMs. – Russ Lenth Jun 03 '21 at 01:49
  • Thanks kindly @RussLenth. That has indeed solved the problem. – mossie_tom Jun 03 '21 at 05:20

0 Answers0