I'm struggling with my data, I hope you can help me. I let a group of students (females and males) walk twice, one time with a low speed, 2nd time with high speed. Now I have to analyze these data but I have problems with two-way repeated measures ANOVA because each guy did the walk twice (so repeated) and two-way because I want to observe the differences according to the type of speed (low/high) and the sex (F/M). So I want to observe the differences in:
a) slow speed vs high speed (high vs low)
b) slow speed males vs high speed males (low_m vs high_m)
c) slow speed females vs high speed females (low_f vs low_f)
d) slow speed males vs slow speed females (low_m vs low_f)
e) high speed males vs high speed females (high_m vs high_f)
Here a part of my data:
id<-c(1:10)%>%rep(each=2)
sex<-c("m","f")%>%rep(each=10)
type<-c("low","high","high","low","high","low","low","high","low","high","high","low","low","high","low","high","low","high","low","high")
speed<-c(3.2,2.6,4.0,3.2,3.2,3.8,3.4,2.4,3.4,2.2,3.4,3.4,3.0,2.0,3.6,3.6,3.0,4.6,3.6,4.4)
knee<-c(57.6,56.7,52.4,52.8,48.9,51.2,52.3,47.3,62.6,54.0,51.6,51.6,67.6,62.8,71.5,71.5,52.1,54.3,58.4,65.4)
df<-data.frame(id, sex, type, speed, knee)
df$type<-as.factor(df$type)
df$sex<-as.factor(df$sex)
However my problem is: If I run the classic aov, I have difficulties to continue because I can't use TukeyHSD; If I run the rstatix anova_test I get an error.
aov_classic<-aov(speed~type*sex + Error(id/(type*sex)), data=df)
summary(aov_classic)
aov_rstatix<-anova_test(data=df, dv=speed, wid=id, within=c(type, sex))
In the second way I get the error.
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases
I do not know how to proceed. In the aov_classic way, I do not know how to manage the within interaction (i.e., Error) to obtain the statistical difference under specific conditions, while with the aov_rstatix I cannot go on because the code does not work.
P.S. Since I do not care about the mixed interaction (high_m vs low_f) could I evaluate all of this just with repeated t-test?
I hope you can help me. Thank you in advance.