Calculating Chi-squared using R gives me different results vs what the book shows or what I get from Online calculator.
The data and the way it is arranged in the table seem correct, but the answer I get is different.
We use R in our exams, and I am not sure why I am getting a different answer.
x=matrix(c(18,5,33,42), nrow=2, ncol=2)
x
chisq.test(x,correct=T)
x=matrix(c(18,5,33,42), nrow=2, ncol=2)
x
[,1] [,2]
[1,] 18 33
[2,] 5 42
chisq.test(x,correct=T)
Pearson's Chi-squared test with Yates' continuity correction
data: x
X-squared = 6.9625, df = 1, p-value = 0.008323
The correct answer is: X-squared= 8.2784, p-value=0.00412 (the book and online calculator have the same answer)