# Chi square test

This test aims to verify whether the observed absolute frequency of a variable is significantly different from the expected absolute frequency distribution.

## Chi square test for a sample

Applies when one wants to study the dependency between two variables, through a double entry table or also known as a contingency table.

### Conditions for test execution

Exclusively for nominal and ordinal variables;

Independent observations;

Not applicable if 20% of observations are less than 5

There can be frequencies below 1;

In the latter two cases, if there are such incidences, it is advisable to group the data according to a specific criterion.

### Procedure for Test Execution

1. Determine H0. It will be the negative of the existence of differences between the observed and the expected frequency distribution;

2. Establish the significance level (µ);

3. Determine the rejection region of H0. Determine the value of degrees of freedom (φ), where K - 1 (K = number of categories). Find, therefore, the value of the tabulated Chi-square;

4. Calculate Chi Square using the formula: Since the calculated Chi Square, higher than the tabulated, rejects H0 in favor of H1.

### Example

One salesman worked marketing a product in seven residential neighborhoods in the same city at the same time of year.

Their manager decided to see if the salesperson's performance fluctuated because of the working neighborhood, ie whether the differences were significant in the working neighborhoods.

From this study the manager could then work out a business strategy for each neighborhood or keep one for everyone.

 Neighborhood 1 2 3 4 5 Total Observed Values 9 11 25 20 15 80 Expected Values 16 16 16 16 16 80

H0: No Significant Differences Between Neighborhoods

H1: The differences observed for neighborhoods 3 and 4 are significantly different for the better than other neighborhoods.

µ = 0,05

g.l = 5 - 1 = 4, where tabulated chi square is 9.49.

Χ2 = (9-16)2 + (11 - 16) 2 + (25-16) 2 + (20 - 16) 2 + (15 - 16) 2/16

Χ2 = 72 + 52 +92 + 42 + 12= 172/16 = 10,75

It is concluded that the calculated Chi square (10.75) is higher than the tabulated (9.49), rejects H0 in favor of H1.

Therefore, there is a significant difference, at the 0.05 level, for neighborhoods 3 and 4. Based on the calculation, the manager must develop a commercial strategy for each neighborhood.

Next: Chi-Square Test for Two Samples