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

Sid Kouider sid.kouider at free.fr
Fri Aug 31 23:19:12 CEST 2007


Dear Greg,
Thanks very much for you advice. 
Unfortunately, although summary.lm applied on aov objects indeed shows the
intercept's statistics, this function does not (seem to) work with
within-participant designs. As soon as I enter the info on the error term
(see the example in my first message), then summary.lm(aov_object) crashes
("Error in if (p == 0) { : argument is of length zero").
-Sid



> Subject: RE: [R] (no subject)
> Date: Thu, 30 Aug 2007 13:43:19 -0600
> From: Greg.Snow at intermountainmail.org
> To: sisid at hotmail.com; r-help at stat.math.ethz.ch
>
> Try calling summary.lm on your object (if it is an aov object then summary
calls summary.aov which does not show the intercept, but calling summary.lm
directly does give info on the intercept).
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow at intermountainmail.org
> (801) 408-8111


> -----Message d'origine-----
> De : Sid Kouider [mailto:sid.kouider at free.fr]
> Envoyé : jeudi 30 août 2007 16:54
> À : 'r-help at lists.R-project.org'
> Objet : How to obtain intercept statistics in anova with within-subject
> factors?
> 
> 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
>



More information about the R-help mailing list