[R] repeated measure one way anova
JohnLi
jli136 at site.uottawa.ca
Tue Oct 28 20:56:03 CET 2008
Thanks a lot ! I learn a lot about R while I solve my problem according to
those provided informatin.
John
> Dieter Menne wrote:
>> JohnLi <jli136 <at> site.uottawa.ca> writes:
>>> I am a new comer for Statistics R. I am using R for one way repeated
>>> measure anova, for example, on the following data consisting of three
>>> groups.
>>>
>>>
>>> c2 c3 c4
>>> 85.83 75.86 84.19
>>> 85.91 73.18 85.9
>>
>> -- Arrange your data in the "long form". Do it by hand, or use function
>> pack, or
>> reshape, or package reshape.
>>
>> (Assuming these are times. If these are categorical variables, better
>> use
>> strings as column descriptors)
>>
>>
>>
>> subj time conc (do not use t or c as variable name, these are
>> "well-known functions" in R)
>> A 2 85.83
>> A 3 75.86
>> A 4 84.19
>> B 2 85.91
>> ....
>>
>> Use package nlme, function lme. It might be a bit of an overkill for the
>> simple
>> case, but always worth the effort when things get more complex
>>
>> libary(nlme)
>> summary(lme(c~time, random=~1|subj,data=mydata)
>
> There is also anova.mlm:
>
> d <- read.table("clipboard", header=T)
> Y <- as.matrix(d)
> fit1 <- lm(Y~1)
> fit0 <- lm(Y~0)
> anova(fit0, fit1, X=~1, test="Spherical")
> anova(fit0, fit1, X=~1, test="Wilks")
>
> --
> O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
> c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
>
> ______________________________________________
> R-help at r-project.org 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