Class 20, Chi-Square Test of Independence (Introduction)

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

1

The Chi-Square Test of Independence:


Introduction (+ One Example)

The Chi-Square Test of Independence is a hypothesis-testing


procedure that allows us to determine whether or not two
categorical levels variables are associated in some way.

[Categorical level variables are the variables that have been


measured using the nominal and/or ordinal level of
measurement).]

Examples:
Nominal level of measurement

Variables Categories

Languages spoken: English, French, Bilingual, etc.

Employment status: Employed, Unemployed

Ordinal level variables

Variable Categories

Opinion: Disagree, Neutral, Agree, Strongly


Agree, etc.

Religious involvement: None, Very Low, Low, Moderate,


High, Very High.

***
2

Logic of Chi-square tests:

 Data is obtained from samples – we want to know


whether it represents the parameters of the parameters
of the population.

 We rely on contingency tables that allow for


comparisons of frequencies.

 The test allows us to determine whether or not the


pattern of association between variables is one that
significantly departs from chance

Figure 1: Critical region for Chi-square distribution: Results within the


red zone have a low enough probability of occurring by chance
-- represent a significant departure from what would be expected to
occur by chance. (sampling distribution = distribution of statistics)

The Chi-square distribution: (no average because of no intervals)


• The distribution has no negative values.
• It begins at “0” and is positively skewed.
• The skew decreases with more degrees of freedom
(df): As the degrees of freedom (df) increase, the
distribution approaches the shape of a normal distribution.
3

Doing the Chi-square test: An Application

(Note: We pronounce “Chi-square” with [kai], not [chee].)

Problem:
Table 1 is a contingency table built to test a relationship
between competency in official languages and employment
status.

We will test this relationship at the level of significance


α=0.01. At this level of significance, we are looking for
strong evidence to support the claim that the data in the
sample is not due to chance, i.e. that it represents the
population parameters.

(Reminder: It means that we are looking for whether the


sample results have 1% or less probability of being due to
chance)
Table 1. Employment status by language competency
(sample n=190)
Employment Competency in official languages
status Bilingual Unilingual Total
(fo)(fe) (fo)(fe)
Employed 65(…..) 35(…..) 100
Unemployed 43(…..) 47(…..) 90
Total 108 82 190
4

Legend:
 (fo) observed frequencies– data found in the
sample
 (fe) expected frequencies– the frequencies that we
would expect, if the pattern were due to chance.
(We need to calculate those...) (like the 50/50 heads and tails)

 The objective of the chi-square test of independence is


to see whether the distribution of observed frequencies
(fo) departs in a significant way from the expected
frequencies (fe).

Step 1. We establish the Null Hypothesis (H0) and the


Alternative Hypothesis (Ha).

Null Hypothesis H0: There is no significant association


between language competency and employment status: The
two variables are …... The observed frequencies in the table
are due to chance. e.g., language is not dependent on employment and vice versa

Alternative hypothesis Ha: There is a significant


associaton between language competency and employment
status (significant association: one that may exist in the
population) in the population. Bilingual people have a higher
frequency of being employed. Unilingual people have a lower
frequency of being employed.Bilingual people have a lower
rate of being unemplyed. Unilingual have a higher rate of
being unemployed.

(The sample results have a low probability of being due to


chance, i.e. they represent the pattern present in the
population).

Step 2. Obtaining the expected frequencies (fe) for each


cell in the table.
5

Formula: (used for each cell in the table)

fe = (RT)(CT)/n
Expected Frequency =(Row Total)•(Column Total)/n

 We apply the formula for each cell containing the (f o) in


the contingency table:

Table 1. Employment status by language competency of


graduates one year after graduation (sample n=190)
Employment Competency in official languages
status Bilingual Unilingual Total
(fo)(fe) (fo)(fe)
Employed 65(56.84) 35(…) 100
Unemployed 43(…) 47(…) 90
Total 108 82 190

fe = (RT)(CT)/n
Upper-left cell: fe=(100)(108)/190 = 56.84
Upper-right cell: fe = (100)(82)/190 = 43.16
Lower-left cell: fe =(90)(108)/190 = 51.16
Lower-right cell: fe =(90)(82)/190 = 38.84

Table 1-2. Observed and Expected Frequencies for:


Employment status by language competency of graduates
one year after graduation (sample n=190).
Employment Competency in official languages
status Bilingual Unlingual Total
(fo)(fe) (fo)(fe)
Employed 65 (56.84) 35(43.16) 100
Unemployed 43 (51.16) 47(38.84) 90
6

Total 108 82 190

Preliminary interpretation: We may eventually reject the


null hypothesis: There is a departure from chance. (black =
departure from chance, highlighted = probability)

There may be a relationship between language competency


and employment: Among the people who are employed,
more are bilingual than expected by chance and fewer are
unilingual than expected by chance.
Among those who are unemployed, fewer are bilingual than
expected by chance and more are unilingual than expected
by chance.

We still have to test the significance of this difference – to


see whether it is large enough to act as strong evidence to
reject the Null hypothesis.

Step 3. Applying the formula for the Chi-Square test.

The Formula for the chi-square test of independence


reflects the total summation of the differences between
the observed frequencies (fo) and the expected
frequences(fe):

In other words:
7

(The larger the difference between the observed ( fo) and


expected values (fe), the larger will be the the calculated
value of chi-square.)

Table 1-2. Observed and Expected Frequencies for:


Employment status by language competency of graduates
one year after graduation (sample n=190).
Employment Competency in official languages
status Bilingual Unlingual Total
(fo)(fe) (fo)(fe)
Employed 65 (56.84) 35(43.16) 100
Unemployed 43 (51.16) 47(38.84) 90
Total 108 82 190

x² =(65-56.84)²/56.84 + (35-43.16)²/43.16 +
(43-51.16)²/51.16 + (47-38.84)²/38.84

Order of operations:

(fo-fe) 8.158 upper left cell


-8.158 upper right cell
-8.158 lower left cell
8.158 lower right cell

(fo-fe)² 66.5512 upper left


66.5512 upper right
66.5512 lower left
66.5512 lower right

(fo-fe)²/fe 1.17081 (upper left c)


1.54204 (upper r. c.)
1.30090 (lower l. c.)
8

1.71338 (lower r. c.)


Σ = 5.72713

x²obt = Σ[(fo-fe)²/fe]= 5.727

x²obt = 5.727 the obtained value of chi-square

Step 4. Interpretation of the chi-square test results:


we compare the obtained value of chi-square (x²obt) with
the critical value (X²cv).

A critical value (X²cv) is a point on the baseline of a


sampling distribution that marks the beginning of the critical
region – the region that contains values that allow us to
reject the null hypothesis.

Interpretation Chi-square tests: Two options


1. If the calculated test statistic (X²obt) meets or exceeds
the critical value (X²obt ≥ X²cv), it means that it falls
within the critical region – we can reject the null

hypothesis (Ho). At α=0.01, we have strong evidence


to reject it and to support the alternative hypothesis
(Ha).

2. If the calculated test statistic (X²obt) does not meet the


critical value (X²obt < X²cv), it falls short of the critical
region – we fail to reject. the null hypothesis. Our
sample results have not departed from chance
significantly enough. (critical vvakueschugher the
9

Figure 2: Critical region for Chi-Square distribution at


α=0.01

Note: At α=0.01 ,the red zone represents 1% of the


sampling distribution: Results here have only …1% or less
probability of occurring by chance – represent a significant
departure from what would be expected to occur by chance.

Step 4-1. Obtaining the critical value for Chi-Square


(X²) at α=0.01. Critical value (cv) depends on the level of
signifcance (α) and the number of degrees of freedom (df).

We use the Table of Critical Values for Chi-Square (X²).

Degrees LEVEL OF SIGNIFICANCE


of Freedom (Probability of exceeding the critical value)
10

(df) 0.10 0.05 0.025 0.01 0.001

1 2.706 3.841 5.024 6.635 10.828


2 4.605 5.991 7.378 9.210 13.816
3 6.251 7.815 9.348 11.345 16.266
4 7.779 9.488 11.143 13.277 18.467
5 9.236 11.070 12.833 15.086 20.515
6 10.645 12.592 14.449 16.812 22.458
7 12.017 14.067 16.013 18.475 24.322
8 13.362 15.507 17.535 20.090 26.125
9 14.684 16.919 19.023 21.666 27.877
10 15.987 18.307 20.483 23.209 29.588

1. We decided upon the level of significance α =0.01

2. We calculate the degrees of freedom (df) based on


the number of cells containing the observed
frequencies (fo) in the contingency table (Ignore the
totals!

df = (r – 1) • (c – 1) r = number of rows
c = number of columns

Given: r = 2, c = 2,
df = (2 –1) • (2 –1)

df = 1
3. Given the df= 1 and α=0.01, the X²cv =6.

Step 4-2. Comparison of the calculated test statistic


with the critical value:

Our calculated test statistic: X²obt = 5.727


11

Our critical value: X²cv = 6.635

5.727 ‹ 6.635
X²obt ‹ X²cv

Figure 3: The critical region for Chi-square distribution at


α=0.01 begins at X²cv = 6.635 (in this study).

X²obt =5.727 X²cv = 6.635

Our X²obt=5.727 does not meet the critical value: It does


not enter the region of rejection (critical region).

Final Conclusion: We do not have evidence strong enough


that the null hypothesis is false. We fail to reject the null
hypothesis. The sample in question does not provide us with
strong evidence for the relationship between language
competency and employment status (in the population).
12

Specifically, there is no strong evidence that the sample


results are not due to chance (They have more than 1%
probability of being due to chance.)

The sample results do not provide with a strong evidence


that they are representative of the population.

Final qualification:
We keep in mind that there is still a probability that we
failed to reject the Null hypothesis when in fact the Null
Hypothesis is false. In other words, there is a probability
that we may have committed the Type II error

(Reminder:
The Null hypothesis is false when the sample results are not
due to a sampling error – not due to chance. In that case, it
should be rejected.)

***
Looking for moderate evidence:
Testing at α=0.05

If at the level of significance α=0.05, we still find that


X²obt < X²cv, then we will have to fail to reject the Null
Hypothesis: At α=0.05 we will not have the moderate
evidence to reject the Null (Ho) and accept the alternative
(Ha).

If at the level of significance α=0.05, we find that


X²obt ≥ X²cv, then we will moderate evidence to reject the
null hypothesis (Ho) and to accept the alternative
hypothesis (Ha).

(Our sample results would only have 5% or less probability


of being due to chance.)
13

Whether we reject the null or fail to reject it may ultimately


depend on the level of significance α.

Testing at α=0.05

Since we already have the X²obt, we move on to obtain the


X²cv: We Repeat the Steps 4-1 on:

Step 4-1:
We use the Table of Critical Values for Chi-Square (X²),
looking for the critical value at α=0.05.
Degrees LEVEL OF SIGNIFICANCE
of Freedom (Probability of exceeding the critical value)

(df) 0.10 0.05 0.025 0.01 0.001

1 2.706 3.841 5.024 6.635 10.828


2 4.605 5.991 7.378 9.210 13.816
3 6.251 7.815 9.348 11.345 16.266
4 7.779 9.488 11.143 13.277 18.467
5 9.236 11.070 12.833 15.086 20.515

1. We decided upon the level of significance α =0.05.

2. We calculate the degrees of freedom (df) based on


the number of cells containing the observed frequencies
(fo) in the contingency table (Ignore the totals!

df = (r – 1) • (c – 1) r = number of rows;
c = number of columns

Given: r = 2, c = 2,
df = (2 –1) • (2 –1)

df = 1
14

3. Given the df=1 and α= 0.05, the X²cv = 3.841

Step 4-2. Comparison of the calculated test statistic


and the critical value:

Our calculated test statistic: X²obt =5.727


Our critical value: X²cv = 3.841

5.727 > 3.841


X²obt > X²cv

Figure 4: Critical region for Chi-square distribution at


α=0.05 begins with X²cv = 3.841 (in this study).

X²cv = 3.841 X²obt =5.727

Note: At α=0.05, the red represents 5% of the sampling


distribution: Results here have only 5% or less probability of
occurring by chance – represent a significant departure from
what would be expected to occur by chance.

Final answer (must be fully stated):

Step 5. Conclusion: Our calculated test statistic exceeds


the critical value (X²obt > X²cv). Therefore, we reject the null
hypothesis and accept the alternative hypothesis.
15

At α = 0.05, we have moderate evidence to reject the Null


hypothesis and to accept the alternative hypothesis.

We accept.: There is a significant association between


language competency and employment:

Statement of the departure from chance:

Among the people who are employed, more are bilingual


than expected by chance and fewer are unilingual than
expected by chance.

Among those who are unemployed, fewer are bilingual than


expected by chance and fewer are unilingual than expected
by chance.

The departure from chance is “statistically significant” our


sample results have 5% or less probability of being due to
chance.)

We have moderate evidence that the sample results are


representative of the population.

Table 1-3. ……. (sample n=190).


Employment Competency in official languages
status Bilingual Unilingual Total
(fo)(fe) (fo)(fe)
Employed 65 (56.84) 35(43.16) 100
Unemployed 43 (51.16) 47(38.84) 90
Total 108 82 190
X²obt =5.73

Step 6: Final qualification: We assume that we have


significant results, keeping in mind that there is still 5% or
less probability that we may have committed the Type II
16

error. Assuming that the Null hypothesis was false, we


rejected it, when, in fact, the Null Hypothesis (Ho) is true.

In other words, there is still 5% or less probability that the


sample results are due to chance.

(Reminder: When the Ho is true, it should not be


rejected.)

***

Summary of the options in all hypothesis testing:


Comparison of the calculated test statistic and the
critical value; the conclusions and qualifications that
follow

x² =x²
obt cv : The calculated test statistic meets the
critical value.
Conclusion: We reject Ho and accept Ha.
Qualifications: probability of Type I
Error.

x² >x²
obt cv : The calculated test statistic exceeds the
critical value.
Conclusion: We reject Ho and accepts
Ha. Qualifications: probability of Type I
Error.
17

x² <x²
obt cv : The calculated test statistic does not
meet the critical value. (have not significantly departed
from chance enough)

Conclusion: We fail to reject Ho and


cannot accept Ha.
Qualifications: probability of Type II
Error.

You might also like