# How does one show differences in groups with replicates over time in R

I have daily Hydrogen production data and nutrient uptake data. I would like to show differences in treatments for Hydrogen production over the course of 3 days. Basically identify which group produces the highest amount of H2. I tried using Rcompanion and I can plot them out but i still want to show a statistical difference in condition. Can I use anova or something similar? Any help is appreciated!

Code:

library(rcompanion)
library(ggplot2)
dat <- read.csv("projects/Iulian_draft_paper/h2_daily.csv", head=T)
head(dat)

Sum = groupwiseMean(H2_daily ~ Sample+Day,
data = dat,
conf = 0.95,
digits = 3,
traditional = FALSE,
percentile  = TRUE)

pd = position_dodge(.2)
ggplot(Sum, aes(x = Day,
y = Mean,
color = Sample)) +
geom_errorbar(aes(ymin=Percentile.lower, ymax=Percentile.upper),
width=.2, size=0.7, position=pd) +
geom_point(shape=15, size=4, position=pd) + theme_bw() +
theme(axis.title = element_text(face = "bold")) +
ylab("Mean H2 per day")


Sample data:

Sample    Day    Replicate  H2_daily
EFF+A 33   1         1       11
EFF+A 33   1         1       15
EFF+A 33   1         1       10
EFF+A 33   2         2       21
EFF+A 33   2         2       16
EFF+A 33   2         2       17
....
S-EFF+A 100   2         23       56
S-EFF+A 100   2         23       50
S-EFF+A 100   2         23       50
S-EFF+A 100   3         24       42
S-EFF+A 100   3         24       44
S-EFF+A 100   3         24       37


Model used:

mod <- lmer(H2_daily~Sample+Day+(1|Replicate), data=dat)
summary(glht(mod))

• How are replicates generated? Are they independent observations? – StatsStudent Feb 3 at 18:59
• They are biological replicates. Each replicate has the same bacterial population but in separate bottles. So, they should be independent observations. All bottles are measured daily for 3 days. So the day 2 and day 3 data wouldnt be independent but the replicates themselves are independent. Please do let me know if any more information would help. Thank you for your time! – user1364517 Feb 4 at 9:03
• Roughly, using lme4 package and lmer function: lmer(H2_daily~Sample+Day+(1|Replicate)). Note: you would have to recode the Replicate variable to have unique id's for each replicate. – user2974951 Feb 4 at 13:06
• So when you say unique ID for each replicate do i just number them all differently? Would that be sufficient? – user1364517 Feb 4 at 13:10
• So, i updated my post to reflect changes to the Replicate variable, plot to show the differences between my groups and added a model based on the suggestion above. Is this how i proceed? – user1364517 Feb 4 at 13:36