[R] How to obtain intercept statistics in anova withwithin-subject factors?
Greg Snow
Greg.Snow at intermountainmail.org
Wed Sep 5 18:02:36 CEST 2007
Sorry, I did not think about the nested design (did not read carefully enough). Another thing to try (untested) is to create a column of 1's and include that specifically and exclude the default intercept, then your column of 1's acts as the intercept, but a p-value is returned from it.
Note that sometimes the other terms may change their definition without an intercept. I had success at one time (quite a while ago, so things could have changed) with specifying the formula as:O
Y ~ 1 + x1 + x2 + x3 -1
Which caused it to include the intercept, use that info when setting the dummy vars for x1-x3, then removed the intercept.
Again this is all untested, just an idea to try.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Sid Kouider
> Sent: Friday, August 31, 2007 3:19 PM
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] How to obtain intercept statistics in anova
> withwithin-subject factors?
>
> 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
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list