## Sunday, 5 January 2014

### Chi-squared Test for Independence

In this blog post I will discuss Pearson's Chi-squared test for independence, using an example.

Pearson's Chi-squared test for independence is applied to outcomes that are arranged in a tabular form and tests for independence between two factors. The rows correspond to the levels for one factor and the columns to the levels for the other factor. The Null Hypothesis is that the two factors are independent.

For example, we could have two rows corresponding to gender (Female and Male), and three columns corresponding to what products were purchased from a supermarket (Product A, Product B and Product C). The six entries would correspond to which gender bought which product. The Null Hypothesis is that the proportion of people who bought each of the three products is independent of their gender. For the Null Hypothesis to be valid, the proportion of females who bought Product A is equal to the proportion of males and females who bought Product A (out of the total population of males and females), the proportion of males who bought Product A is equal to the proportion of males and females who bought Product A (out of the total population of males and females), and so on. To elaborate on this further, we can represent the outcomes in the table below.

 Product A Product B Product C Female $a$ $b$ $c$ Male $d$ $e$ $f$

For the Null Hypothesis to hold, the proportion of females who purchased Product A would be equal to the proportion of both males and females who purchased Product A out of the total population:-

$\Large \frac{a}{a+b+c}=\frac{a+d}{a+b+c+d+e+f}$

Rearranging the above equation, we obtain the expected value of $a$ as

$\Large \hat{a}=\frac{(a+d)(a+b+c)}{a+b+c+d+e+f}$

and the proportion of males who purchased Product A would be equal to the proportion of both males and females who purchased Product A out of the total population:-

$\Large \frac{d}{d+e+f}=\frac{a+d}{a+b+c+d+e+f}$

Rearranging the above equation in a similar fashion, we obtain the expected value of $d$ as

$\Large \hat{d}=\frac{(a+d)(d+e+f)}{a+b+c+d+e+f}$

Going through all the entries, the expected value of each entry turns out to be the product of the entry's column sum and the entry's row sum divided by the total population.

Once all the expected values of the entries are computed, the sum of squares of the difference between the actual entry outcome and the expected value of that entry divided by the expected value of that entry is used to calculate the chi-squared test statistic. Mathematically, this can be represented as

$\Large \chi^2=\sum_{m=1}^{r}\sum_{n=1}^{c}\frac{(O(m,n)-E(m,n))^2}{E(m,n)}$

where $r$ is the number of rows, $c$ is the number of columns, $O(m,n)$ is the outcome in row $m$, column $n$ and $E(m,n)$ the corresponding expected value. The degree of freedom for this statistic is $(r-1)(c-1)$. Based on the chi-squared statistic and the degrees of freedom we can calculate the p-value, and if this value is less than a significance level of our choice (a commonly used value is 0.05) we reject the Null Hypothesis that the proportion of people who bought each of the three products is independent of their gender.

1. I can relate so much to what is written here, because I have been a student of psychology and I know about the Null Hypothesis very well. But anyways, I have got to face the tough situation right now and that is, Btec Level 3 Business Assignments. I do not have the time to do all these assignments because of my internship.

1. I am an intern at a company that works with business students. I have been assigned to write a report on the topic of the Btec assignment writing service. I have been working on this report for the past two weeks, and I am almost done with it. However, I am stuck at one part where I have to explain why the null hypothesis is used in statistics. I would appreciate if someone could help me out with this. Thank you!

2. You guys seriously solved all of my problems with my math assignment. The thing that remained was an essay from my English assignment. Even though I have looked on various websites for material, but no results. Then I thought, why not seek help from professional essay writers online? Both of you guys solved all of my problems with my assignments. I am really grateful to you and them.

3. Chi-squared method is really helpful for those who are facing difficulty in calculating standard deviation. Being associated with descriptive essay writing service us, I also prefer to use to this method in many assignments as it is not only easy to calculate but also have less number of algorithm steps.

4. Wow, it's so interesting, I've never seen such type of blog or writing, it seems that you're a very skilled and professional writer, I'm also an expert research writer but haven't seen this before, your information is quite informative, I'm also providing some writing techniques and the best guidance to choose the perfect and professional resume writing services to help out the needy people around the globe. Thanks for sharing such incredible article.

5. We are looking for a lot of data on this item. In the meantime, this is the perfect article I was looking for . Please post a lot about items related to 메이저놀이터추천 !!! I am waiting for your article. And when you are having difficulty writing articles, I think you can get a lot of help by visiting my .

6. Our company give you the best opportunity to get your website designed or developed build from their professional development and designing team. At Recycling Media we also provide services like SEO, Digital Marketing, Graphic Designing and App development. We have been working with many government organizations like TDAP, Ministry of Human Rights and also worked with many International clients as well . Feel free to get a quotation for your new business website.

7. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion.
From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work

Review my webpage - 오피사이트
(jk)

8. Do you need any help with a business management assignment? If yes then Ziyyara can help you with all kinds of online business assignments help at affordable charges.
Get Free Demo:- https://ziyyara.com/free-registration

9. I think this is an informative post and it is very beneficial and knowledgeable. 룰렛

new webpage or even a weblog from start

2YOUNGYANG

11. As the Internet develops further in the future, I think we need to collect materials that people might be interested in. Among the data to be collected, your 메가슬롯 will also be included.

12. I've been looking for photos and articles on this topic over the past few days due to a school assignment, 우리카지노 and I'm really happy to find a post with the material I was looking for! I bookmark and will come often! Thanks :D

13. This is the post I was looking for roulette I am very happy to finally read about the Thank you very much. Your post was of great help to me. If you are interested in the column I wrote, please visit my site .

14. I visited last Monday, and in the meantime, I came back in baccarat anticipation that there might be other articles related to I know there is no regret and leave a comment. Your related articles are very good, keep going!!

15. Love your thoughts share engaging content love the way you've been write the content

Take My course for me

16. Many thanks for starting this up. This website is something that is required on the web, someone with a bit of originality. 야한동영상

야설
야한동영상

17. Thank you for posting the very nice informative article. Looking forward to reading more articles from you. 일본야동

한국야동
일본야동

18. Very good article! We will be linking to this great content on our site. Keep up the good writing 한국야동닷컴

국산야동
한국야동닷컴

19. What an interesting story! I'm glad I finally found what I was looking for Excellent reading 국산야동

야설
국산야동

20. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much 중국야동넷