[R] random effects in analysis of variance

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Feb 10 13:45:32 CET 2000


On Thu, 10 Feb 2000, Monika Ferster wrote:

> I have a data.frame paint (below-mentioned). In SPlus I used the command 
> 
> raov( MOISTURE ~ BATCH / PROBE )
> 
> (you could do raov( MOISTURE ~ BATCH +  PROBE%in%BATCH) as well)
> 
> so that the factors are taken as random. In R this function raov doesn't
> exist. How can I calculate the same? Maybe with lme, but how? 

Easier, in both S and R

> summary(aov( MOISTURE ~ BATCH + Error(BATCH / PROBE) , data=paint))
Error: BATCH 
      Df Sum of Sq  Mean Sq 
BATCH 14  1210.933 86.49524

Error: PROBE %in% BATCH 
          Df Sum of Sq  Mean Sq F Value Pr(F) 
Residuals 15    869.75 57.98333              

Error: Within 
          Df Sum of Sq   Mean Sq F Value Pr(F) 
Residuals 30      27.5 0.9166667              

but just so you know how,

fit <- lme(MOISTURE ~ 1, random = ~1 | BATCH / PROBE, data=paint)

is the fit you want, and print or summary will let you pick off the
estimates you might need.

There is a worked example almost exactly like this in V&R3.

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

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list