Week 5 Chi Square Test
Week 5 Chi Square Test
◦ Note:
◦ The chi square test does not prove that a hypothesis
is correct
◦ It evaluates to what extent the data and the hypothesis have a good fit
Limitations of the Chi-Square Test
( fe fo ) 2
2
fe
fe = expected frequencies
fo = observed frequencies
The Sampling Distribution of Chi-Square
The sampling distribution is not one distribution, but is a
family of distributions.
The Sampling Distribution of Chi-Square
where
r = the number of rows
c = the number of columns
Calculating Degrees of Freedom
How many degrees of freedom would a table with 3 rows and 2 columns
have?
(3 – 1)(2 – 1) = 2
2 degrees of freedom
The Chi Square Test
(we will cover this in lab;)
(O – E)2
S
E
• where
– O = observed data in each category
– E = observed data in each category based on the
experimenter’s hypothesis
S = Sum of the calculations for each category
Consider the following example in Drosophila melanogaster
• The Cross:
– A cross is made between two true-breeding flies (c+c+e+e+
and ccee). The flies of the F1 generation are then allowed
to mate with each other to produce an F2 generation.
• The outcome
– F1 generation
• All offspring have straight wings and gray bodies
– F2 generation
• 193 straight wings, gray bodies
• 69 straight wings, ebony bodies
• 64 curved wings, gray bodies
• 26 curved wings, ebony bodies
• 352 total flies
Expected Observed
0.13 + 0.14 + 0.06 + 0.73 number number
198 193
1.06 66 64
66 62
22 24
• Step 4: Interpret the chi square value
– The calculated chi square value can be used to obtain
probabilities, or P values, from a chi square table
• These probabilities allow us to determine the likelihood that the
observed deviations are due to random chance alone
Independent Variables:
Degree – Teaching (1),
Non- teaching (0)
Age – 20 or above years old (1),
below 20 (0)
Dependent Variable:
Cholesterol – (3) High
(2) Moderate
(1) Low
Hypothesis:
H0 : Degree is not associated with age in relation to
a person’s cholesterol
32
n Degree Age Choleste n Degree Age Choleste
rol rol
1 0 1 3 11 0 1 2
2 1 1 2 12 1 1 1
3 1 1 1 13 1 1 3
4 1 1 1 14 0 1 3
5 0 1 1 15 1 1 1
6 0 1 2 16 1 1 1
7 1 1 2 17 1 1 2
8 1 0 3 18 0 1 2
9 0 0 3 19 1 1 1
10 0 0 1 20 0 1 1
33
Required:
A. Frequency Table
B. Null hypothesis
C. Test the null hypothesis
D. Conclusion
34
FREQUENCY TABLE
Degree 20 or above years old Below 20 years old Total
Cholesterol 3 2 1 3 2 1
Teaching (1) 1 3 6 1 0 0 11
Non- 2 3 2 1 0 1 9
teaching (0)
Total 3 6 8 2 0 1 20
35
NULL HYPOTHESIS
Decision True False
Reject Type I Error No Error
Accept No Error Type II Error
36
Test H0 :
Rule # 1 : If sig ˂ 0.05
Rule # 2: If sig = 0.05
Reject HO
37
How to Input Data on SPSS?
Open SPSS
(File, New, Data)
• Degree
Type Variable • Age
• Cholesterol
• Enter
Click Data View data
38
File
New
Data
39
Click
Variable
View
Enter Variables:
Degree
Age
Cholesterol
40
Click Data
View
Enter
Data
41
Click
Analyze
Descriptive
Statistics
Crosstabs
42
Drag
DEGREE
to rows
AGE to
columns
43
Click
Statistics
Check Phi
and
Cramer’s V
44
Check Cells
Check
Observe
Check
Expected
Continue
Ok
45
Result
46
Result
Symmetric Measures
Value Approx. Sig
N of valid cases 20
Therefore: Ho is accepted
Crosstabs
Statistics
Phi &
Cramer’s V
Cells
Observed
Expected
Continue
Ok
48