[R] Problem with ANOVA repeated measures: "Error() model is singular"

From: <angelo.arcadi_at_virgilio.it>
Date: Sat, 21 May 2011 15:33:19 +0200 (CEST)


Hello everybody,
I need an help because I don´t know if the command for the ANOVA analysis I am performing in R is correct. Indeed using the function aov I get the following error:"In aov (......) Error() model is singular"

The structure of my table is the following: subject, stimulus, condition, sex, response

Example:     

    subject  stimulus condition sex      response
    subject1    gravel    EXP1    M       59.8060
    subject2    gravel    EXP1    M       49.9880
    subject3    gravel    EXP1    M       73.7420
    subject4    gravel    EXP1    M       45.5190
    subject5    gravel    EXP1    M       51.6770
    subject6    gravel    EXP1    M       42.1760
    subject7    gravel    EXP1    M       56.1110
    subject8    gravel    EXP1    M       54.9500
    subject9    gravel    EXP1    M       62.6920
    subject10    gravel    EXP1    M       50.7270
    subject1    gravel    EXP2    M       70.9270
    subject2    gravel    EXP2    M       61.3200
    subject3    gravel    EXP2    M       70.2930
    subject4    gravel    EXP2    M       49.9880
    subject5    gravel    EXP2    M       69.1670
    subject6    gravel    EXP2    M       62.2700
    subject7    gravel    EXP2    M       70.9270
    subject8    gravel    EXP2    M       63.6770
    subject9    gravel    EXP2    M       72.4400
    subject10    gravel    EXP2    M       58.8560
    subject11    gravel    EXP1    F       46.5750
    subject12    gravel    EXP1    F       58.1520
    subject13    gravel    EXP1    F       57.4490
    subject14    gravel    EXP1    F       59.8770
    subject15    gravel    EXP1    F       55.5480
    subject16    gravel    EXP1    F       46.2230
    subject17    gravel    EXP1    F       63.3260
    subject18    gravel    EXP1    F       60.6860
    subject19    gravel    EXP1    F       59.4900
    subject20    gravel    EXP1    F       52.6630
    subject11    gravel    EXP2    F       55.7240
    subject12    gravel    EXP2    F       66.4220
    subject13    gravel    EXP2    F       65.9300
    subject14    gravel    EXP2    F       61.8120
    subject15    gravel    EXP2    F       62.5160
    subject16    gravel    EXP2    F       65.5780
    subject17    gravel    EXP2    F       59.5600
    subject18    gravel    EXP2    F       63.8180
    subject19    gravel    EXP2    F       61.4250
    .....
    .....

    .....
    .....

As you can notice each subject repeated the evaluation in 2 conditions (EXP1 and EXP2).

What I am interested in is to know if there are significant differences between the evaluations of the males and the females.

This is the command I used to perform the ANOVA with repeated measures:

aov1 = aov(response ~ stimulus*sex + Error(subject/(stimulus*sex)), data=scrd) summary(aov1)

I get the following error:

> aov1 = aov(response ~ stimulus*sex + Error(subject/(stimulus*sex)), data=scrd)
    Warning message:
    In aov(response ~ stimulus * sex + Error(subject/(stimulus * sex)), :     Error() model is singular
> summary(aov1)

    Error: subject

              Df  Sum Sq Mean Sq F value Pr(>F)
    sex        1  166.71  166.72   1.273  0.274
    Residuals 18 2357.29  130.96               
    
    Error: subject:stimulus
                  Df Sum Sq Mean Sq F value Pr(>F)    
    stimulus       6 7547.9 1257.98 35.9633 <2e-16 ***
    stimulus:sex   6   94.2   15.70  0.4487 0.8445    
    Residuals    108 3777.8   34.98                   
    ---
    Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1     

    Error: Within

               Df Sum Sq Mean Sq F value Pr(>F)
    Residuals 420 9620.6  22.906               

>

The thing is that looking at the data it is evident for me that there is a difference between male and females, because for each stimulus I always get a mean higher for the males rather than the females. Therefore the ANOVA should indicate significant differences....

Is there anyone who can suggest me where I am wrong?

Finally, I know that in R there are two libraries on linear mixed models called nlme and lme4, but I have never used it so far and I don´t know if I have to utilize it for my case. Is it the case to utilize it? If yes, could you please provide a quick R example of a command which could solve my problem?

Thanks in advance!

Best regards

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 21 May 2011 - 14:00:17 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 21 May 2011 - 14:50:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive