EzANOVA DF issue

99 views
Skip to first unread message

Hannah TH

unread,
Jun 28, 2021, 6:05:52 PM6/28/21
to ez4r
Hello, 

I am having trouble running my 2 (training group: horizontal, vertical) x 2 (training block: 1, 10) x2 (carry: carry, no carry) mixed ANOVA. It is miscalculating the DenDF and I cannot figure out how to correct it. 

Here is the code: 
MixedModel2<-ezANOVA(data=BOCdata,dv=.(Avg_RT),wid=.(ID),within=.(Training_Block),within_full =.(Carry),between = .(Training_Orientation),detailed=TRUE,type=3)
print(MixedModel2)

And results: Screen Shot 2021-06-28 at 4.38.44 PM.png 

When I get rid of the within_Full argument, I get: 
Screen Shot 2021-06-28 at 4.41.45 PM.png
For some reason it is saying that my DFd is 199 but that is not correct. It should be 609. Can you help me figure out why this is happening and how to fix it? Thanks!

Mike Lawrence

unread,
Jun 28, 2021, 6:17:30 PM6/28/21
to ez4r
Give the afex package a try:

I haven't touched anovas in nearly a decade now, so the intricacies of df's have long fled my brain, sorry!

Hannah TH

unread,
Jun 28, 2021, 6:18:58 PM6/28/21
to ez4r
Here is snap shot of the data I am using as well. I have 205 participants so there should be about 824 cases but due to incorrect responses (incorrect responses were not analyzed) I have 805 cases. 101 of those participants were in the V group and 104 were in the H group. 
 Capture.PNG

Mike Lawrence

unread,
Jun 28, 2021, 6:22:38 PM6/28/21
to ez4r
Oh, wait, try:

ezANOVA(
  data=BOCdata
  ,dv=.(Avg_RT)
  ,wid=.(ID)
  ,within=.(Training_Block,Carry) #this is what I changed
  ,between = .(Training_Orientation)
  ,detailed=TRUE
  ,type=3
)

Hannah Ter Haar

unread,
Jun 28, 2021, 6:27:22 PM6/28/21
to ez...@googlegroups.com
Thank you for the reply! I have the same issue when switching Carry and Training_block. Here are the results:
Screen Shot 2021-06-28 at 6.25.37 PM.png

--
You received this message because you are subscribed to a topic in the Google Groups "ez4r" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ez4r/L2eYETzWHao/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ez4r+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ez4r/af677e91-880b-4e01-bc14-6fcad3631b7en%40googlegroups.com.

Hannah Ter Haar

unread,
Jun 28, 2021, 6:34:28 PM6/28/21
to ez...@googlegroups.com
Also, I am not sure if this matters but I saw in another conversation that the lmerTest package may interfere with ezAnova. I do have that loaded as well as I am also doing an MLM with another set of data. Could this interfere with the DF? 

Mike Lawrence

unread,
Jun 28, 2021, 6:39:16 PM6/28/21
to ez4r
No, the lmerTest conflict pertains only to using the ezPredict function for lmer models.

Have you used ezDesign to check the variables?

ezDesign(
  BOCdata
  , y = ID
  , x = Carry
  , row = training_orientation
 , col = training_block
)

Mike Lawrence

unread,
Jun 28, 2021, 6:41:29 PM6/28/21
to ez4r
Also, is it possible that the #s you got from GPower were based on raw trial counts before averaging?

Hannah Ter Haar

unread,
Jun 28, 2021, 6:45:26 PM6/28/21
to ez...@googlegroups.com
Here is what I got for the ezDesign. What do you think? I've never used ezDesign so I'm not sure how to interpret this. Also I tried the afex package and it's giving me the same problem. I really appreciate your help. I've been stuck on this issue for the past month and have gotten nowhere. Screen Shot 2021-06-28 at 6.41.16 PM.pngScreen Shot 2021-06-28 at 6.39.12 PM.png

Hannah Ter Haar

unread,
Jun 28, 2021, 6:48:29 PM6/28/21
to ez...@googlegroups.com
Here is my G*Power analysis. My stats professor looked over it so I assumed it was correct but maybe that's been my problem this whole time! 
image.png

Mike Lawrence

unread,
Jun 29, 2021, 4:36:31 PM6/29/21
to ez4r
Ah, I see the problem. See how the output numerator df in GPower is different too? That's because you entered "4" for the "number of measurements" on the input side, which isn't correct for your design. My long-atrophied anova neurons are waking up now too. Think of it this way, in any within-manipulated variable with two levels, if you collapse each participant's data to a difference score between the two levels then run a one-sample t-test on the difference score, that will yield the same result as if you did a paired t-test which in turn will yield the same result as a repeated-measures anova (where the F in the latter will be the t of the former squared). So the numerator df will be 1 in all three (you usually don't even see the numerator df in a t-test, but it's there). If you have two two-level within variables, then a test of the interaction reflects a double-difference; that is, if you have variables A & B with levels A1/A2 and B1/B2, respectively, you can compute the double-difference ( A1_B1 - A2_B1 ) - ( A1_B2 - A2_B2 ) in each participant to get a set of double-difference scores that you can submit to a one-sample t-test, and that will give you the same result as doing a 2x2 repeated-measures anova and looking at the row for the interaction. So again, the numerator df should be 1. Finally, if you have a third variable that's between-Ss, then the three-way interaction is like doing a two-sample t-test on the double-differences, so still a numerator df of 1.

Now, with respect to the denominator df, I'm still pretty hazy on how to get from your stated 205 participants to the 199 shown in the tables; are you sure there are truly 205 there? Run:
length(unique(BOCdata$ID)) to check.

If there truly are 205, then I would have expected the denominator df to be (N_group1 + N_group2)-2 = 203 for all the effects, so maybe each difference score implies subtraction of two degrees of freedom? But that doesn't feel right (esp. for the main effects). So I'm guessing that you really only have 201 participants?

Hannah Ter Haar

unread,
Jul 18, 2021, 2:10:32 PM7/18/21
to ez...@googlegroups.com
Hi Mike,
Thank you so much for everything. You were right about the power analysis. There were some missing people in my data and that's why my numbers were off. I really appreciate you taking the time to help me figure all of that out. I ended up passing my Masters defense this week and wanted to let you know how much I appreciate the help. Without you, I'm not sure I would have realized the mistake in time. I appreciate all the help you've given me and the time you took out of your own schedule to figure out the issue.
Thanks for everything,
Hannah

Mike Lawrence

unread,
Jul 18, 2021, 2:49:16 PM7/18/21
to ez...@googlegroups.com
Aw, happy to help!🙂 And congrats on your defence! 😃

You received this message because you are subscribed to the Google Groups "ez4r" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ez4r+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ez4r/CAA61d2_KRuj3jmT3POqxXNXFmC5-WSLn_y8WwFzVRc8wfhA5bg%40mail.gmail.com.
--

--
Mike Lawrence, PhD
Co-founder & Research Scientist
Axem Neurotechnology
axemneuro.com

~ Certainty is (usually) folly ~
Reply all
Reply to author
Forward
0 new messages