I have experimental data that looks like this:
RaspberrySample ProcessingMethod VirusAssay MeasuredConcentration 1 Ctrl A 7.111 1 Ctrl B 8.408 1 Ctrl C 8.957 2 New A 6.974 2 New B 8.860 2 New C 8.510 3 Ctrl A 6.938 3 Ctrl B 8.526 3 Ctrl C 8.525 4 New A 6.623 4 New B 8.210 4 New C 8.639
These are 40 different raspberry samples that have been artificially contaminated with equal concentrations of three different viruses (A, B, C). For each sample, I have either used processing method “Ctrl” (20 samples) or “New” (20 samples), and then I have measured the concentration of the tree viruses in each sample, using different detection assays. In my analysis I will treat processing method and virus detection assay as fixed effects. The design is balanced.
The aim of the experiment is to see which of the two processing methods that provides the highest measured viral concentration for each specific virus, and to estimate the size of these differences.
I realise that I need to treat “raspberry sample” as a random effect (within-sample measurements are expected to be more similar to each other than between-sample measurements). I am using lmer in R and is quite new to it, so I am wondering if I have set up my model correctly, given the experimental design described above. My model is:
model1 <- lmer(MeasuredConcentration ~ ProcessingMethod * VirusAssay + (1|RaspberrySample), data = pathogens, REML = FALSE)
Then, for pairwise comparison of the different treatment combinations, I use:
library("emmeans") lsmeans(model1, pairwise ~ ProcessingMethod*VirusAssay, data = pathogens, adjust = "Tukey")
Any comments on this, am I thinking correctly about the random effect here?