# [R] How to obtain intercept statistics in anova with within-subject factors?

Sid Kouider sid.kouider at free.fr
Thu Aug 30 16:53:57 CEST 2007

```Dear R users,
I am looking for an easy (i.e., direct) way of obtaining the F and p values
from the intercept in anovas with within-subject designs.
My data are from a psychophysics experiment where I am using d' (d-prime)
values obtained from 3 modalities of presentation in each subject. I would
like to know not only whether there is an effect of modality, but also
whether the main effect is significant (meaning that d' > 0).
I know that a t.test again the null mean would provide me with similar stats
on the main effect, but I would like to get those stats in an F form, for
consistency with the stats on the other factors of interest.

As far as I understand how R works, the function "anova" provides you with
such information but it is restricted to between-group analyses. For
within-subject designs, one has to use "summary(aov)" but stats on the
intercept are not included in the result of this function. I have pasted an
example below. As one can see, only the Sum of Sq and Mean Sq are given for
the main effect.

Thank you for any advice you can provide,
-Sid

summary(aov(x~mod+Error(suj/(mod)), data=dp))

Error: suj          Df  Sum Sq Mean Sq F value Pr(>F)
Residuals 10 19.5977  1.9598
Error: suj:mod
Df  Sum Sq Mean Sq F value  Pr(>F)  mod
2  8.2475  4.1237  4.2955 0.02806 *
Residuals 20 19.2005  0.9600
---Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Error:
Within
Df Sum Sq Mean Sq F value Pr(>F)Residuals 33 55.812   1.691

```