I have a question regarding the below output offrom a chi square-squares test, which I find to be confusing and contrary to my expected results - my chi square-squared value is infinity here :)
I expected it to show a strong relation between smoke and workoutideal (I was expecting chi square to be 0), but a weak relation between smoke and workoutmixed (I was expecting any integer value for chi square here). However, what I observe is the exact opposite. Please see my output below:
> mydata
= data.frame(smoke workoutideal workoutmixed
1 no yes no
2 yes no = noc('no','yes','no','no','yes')
3 no yes workoutideal = yesc('yes','no','yes','yes','no')
4 no yes workoutmixed = c('no','no','yes','yes','yes') yes)
5 yes no yes
> table(smoke, workoutideal)
workoutideal
smoke no yes
no 0 3
yes 2 0
> table(smoke, workoutmixed)
workoutmixed
smoke no yes
no 1 2
yes 1 1
> chisq.test(smoke,workoutideal)
Pearson's Chi-squared test with Yates' continuity correction
data: smoke and workoutideal
X-squared = 1.7014, df = 1, p-value = 0.1921
Warning message:
In chisq.test(smoke, workoutideal) :
Chi-squared approximation may be incorrect
>
chisq.test(smoke, workoutmixed)
Pearson's Chi-squared test with Yates' continuity correction
data: smoke and workoutmixed
X-squared = 0, df = 1, p-value = 1
Warning message:
In chisq.test(smoke, workoutmixed) :
Chi-squared approximation may be incorrect
Thanks.
PS : If you would like to recreate data to perform the test here it is,
smoke = c('no','yes','no','no','yes')
workoutideal = c('yes','no','yes','yes','no')
workoutmixed = c('no','no','yes','yes','yes')