Displaying 1 result from an estimated 1 matches for "square_test".
2011 Sep 27
2
Pearson chi-square test
...;- cut(runif(100),c(0.0, 0.25, 0.40, 0.75, 1.00), labels=FALSE)
C <- cut(runif(100),c(0.0, 0.25, 0.50, 0.80, 1.00), labels=FALSE)
x <- table(A,B)
y <- table(A,C)
When I calculate the test statistic by hand I get a value of approximately
75.9:
http://en.wikipedia.org/wiki/Pearson's_chi-square_test#Calculating_the_test-statistic
sum((x-y)^2/y)
But when I do chisq.test(x,y) I get a value of 12.2 while chisq.test(y,x)
gives a value of 10.3.
I understand that I must be doing something wrong here, but I'm not sure
what.
Thanks,
Michael
[[alternative HTML version deleted]]