Roger Xu
2015-Sep-04 21:18 UTC
[R] Manova: Data similarly generated are significantly different.
Dear R users, Hi. I don't know if my understanding of Manova test is correct. So I test with the following code and got strange results. Any help would be appreciated. y0, y1, and y2 are independently generated by the same method. They are each split into 20 groups by the same method. The summary of the Manova test (stored in variable s) says: The Pr (>F) value is less than 2.2e-16. y0 <- runif(100, 0, 1) y1 <- runif(100, 0, 1) y2 <- runif(100, 0, 1) y0 <- c(y0, runif(100, 0, 10) ) y1 <- c(y1, runif(100, 0, 10) ) y2 <- c(y2, runif(100, 0, 10) ) y0=as.numeric(unlist(y0)) y1=as.numeric(unlist(y1)) y2=as.numeric(unlist(y2)) b=10 a=length(y0)/b g=rep(1:a,rep(b,a)) m1 <- manova(cbind(y0, y1, y2) ~ g) s=summary(m1, test = "Wilks") a = s$stats a = a[11] s a The summary is here: Df Wilks approx F num Df den Df Pr(>F) g 1 0.37069 110.91 3 196 < 2.2e-16 *** Residuals 198 --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 [[alternative HTML version deleted]]
Duncan Murdoch
2015-Sep-05 00:04 UTC
[R] Manova: Data similarly generated are significantly different.
On 04/09/2015 5:18 PM, Roger Xu wrote:> y0 <- runif(100, 0, 1) > y1 <- runif(100, 0, 1) > y2 <- runif(100, 0, 1) > > y0 <- c(y0, runif(100, 0, 10) ) > y1 <- c(y1, runif(100, 0, 10) ) > y2 <- c(y2, runif(100, 0, 10) ) > > y0=as.numeric(unlist(y0)) > y1=as.numeric(unlist(y1)) > y2=as.numeric(unlist(y2)) > > b=10 > a=length(y0)/b > g=rep(1:a,rep(b,a)) > > m1 <- manova(cbind(y0, y1, y2) ~ g) > s=summary(m1, test = "Wilks") > > a = s$stats > a = a[11] > s > aIf you plot any of the y columns vs g you see a huge effect. You aren't testing whether the y's are equal, you are testing whether the triplets depend on g, and they do. Duncan Murdoch