[R] Regarding aov Error()

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Mar 28 17:52:00 CEST 2006


Here P is already nested in Q, so s:P suffices.  You are getting the 
warning because most of the cells of s:P:Q are empty.

On Tue, 14 Mar 2006, John Vokey wrote:

> The following dummy data frame has factor Q (with 2 levels) nesting
> factor P (with levels p1 and p2 nested under q1, and p3 and p4 nested
> under q2), but both crossing the random variate s, which has 8
> levels.  The dependent measure is dv.
> > # The data frame:
> > testnest
>    dv  s  P  Q
> 1   1 s1 p1 q1
> 2   2 s2 p1 q1
> 3   1 s3 p1 q1
> 4   2 s4 p1 q1
> 5   1 s5 p1 q1
> 6   3 s6 p1 q1
> 7   3 s7 p1 q1
> 8   4 s8 p1 q1
> 9   2 s1 p2 q1
> 10  3 s2 p2 q1
> 11  3 s3 p2 q1
> 12  1 s4 p2 q1
> 13  1 s5 p2 q1
> 14  2 s6 p2 q1
> 15  2 s7 p2 q1
> 16  3 s8 p2 q1
> 17  3 s1 p3 q2
> 18  3 s2 p3 q2
> 19  4 s3 p3 q2
> 20  1 s4 p3 q2
> 21  1 s5 p3 q2
> 22  1 s6 p3 q2
> 23  2 s7 p3 q2
> 24  2 s8 p3 q2
> 25  4 s1 p4 q2
> 26  3 s2 p4 q2
> 27  1 s3 p4 q2
> 28  2 s4 p4 q2
> 29  4 s5 p4 q2
> 30  1 s6 p4 q2
> 31  3 s7 p4 q2
> 32  1 s8 p4 q2
>
> # The following aov() call is structurally correct with respect
> # to the design, and appropriate error-terms, but, as can be seen,
> # returns an error:
>
> > testnest.aov=aov(dv~Q+P%in%Q+Error(s+s:Q+s:P:Q),data=testnest)
> Warning message:
> Error() model is singular in: aov(dv ~ Q + P %in% Q + Error(s + s:Q +
> s:P:Q), data = testnest)
>
> # However, applying the summary() method to the aov output, produces
> the correct analysis:
>
> > summary(testnest.aov)
>
> Error: s
>           Df Sum Sq Mean Sq F value Pr(>F)
> Residuals  7 5.8750  0.8393
>
> Error: s:Q
>           Df  Sum Sq Mean Sq F value Pr(>F)
> Q          1  0.1250  0.1250   0.068 0.8018
> Residuals  7 12.8750  1.8393
>
> Error: s:Q:P
>           Df Sum Sq Mean Sq F value Pr(>F)
> Q:P        2  0.250   0.125  0.1111 0.8956
> Residuals 14 15.750   1.125
>
> I have tried many different ways of denoting the Error()
> partitioning, but can't find one that produces both the correct
> analysis *AND* no singularity error on the aov() call.  Any suggestions?
>
> --
> Please avoid sending me Word or PowerPoint attachments.
> See <http://www.gnu.org/philosophy/no-word-attachments.html>
>
> -Dr. John R. Vokey
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list