Edit: I would like to test the time effect over three times and inside group. I was looking about ANOVA repeated measures but it looks very confusing (time effect, interaction effect... I'm sometimes lost about what i'm testing). In non-parametric conditions i have no idea about what to perform. If I can run code in R and obtain significant letter between times inside groups it would be perfect. Here is you ll find my data and code i used so far. column moda is for Group, time for time and unified is a variable measured.

I have three dependent groups and for each group I have measurements overtime (t0,t14,t29). I'm looking to perform an ANOVA repeated measures to know if inside one group if there is difference. Here is my data:

structure(list(moda = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("BS1", 
"HW1", "PG"), class = "factor"), time = c("t0", "t0", "t0", "t0", 
"t0", "t0", "t0", "t0", "t0", "t0", "t0", "t0", "t0", "t0", "t0", 
"t0", "t0", "t0", "t0", "t0", "t0", "t0", "t0", "t0", "t0", "t0", 
"t0", "t0", "t14", "t14", "t14", "t14", "t14", "t14", "t14", 
"t14", "t14", "t14", "t14", "t14", "t14", "t14", "t14", "t14", 
"t14", "t14", "t14", "t14", "t14", "t14", "t14", "t14", "t14", 
"t14", "t14", "t14", "t29", "t29", "t29", "t29", "t29", "t29", 
"t29", "t29", "t29", "t29", "t29", "t29", "t29", "t29", "t29", 
"t29", "t29", "t29", "t29", "t29", "t29", "t29", "t29", "t29", 
"t29", "t29", "t29", "t29"), unified = c(1.5, 1.5, 2, 1, 1.5, 
1.2, 1, 2.4, 1.3, 1.4, 1.7, 2, 1.8, 2.3, 2.5, 2.5, 1.5, 1.5, 
2, 2.1, 1.8, 1.3, 2, 1.5, 2, 3.5, 1.5, 1.7, 1.2, 1.2, 1.3, 1, 
4, 2, 0.5, 2, 1, 3, 6, 3, 2, 3.4, 5.3, 4, 1, 54, 3, 2.5, 2, 3.52, 
3, 7, 2, 8, 3.4, 1, 1.65, 1.8, 1.9, 1.7, 1.8, 1.9, 1, 2, 1.7, 
8, 5, 3.5, 5, 5.8, 2, 3.8, 1, 8, 8, 9.9, 1, 6.8, 8, 3, 9.6, 8.6, 
3, 9)), row.names = c(NA, -84L), class = "data.frame")`
I tried this code 
`fit <-  aov(dflong1$unified ~ dflong1$time + Error(dflong1$moda/dflong1$time), data = dflong1)
 bbb <- HSD.test(fit,"yyy",group=TRUE) 

But the post HOC tukey can't handle it. So i try another way:

 lme_velocity = lme(dflong1$unified ~ dflong1$time, data=dflong1, random =    ~1|dflong1$moda)

 summary(glht(lme_velocity, linfct=mcp(Material = "Tukey")), test =     adjusted(type = "bonferroni")) 

I tried to follow the question here Post hoc test after ANOVA with repeated measures using R but i got this error:

lme_velocity = lme(dflong1$unified ~ dflong1$time, data=dflong1, random = ~1|dflong1$moda, na.action = na.exclude)

Error in model.frame.default(formula = ~dflong1 + unified + time + moda, : invalid type (list) for variable 'dflong1'

How can i do so, to obtain significant letters following a postHOC after an ANOVA, like a simple ANOVA? Is it correct if I try to subset my data before by groups and then perform an Anova like this

aov(dflong1$unified~dflong1$time,paired = TRUE, alternative =  "two.sided")
  • $\begingroup$ I recommend abandoning the aov approach and using either lme or lmer. The emmeans package can be used for the mean separation you desire. But I think you want your random variable to be the identity of each subject. Presumably there is a subject that is measured at t0 and then again at t14, and so on. $\endgroup$ – Sal Mangiafico Apr 14 at 13:30
  • $\begingroup$ I could subset my data by each group and then perform a lme between times points under a subset, does it sound good? If you have any suggestions or posts to learn lme and lmer, feel free. $\endgroup$ – Simon Apr 14 at 17:33
  • $\begingroup$ lme can handle complex models; there's no need to subset. Your initial inclination is right. You just need to learn how to formulate the mixed-effects model correctly. $\endgroup$ – Sal Mangiafico Apr 14 at 18:33
  • $\begingroup$ But is it the case that you have repeated measures on subjects, so that the same subject was measured at each of the times? $\endgroup$ – Sal Mangiafico Apr 14 at 18:38
  • $\begingroup$ Yes same subject was mesured each time. I ll learn lme so :) thank you $\endgroup$ – Simon Apr 14 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.