defining model with aov_car

Home forums ANOVA defining model with aov_car

This topic contains 3 replies, has 2 voices, and was last updated by  henrik 1 month ago.

  • Author
    Posts
  • #184

    Andrew King
    Participant

    I have a four-way Repeated Measures ANOVA. I want to test the main effects and the first-order interactions and one second-order interaction. Rather than using the aov function in R, I wanted to use Anova from the CAR package, because it can test sphericity assumptions. As I have never managed to find a way to properly cast long-format data as wide-format data with four factors (96 columns), I decided to use aov_car from the AFEX package as it passes long-format data to the Anova function (right?). However, despite specifying the model to only test the main effects and interactions I am interested in, the output gives me the full, factorial model with all the interactions. Also, sphericity tests were not available due to singular error SSP matrix.

    Without going to details of the code and data I have used to perform this, can you tell me if I am mis-using the AFEX package, or why I am not getting the output I expect? Of course I can give these details if necessary, but I would have to clean up the code first.

    Thanks!

  • #185

    henrik
    Keymaster

    You can simply and safely ignore the tests that you are not interested in. A repeated-measures ANOVA as run with car::Anova() (this is exactly what afex uses) **always** tests all effects (so this is a consequence of car::Anova() and not of afex). I know this because I asked John Fox (the author of car) a very similar question some years ago and he responded with:

    The within-subjects contrasts are constructed by Anova() to be orthogonal in the row-basis of the design, so you should be able to safely ignore the effects in which (for some reason that escapes me) you are uninterested.

    The full quote can be seen at the following link which also provides link to the full exchange:
    https://stat.ethz.ch/pipermail/r-help/2012-July/319143.html

    I also think there is not much you can do if the sphericity tests fail for your data (at least I do not know what, these tests are also all done by car).

    Hope that helps!

  • #187

    Andrew King
    Participant

    Thanks for your blisteringly quick reply, Henrik!
    The strange thing is that I tried running car::Anova with a smaller wide-format dataset that I have, (specifying the model as: dataMatrix ~ 1) and being able to get tests for only the specified terms in idesign. However, I was able to get sphericity tests for this dataset with both afex::aov_car and car::Anova (having the data in both long and wide formats). So clearly it is a matter of having too many conditions (or levels of one particular factor?) in the larger dataset for the number of subjects (right?). :\
    Good to know I can ignore the tests I am not interested in. I got told off in my thesis defence for doing this and was told to always report the full set of tests, which John Fox also seems to be advocating in your quote. Any idea why?

    Thanks for your help!
    Andy

  • #190

    henrik
    Keymaster

    AFAIK, the problem of the sphericity tests is not so much related to the number of conditions or their levels (as long as you have more participants than cells of the design), but probably more bad luck with your data. You might try to randomly remove one or two participants to see if this still happens. However, this is not part of afex so might also be wrong.

    For balanced designs where the contrasts are orthogonal (as is always the case for repeated measures ANOVA via car::Anova()) ignoring individual effects does not change the other effects. Hence you can do it here. However, should one of the previously mentioned conditions (balance and orthogonality) not be met, omitting one of the effects from a model changes the other effects. This could be what your thesis committee had in mind. Furthermore, if a test is always at least implicitly part of the model then why omit it? If its inclusion does not change the model, knowing it results does not hurt.

You must be logged in to reply to this topic.