From ripley@stats.ox.ac.uk  Mon Feb 18 09:55:49 2002
From: ripley@stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Mon, 18 Feb 2002 10:55:49 +0100 (MET)
Subject: [Rd] Error strata in aov (PR#1315)
Message-ID: <200202180955.KAA29237@pubhealth.ku.dk>

On Sun, 17 Feb 2002 jzacks@artsci.wustl.edu wrote:

> Full_Name: Jeff Zacks
> Version: 1.4.0
> OS: Mac OS X
> Submission from: (NULL) (209.16.201.87)
>
>
> Hi,
>
> I believe there may be a problem with how Error strata are handled in aov, for
> designs with multiple error strata involving multiple interactions.  The
> following performs the expected repeated-measures ANOVA when called in S-Plus,
> gives an error when called in R.

The problem is the length of your Error formula.  In aov there is a
line:

eTerm <- deparse(errorterm[[2]])

change it to

eTerm <- deparse(errorterm[[2]], width = 500)

and later

lmcall$formula <- form <- update(formula, paste(". ~ .-",
deparse(errorterm)))

needs to be deparse(errorterm, width=500)

and then correct the formula you gave (there is no withn3, so this cannot
have worked in S-PLUS).

With those corrections I get the same answers as S-PLUS 6.0.

> In this example, the design is a simple 2x2x2 repeated-measures design with 2
> subjects.
>
> Hope this is helpful.
>
> Best,
>
> Jeff Zacks
>
> > dat <- read.table("foo", header=T)
> > dat
>    Subj within1 within2 within3 depvar
> 1     A       0       0       1      1
> 2     A       0       1       0      2
> 3     A       1       0       0      3
> 4     A       0       1       1      4
> 5     A       1       0       1      5
> 6     A       1       1       0      6
> 7     B       0       0       1      2
> 8     B       0       1       0      3
> 9     B       1       0       0      4
> 10    B       0       1       1      5
> 11    B       1       0       1      6
> 12    B       1       1       0      7
> > summary(aov(depvar ~ within1*within2*withn3 + Error(Subj:within1 +
> Subj:within2 + Subj:within3 + Subj:within1:within2 + Subj:within1+within3 +
> Subj:within2:within3), data=dat))
> Error in model.frame.default(formula = depvar ~ Subj:within1 + Subj:within2 +  :
>
> 	object is not a matrix
> >
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Error strata in aov (PR#1315)
ripley@stats.ox.ac.uk