I'm trying to do a $\chi^2$ test of independence between two variables. The problem I have is that I'm struggling with the sample size for the test. I always end up with some cells that have 0 samples.
I have the data on the entire population available, but I can't use it for hypothesis testing so I've been trying with various sizes with and without replacement. Also, the population is quite small - only 162.
With smaller sample sizes the chisq()
function in R kept coming up with error messages that the estimation may be incorrect.
> chisq = chisq.test(tbl)
Warning message:
In chisq.test(tbl) : Chi-squared approximation may be incorrect
Now I've gone up to a sample size of 100% of population with replacement. The error has disappeared, but I'm concerned since:
a) I still have 0 samples in some cells:
var2_high var2_low var2_medium var2_very_high
var1_high 12 0 10 3
var1_low 10 20 9 1
var1_medium 5 23 19 0
var1_very_high 9 0 0 41
And b) I'm not sure if such sample size is acceptable.
Can anyone help me with these questions?