Data Analytics Corp. wrote: > Hi, > > I have a dataset from a client where the data is from a cross-over > design. Basically, each subject in a survey was asked to rate two > products, A and B. The subject sampled A first and then after an > appropriate wash-out period he/she sampled B. The next subject did the > same, but in a different order. How can I do an ANOVA analysis on a > cross-over design with only two treatments. This is also a balanced design > > Thanks, > > Walt >
The hard bit is often to knock data into the right format. Assuming that you have a data in a data frame "mydata" in long format like this ID product period score 1 A 1 2,3 1 B 2 3.4 .... 10 B 1 5.6 10 A 2 7.8 then this should do the trick: summary(aov(score~A*B+Error(ID),data=mydata)) Alternatively, you can do it with t-tests comparing differences within ID between the two product orderings. The test for main effect of product can be obtained as a test of whether "1st - 2nd" depends on whether A or B came first, and vice-versa for the main effect of period. The interaction test (carry-over, etc.) is obtained as a test of whether the _sum_ of the two scores is order-dependent. (Cynics may point out that it is usually no great loss just to do a paired t-test, since period effects are usually weak and interactions mostly undetectable in such designs.) -- 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.dalga...@biostat.ku.dk) FAX: (+45) 35327907 ______________________________________________ R-help@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.