Data set up as one observation/subject looks like (with a total of 10 subjects) Two treatments: shoe type with 3 categories and region with 8 categories ==> 24 "treatment" columns
Subject PHallux PMidToes PLatToe PMTH1 PMidMTH PLatMTH PMidfoot PRearfoot LHallux LMidToes LLatToe LMTH1 LMidMTH LLatMTH LMidfoot LRearfoot DHallux DMidToes DLatToe DMTH1 DMidMTH DLatMTH DMidfoot DRearfoot 1 203.230 169.970 75.090 208.420 168.860 129.150 104.840 209.960 200.005 88.880 30.820 315.535 105.445 72.265 88.195 211.280 198.970 113.525 65.640 237.175 148.790 86.105 69.830 222.230 R Code: library(car) pressure=read.csv("Shoe_data.csv",header=TRUE,sep=",") datin.model=cbind(pressure[,2],pressure[,3],pressure[,4],pressure[,5],pressure[,6],pressure[,7],pressure[,8],pressure[,9],pressure[,10],pressure[,11],pressure[,12],pressure[,13], pressure[,14],pressure[,15],pressure[,16],pressure[,17],pressure[,18],pressure[,19],pressure[,20],pressure[,21],pressure[,22],pressure[,23],pressure[,24],pressure[,25]) multmodel=lm(datin.model ~ 1) Shoe <- factor(c(rep("P",8),rep("L",8),rep("D",8))) Region <-factor(rep(c("Hallux","MidToes","LatToe","MTH1","MidMTH","LatMTH","MidFoot","Rearfoot"),3)) fact.idata <- data.frame(Shoe,Region) pressure.aov = Anova(multmodel, idata=fact.idata, idesign = ~Shoe + Region, type="III") > summary(pressure.aov,multivariate=F) Univariate Type III Repeated-Measures ANOVA Assuming Sphericity SS num Df Error SS den Df F Pr(>F) (Intercept) 6275173 1 192361 9 293.5961 3.535e-08 *** Shoe 2340 2 11839 18 1.7786 0.1973 Region 748644 7 299408 63 22.5037 6.181e-15 *** --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Mauchly Tests for Sphericity Test statistic p-value Shoe 0.72437 0.275329 Region 0.00032 0.006714 Greenhouse-Geisser and Huynh-Feldt Corrections for Departure from Sphericity GG eps Pr(>F[GG]) Shoe 0.78393 0.2065 Region 0.37482 8.391e-07 *** --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 HF eps Pr(>F[HF]) Shoe 0.92023 0.2008 Region 0.54302 5.227e-09 *** --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Everything runs fine, except that Anova will not allow idesign = ~Shoe*Region So to look for interaction I set up a long format data set with columns Subject, Pressure, Shoe, Region--df now has 240 rows Then I ran: pressure.alt.df=read.csv("ShoeDataAltFormat.csv",header=TRUE,sep=",") pressure.aovalt=aov(Pressure~(Shoe*Region)+Error(Subject/(Shoe*Region)),data=pressure.alt.df) > summary(pressure.aovalt) Error: Subject Df Sum Sq Mean Sq F value Pr(>F) Residuals 1 2346.6 2346.6 Error: Subject:Shoe Df Sum Sq Mean Sq Shoe 2 3248 1624.0 Error: Subject:Region Df Sum Sq Mean Sq Region 7 606772 86682 Error: Subject:Shoe:Region Df Sum Sq Mean Sq Shoe:Region 14 34345 2453.2 Error: Within Df Sum Sq Mean Sq F value Pr(>F) Shoe 2 35 17.5 0.0063 0.9937 Region 7 152734 21819.2 7.8272 2.469e-08 *** Shoe:Region 14 15479 1105.6 0.3966 0.9747 Residuals 192 535219 2787.6 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 QUESTIONS: 1) Why does the Anova function not allow Shoe*Region? 2) Does the use of aov provide a correct test for Shoe:Region Interaction? 3) The main effect for Shoe from Anova has a denominator df=18; shouldn't that correspond to one of the error terms from aov? 4) Is the Anova p-value of 0.1973 for the main effect of Shoe the correct test Any help trying to understand exactly what is happening in Anova versus aov is greatly appreciated. Looking at interaction plots, there does not appear to be a lot going on except for two regions with relatively (compared to other regions) different means for at least one Shoe type within the Region. Thank you, Tamre [[alternative HTML version deleted]]
______________________________________________ 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.