Chi-Square Test – Contingency Table

By- Ramandeep Kaur Virk
LinkedIn

 

Here, we are going to use this test to determine, if anybody’s gender really have effect on product’s sale inside a Grocery Store.

So, what we did, from the grocery store bill, I observed the number of males and females who bought Shampoo, oil and other products.

OBSERVED TABLE:

Gender Shampoo Oil Other Products Total
Male 25 10 5 40
Female 35 18 12 60
Total 55 28 17 100

 

Now, we would make Expected values table by applying formula:

E(Male,Shampoo)= (Total Male * Total Shampoo)/ Grand Total

E(Female,Shampoo)= (Total Female * Total Shampoo)/ Grand Total

And replacing oil and other products in the subsequent totals expected values and we come up with

EXPECTED TABLE:

Gender Shampoo Oil Other Products Total
Male 22 11.2 6.8 40
Female 33 16.8 10.2 60
Total 55 28 17 100

 

Following steps are required to perform the Hypothesis Testing:

 

1. State Null Hypothesis (H0) and Alternative Hypothesis(H1).

2. Choose level of Significance i.e. (α)

3. Find the Critical Values from Table

4. Find Test Statistics

5. Draw your conclusion

 

Step 1: State Null Hypothesis (H0) and Alternative Hypothesis(H1).

Null Hypothesis (H0): It is always that you currently believe to be true.

You have to believe that rows are independent upon columns or say Gender is completely independent from the kind of product you buy.

So, this is our Null Hypothesis (H0): Products are independent from Gender.

Now, Alternative Hypothesis(H1) is always the opposite of Null Hypothesis (H0).

In another words, our Alternative Hypothesis(H1): Products are dependent on Gender.

 

Step 2: Choose level of Significance i.e. (α)

We will pick a level of Significance i.e. (α)= 0.05, This value is in the area of tail of below figure (a Chi square distribution):

This area of the tail is called Rejection Region.
This region allow us to make decisions in the end of our test.

We would perform the test and we would then get a value. If that value happens to fall in Rejection Region, then we will reject our Null Hypothesis (H0) which states “Products are independent from Gender” and accept the Alternative Hypothesis(H1) which states “Products are dependent on Gender

.

 

Step 3: Find the Critical Values from Table

Critical Value is the point which separates the tail from the curve. This critical value would be a chi square value as we are performing a chi square test here. For that we need a Chi Square Table.

Now area in tail would help us to find Critical Value. For the Chi Square Table, two things we should know:

1. Level of Significance i.e. (α)

2. Degrees of freedom(d.f.): For contingency table it is (rows-1) multiplied by (columns-1)

For our test, (α)=0.05 and Degrees of freedom(d.f.)=(2-1)*(3-1)=2

The value which coming out is 5.99 upon that (α) and (d.f.)

 

Step 4: Find Test Statistics (χ2):

The formula to calculate Chi-square statistics(χ2) is Σ(Observed value – expected value)^2 / expected value.

χ2 = ((25-22)^2/22) + ((10-11.2)^2/11.2) + ((5-6.8)^2/6.8)  + ((35-33)^2/33) + ((18-16.8)^2/16.8) + ((12 – 10.2)^2/10.2)

= 0.40+ 0.128+ 0.476 + 0.0606 + 0.466 + 0.474

= 2.0046 ~ 2

So our test statistics is 2, which we now need it to draw a conclusion to our problem.

Here, our test statistics (2.00) is certainly less than Critical Value (5.99) which is on the left of the Critical Value and does not fall in the Rejection Region shown below:

 

Step 5.  Draw your conclusion:

The above steps show that we cannot reject the Null Hypothesis (H0), hence we need to accept that Products are independent from Gender. So, the gender do not have any influence on product preferences.

Leave a Reply

avatar
  Subscribe  
Notify of