[R] [package-car:Anova] extracting residuals from Anova for Type II/III Repeated Measures ?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat Feb 21 00:05:59 CET 2009


John Fox wrote:
> Dear Tal,
> 
> I didn't have time to look at all this yesterday.
> 
> Since aov() doesn't do what I typically want to do, I guess I've not paid
> much attention to it recently. I can see, however, that you appear to have
> specified the error strata incorrectly, since (given your desire to compare
> to Anova) the within-block factors are nested within blocks. Something like
> 
>> npk.aovE <- aov(value ~  N*P*K + Error(block/N*P*K), npk.long)
> 
> should be closer to what you want, and in fact produces all of the sums of
> squares, but doesn't put all of the error terms together with the
> corresponding terms; thus, you get, e.g., the test for N but not for P and
> K, even though the SSs and error SSs for the latter are in the table. By
> permuting N, P, and K, you can get the other F tests. I suspect that this
> has to do with the sequential approach taken by aov() but someone else more
> familiar with how it works will have to fill in the details. I wonder,
> though, whether you've read the sections in Statistical Models in S and MASS
> referenced in the help file for aov.

Does it not help if you use Error(block/(N*P*K))? I suspect you're being 
bitten by operator precedence, of the same making as the fact that 1/2*2 
is 1, not 0.25.

	-pd

-- 
    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907




More information about the R-help mailing list