three way mixed anova with sample triplicates

Hi There,

Im super new to using R so I apologize in advance if this is a very basic and trivial question. Typically I run most of my stats in excel (eek) but the model I should apply now is not suitable for it so ive been trying to manage it in R but am totally lost.

I need to run a 3 way mixed anova looking at the 1 between group factor "Name" (which is soil type) and 2 within group factors "time and treatment". Soils were sampled for metal conc. at 10 different time points. I also need to include sample replicates in the model (each soil type "Name" at each time point has 3 replicates ("Inc Num").

The data:

datapasta::df_paste(head(iris, 5)[, c('Time', 'Name', 'Inc_Num', 'Treatment', 'M_conc')])
data.frame(
  Time = c(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
           1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2),
  Name = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1,
           2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3),
  Inc_Num = c(1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3,
              1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3),
  Treatment = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
                2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
  M_conc = c(25.2, 14.9, 38.4, 11.7, 49.0, 15.5, 55.6, 27.5, 43.6, 27.7, 45.4, 
             28.8, 73.1, 30.4, 80.7, 27.8, 72.6, 26.7, 50.4, 13.7, 52.4, 13.4, 
             45.9, 17.5, 49.3, 30.9, 59.8, 38.9, 39.5, 21.9, 34.1, 25.7, 74.9, 34.3, 84.0, 21.8)
)

I started by changing time, name, and inc number to factors:

M_test <-  within(M_test,{
  Name <- factor(Name)
  Time <- factor(Time)
  Inc_Num <- factor(Inc_Num)})

and then running the anova, Im not sure if this is even a correct approach:

threeanova <- aov(M_conc ~ Treatment*Time*Name, M_test)
summary(threeanova)

if this is correct, how can I also include the test to include the sample replicates as 1 entity (if that makes sense).

Thank you!

Hi, can you provide a reproducible example of your dataset?

Hi! I've uploaded the dataset as you suggested here :slight_smile:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.