I have the following set of observed versus expected values:
> chisq.test(matrix(c(35,11,44209,44233), nrow=2))
[,1] [,2]
[1,] 35 44209
[2,] 11 44233
Where [1,1] = expected yes, [1,2] = expected no, [2,1] = observed yes, [2,2] observed no.
When I run this, I get...
Pearson's Chi-squared test with Yates' continuity correction
data: matrix(c(35, 11, 44209, 44233), nrow = 2)
X-squared = 11.506, df = 1, p-value = 0.0006937
So, the $\chi^2 =11.506$.
However, when I hash it out by hand, I get
> (11-35)^2/35 + (44233-44209)^2/(44209)
[1] 16.47017
...which is considerably larger. What is the cause of this difference? Is this the Yates continuity correction in action? Am I entering the data incorrectly somehow? I see the function definition is overloaded in that it does both contingency table tests /and/ goodness-of-fit tests, but this looked like the right syntax for contingency function?