Skip to content

anova vs aov commands for anova with repeated measures

5 messages · Bill Venables, Dieter Menne, Frodo Jedi

#
lm() and aov() are not fully equivalent.  They both fit linear models, but they use different algorighms, and this allows aov, for example, to handle some simple multistratum models.  The algorithm used by lm does not allow this, but it has other advantages for simpler models.

If you want to fit a multistratum model, such as a repeated measures model, you need to use aov.

When it comes to finding the residuals, you have to be explicit about which residuals you mean, too.  You get residuals for each stratum in a multistratum model.  Using plain old resid() will not work as that function can only be used when there is only one kind of residuals vector defined.  (it could me made to do something sensible, but that's another issue.  Right now, it doesn't.)

The function proj() can be used on a fitted model object to obtain the projections, at each stratum, on to the subspaces defined by the terms in the model, and includes the residuals (the projection onto the orthogonal complement of the model space in R^n) as the final column of the matrix of projections.  These are easy to dig out and you can analyse away.

See ?proj for an example of its use, but you will need to dig out the appropriate column yourself.
#
Dear Bill,
many thanks for your answer. I got the point but still I would need an help
with a numeric example, as I haven?t fully understood how it works with R
(I had a look to proj() but I am not aware of how can be used correctly).

Could you please make an example?

For example, in attachment you find a .csv table resulting from an experiment, 
you can access it by means of this command:
The data are from an experiment where participants had to evaluate on a seven 
point likert scale
the realism of some stimuli, which are presented both in condition "A" and in 
condition "AH".

I need to perform the ANOVA by means of this command:
but the problem is that I cannot plot as usually do the qqnorm on the residuals 
of the fit because
lm does not support the Error term present in aov.
I normally check normality through a plot (or a shapiro.test function). Now 
could you please 

illustrate me how will you be able to undestand from my data if they are 
normally distributed?


Please enlighten me

Best regards
#
Bill.Venables wrote:
...Or lme in nlme / lmer in lme4.

Dieter
#
Dear Dieter,
thanks a lot for your answer. 
Don?t you mind to do an example of the use of the command?

For example, in attachment you find a .csv table resulting from an experiment, 
you can access it by means of this command:
The data are from an experiment where participants had to evaluate on a seven 
point likert scale
the realism of some stimuli, which are presented both in condition "A" and in 
condition "AH".

I need to perform the ANOVA by means of this command:
All the best