[R] between-within anova: aov and lme
William Simpson
wsimpson at utsc.utoronto.ca
Thu Aug 3 14:01:18 CEST 2006
I have 2 questions on ANOVA with 1 between subjects factor and 2 within factors.
1. I am confused on how to do the analysis with aov because I have seen two examples
on the web with different solutions.
a) Jon Baron (http://www.psych.upenn.edu/~baron/rpsych/rpsych.html) does
6.8.5 Example 5: Stevens pp. 468 - 474 (one between, two within)
between: gp
within: drug, dose
aov(effect ~ gp * drug * dose + Error(subj/(dose*drug)), data=Ela.uni)
b) Bill Venables answered a question on R help as follows.
- factor A between subjects
- factors B*C within subjects.
aov(response ~ A*B*C + Error(subject), Kirk)
"An alternative formula would be response ~ A/(B*C) + Error(subject), which
would only change things by grouping together some of the sums of squares."
-------------------------------------------------------
SO: which should I do????
aov(response ~ A*B*C + Error(subject), Kirk)
aov(response ~ A/(B*C) + Error(subject), Kirk)
aov(response ~ A*B*C + Error(subject/(B*C)), Kirk)
--------------------------------------------------------
2. How would I do the analysis in lme()?
Something like
lme(response~A*B*C,random=~1|subject/(B*C))???
Thanks very much for any help!
Bill Simpson
More information about the R-help
mailing list