blog/chi-square-test-of-independence-by-hand/ #83
Replies: 8 comments 5 replies
-
Comment written by Kuo Yao Hung on January 29, 2020 03:47:04: A really nice article, thanks. |
Beta Was this translation helpful? Give feedback.
-
Comment written by Antoine Soetewey on January 29, 2020 08:58:47: Glad you liked it Kuo! |
Beta Was this translation helpful? Give feedback.
-
Dear Antonie. My confusion is if the probability of such a difference is unlikely then there should be no relation between the two variable. Thanks again. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your question. You're right; if the test statistic is above the critical value (determined by the Chi-square table), it means that the probability of observing such a difference between the observed and expected frequencies is unlikely BY RANDOM CHANCE. However, remember that the null and alternative hypothesis of the Chi-square test of independence are:
This means that: if the test statistic is above the critical value --> we reject the null hypothesis of independence because the probability of observing such a large difference between the expected and observed frequencies just by chance is small (i.e., the p-value is small) --> the 2 variables are dependent --> there is a significant relationship between the 2 variables. Hope this helps. Let me know if it is still unclear. Regards, |
Beta Was this translation helpful? Give feedback.
-
I must say thak you so much for the clarity and response.
Wishing a very happy new year.
Best Regards,
Manoj
|
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the clear explanation of the mechanics and intuition of a chi square test of independence. I have repeated your exercise in R and post a related question about how to calculate the chi square distribution afterwards:
Instead of the table of critical values, I will plot the actual chi square distribution
My question is how to build such a chi square null distribution in which you constrast the observed value versus the critical one by hand (well, using R), it would be great exactly how this was made in the time when there were no computers. Is it that you calculate all chi square possible values (or do thousand of simulations) for one degree of freedom to find such an idealized distribution? This is, considering your sample size, n = 28, do we need to calculate the chi square for all possible combinations for each of the 4 possible cells? 28 0 0 0 calculate Chi Square 1 Then, we plot all these chi square values in a histogram (or in a density density plot) and then “invent” an idealized distribution of chi squares resulting. My problem is with that "invent" as well, how is this done exactly? I would appreciate very much a step-by-step explanation in R, but I cannot find it anywhere, and it seems to me that this would complete our understanding of the pilars of inferential testing. Thanks a lot in advance! |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the reply!! Perhaps I am not understanding it correctly, but isn't the realization that the chi-square distribution fits the sum of k squared normal distributions came a posteriori? I mean, after looking at the distribution patterns of thousands of chi-square simulated calculations for diferent degrees of freedom, mathemathicians idealized the chi square distribution and, by doing so (or afterwards), they realized that the underlying distribution was the normal distribution squared. Is it possible to know how was it done the first time? I personally feel that without knowing the steps taken from the chi square simulations to the idealized distribution my understanding of how the statistical test works is not complete. |
Beta Was this translation helpful? Give feedback.
-
Hi, can I ask you what techno is used for your blog ? |
Beta Was this translation helpful? Give feedback.
-
Chi-square test of independence by hand - Stats and R
Test if two categorical variables are dependent via the Chi-square test of independence. See also how to compute it by hand and how to interpret the results
https://statsandr.com/blog/chi-square-test-of-independence-by-hand/
Beta Was this translation helpful? Give feedback.
All reactions