Checking for the sphericity assumption of repeated-measures ANOVA?

Hello all,

I have run a repeated-measures ANOVA below:

ANOVAtest <- anova_test(data=Book19,
formula=Proportionofcorrecttrials~Condition*Firsttargetboundary,
dv=Proportionofcorrecttrials, wid=ID,within=c(Condition,Firsttargetboundary))

I have then tried to check the sphericity assumption by entering the following command:

get_anova_table(ANOVAtest, correction = c("auto"))`

However, the output produced is this:

Screenshot 2020-02-27 at 19.23.10

Which is fine, except that it is not displaying the results from the test for sphericity?

What am I doing wrong?

Hello,
please try writing:

ANOVAtest

in the console

Screenshot 2020-02-28 at 09.06.45

Hello @nirgrahamuk, when I try doing that it gives me the output above but I still don't see any sphericity result?

Hmmm. I tested by working an example of a repeated measures analysis and in my case the result was I did get sphericity check info by doing as I asked you to do. How can we confirm that your analysis is a repeated measures one ?

Ah yes, I see where the problem is: I entered the formula for a between-subjects ANOVA: I have changed the formula to this:

ANOVAtest <- anova_test(data=Book19, formula=Proportionofcorrecttrials~ConditionFirsttargetboundary+Error(ID/ConditionFirsttargetboundary), dv=Proportionofcorrecttrials, wid=ID,within=c(Condition,Firsttargetboundary))

However, this now gives me the error:

Each row of output must be identified by a unique combination of keys.
Keys are shared for 75 rows:

How should I proceed?

@nirgrahamuk

Does your data include observations on subjects repeated at different times ? If so some combination of subject id and time of the measurement should be unique, but this wasn't found in your data?

@nirgrahamuk yes, each subject is measured at 5 different distances, across 3 different speeds: and thus speed and distance are the within-subject variables, hence why I grouped by Condition (speed) and Firsttargetboundary (distance)

Which is why I am confused...

I think it is because some combinations produce the same value for the dependent variable:

142.215 1 P_200219091823 0.0000000
142.215 1 P_200219091823 0.0000000

Ahh perhaps this is the problem, maybe some ID's are duplicated?

Can you double check the actual combinations of these by using group_by() and count() on your data to show that condition and firsttargetboundary are unique and that there are not 75 non unique combinations?

Yes I think ID P_200219091823 may have been duplicated @nirgrahamuk
I will edit that and check again

I don't know your column order. Which columns are condition and firsttargetboundary?
What you show is completely duplicated so if it contains both cars, this is example of non unique. Shouldn't they be different in at least one of the two variables we are discussing?

yes they should!

142.215 is the distance, 1 is the speed condition, the 3rd column is ID and 4th column is dependent variable of Proportionofcorrecttrials

@nirgrahamuk

So, you need to check your data pipeline from the earliest point you got your data to its present construction did a mistake cause duplicates ? Or is it an issue with the original data you sourced. If so simply deduoing must be considered. This might not be so bad if the data is entirely duplicated

Yes, I am just going through the raw data now and then will retry the formula and let you know :smiley:

ANOVAtest <- anova_test(data=Book19, formula=Proportionofcorrecttrials~ConditionFirsttargetboundary+Error(ID/ConditionFirsttargetboundary), dv=Proportionofcorrecttrials, wid=ID,within=c(Condition,Firsttargetboundary))

Hello @nirgrahamuk, so I have removed the duplicate rows and now I am receiving this output:

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases

It suggests that your data now has NA values.
Can you investigate your data to see if this is the case?

Hello @nirgrahamuk,

Thank you so much! I think I have solved my issue!

Since all the P values for the sphericity test are > 0.05, there are no corrections needed!

It's such a good feeling knowing that you have made progress/achieved something that you've been struggling to achieve!

Very good news :slight_smile:
Was the issue relating to the data having NA's, or was that a red herring ?

A red herring! I corrected the original dataset properly line by line to ENSURE that there were no copies of any such data! :slight_smile:

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