[R] Q about how to use Anova.mlm
jfox at mcmaster.ca
Fri Jan 30 03:42:56 CET 2009
I noticed a typo in my response and some poor formatting in the email
message; please see below:
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> Behalf Of John Fox
> Sent: January-29-09 9:23 PM
> To: 'pgseye'
> Cc: r-help at r-project.org
> Subject: Re: [R] Q about how to use Anova.mlm
> Dear Paul,
> First, to fit a multivariate linear model to your data, you'll have to
> rearrange the data from "long" format (with one observation per replicate)
> to "wide" format (with one observation per subject). If your data are in
> data frame Data, then you'd do something like:
> Wide <- reshape(Data, v.names="Angle", idvar="Subject",
> Then, with the data in wide format, fit a multivariate linear model with
> just a constant:
> mod <- lm(cbind(Angle.1, Angle.2, Angle.3, Angle.4, Angle.5, Angle.6) ~ 1,
The data argument should be data=Wide (I adapted the code from an example I
already had and neglected to change the argument).
> Finally, use Anova() to get the tests:
> idata <- data.frame(Replicate=c("Angle.1", "Angle.2", "Angle.3",
> "Angle.5", "Angle.6"))
> summary(Anova(mod, idata=idata, idesign=~Replicate))
Note that this is indeed two separate commands; they were apparently run
together by my mailer.
> If I understand correctly what you want, this should give it to you.
> As well, since your design has no between-subject factors and only a
> within-subject factor, you could also use anova() [i.e., anova.mlm()] to
> the same results.
> I hope this helps,
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> web: socserv.mcmaster.ca/jfox
> > -----Original Message-----
> > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> > Behalf Of pgseye
> > Sent: January-29-09 7:40 PM
> > To: r-help at r-project.org
> > Subject: [R] Q about how to use Anova.mlm
> > Hi,
> > Am newish to stats and R, so I certainly appreciate any help. Basically
> > have 50 inidividuals whom I have 6 photos each of their optic nerve
> > want to check that the orientation of the nerve head is consistent, ie
> > replicates show minimal or preferably no rotation differences. I'll draw
> > arbitrary line between some blood vessels (same reference in each set of
> > replicates) and determine an angle of deviation from the vertical and
> > angle will be my dependent variable.
> > Subject Replicate Angle of Deviation
> > 1 1 x
> > 1 2 x
> > 1 3 x
> > 1 4 x
> > 1 5 x
> > 1 6 x
> > 2 1 x
> > 2 2 x
> > 2 3 x
> > 2 4 x
> > 2 5 x
> > 2 6 x
> > etc
> > I'm wanting to test for Sphericity (because I've read that you should -
> > this routine in a repeated measures ANOVA?) and can see that Anova.mlm
> > the CAR package offers this in addition to the alternative Greenhouse
> > Feldt tests.
> > I just don't really know how to perform the test - can someone give me
> > help.
> > Thank you.
> > Paul
> > Dept of Ophthalmology
> > Uni Melbourne, Australia
> > --
> > View this message in context: http://www.nabble.com/Q-about-how-to-use-
> > Anova.mlm-tp21739443p21739443.html
> > Sent from the R help mailing list archive at Nabble.com.
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > and provide commented, minimal, self-contained, reproducible code.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help