0% found this document useful (0 votes)
30 views

Week 5 Chi Square Test

Uploaded by

Radzmia Kalnain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Week 5 Chi Square Test

Uploaded by

Radzmia Kalnain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

Chi- square Test as a Statistical Tool

Chi-Square as a Statistical Test


Chi-square test: an inferential statistics technique
designed to test for significant relationships between
two variables organized in a bivariate table.

Chi-square requires no assumptions about the shape


of the population distribution from which a sample is
drawn.
Chi-Square as a Statistical Test
Chi-square test: an inferential statistics technique
designed to test for significant relationships between
two variables organized in a bivariate table.

Chi-square requires no assumptions about the shape


of the population distribution from which a sample is
drawn.
The Chi Square Test

◦ A statistical method used to determine goodness


of fit
◦ Goodness of fit refers to how close the observed data
are to those predicted from a hypothesis

◦ 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

The chi-square test does not give us much information


about the strength of the relationship or its substantive
significance in the population.

The chi-square test is sensitive to sample size. The size


of the calculated chi-square is directly proportional to
the size of the sample, independent of the strength of
the relationship between the variables.

The chi-square test is also sensitive to small expected


frequencies in one or more of the cells in the table.
Statistical Independence
Independence (statistical): the absence of
association between two cross-tabulated variables.
The percentage distributions of the dependent
variable within each category of the independent
variable are identical.
Hypothesis Testing with Chi-Square
Chi-square follows five steps:
1. Making assumptions (random sampling)

2. Stating the research and null hypotheses

3. Selecting the sampling distribution and specifying the


test statistic

4. Computing the test statistic

5. Making a decision and interpreting the results


The Assumptions

The chi-square test requires no assumptions


about the shape of the population distribution
from which the sample was drawn.

However, like all inferential techniques it assumes


random sampling.
Stating Research and Null Hypotheses

The research hypothesis (H1) proposes that the


two variables are related in the population.

The null hypothesis (H0) states that no association


exists between the two cross-tabulated variables in
the population, and therefore the variables are
statistically independent.
H : The two variables are related in the population.
1

Gender and fear of walking alone at night are


statistically dependent.

Afraid Men Women Total


No 83.3% 57.2% 71.1%
Yes 16.7% 42.8% 28.9%
Total 100% 100% 100%
H : There is no association between the two variables.
0

Gender and fear of walking alone at night are statistically


independent.

Afraid Men Women Total


No 71.1% 71.1% 71.1%
Yes 28.9% 28.9% 28.9%
Total 100% 100% 100%
The Concept of Expected Frequencies
Expected frequencies fe : the cell frequencies that
would be expected in a bivariate table if the two
tables were statistically independent.

Observed frequencies fo: the cell frequencies actually


observed in a bivariate table.
Calculating Expected Frequencies

fe = (column marginal)(row marginal)


N
To obtain the expected frequencies for any cell in any cross-
tabulation in which the two variables are assumed
independent, multiply the row and column totals for that cell
and divide the product by the total number of cases in the
table.
Chi-Square (obtained)
The test statistic that summarizes the
differences between the observed (fo) and the
expected (fe) frequencies in a bivariate table.
Calculating the Obtained Chi-Square

( fe  fo ) 2
 
2

fe
fe = expected frequencies
fo = observed frequencies
The Sampling Distribution of Chi-Square

The sampling distribution of chi-square tells the probability of


getting values of chi-square, assuming no relationship exists in
the population.

The chi-square sampling distributions depend on the degrees


of freedom.


The  sampling distribution is not one distribution, but is a
family of distributions.
The Sampling Distribution of Chi-Square

The distributions are positively skewed. The research


hypothesis for the chi-square is always a one-tailed
test.

Chi-square values are always positive. The minimum


possible value is zero, with no upper limit to its
maximum value.

As the number of degrees of freedom increases, the


 distribution becomes more symmetrical.
Determining the Degrees of Freedom
df = (r – 1)(c – 1)

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;)

The general formula is

(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

• Gene affecting wing shape • Gene affecting body color


– c+ = Normal wing – e+ = Normal (gray)
– c = Curved wing – e = ebony
• Note:
– The wild-type allele is designated with a + sign
– Recessive mutant alleles are designated with lowercase
letters

• 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

• Applying the chi square test


– Step 1: Propose a null hypothesis (Ho) that allows us to
calculate the expected values based on Mendel’s laws
• The two traits are independently assorting
– Step 2: Calculate the expected values of the four
phenotypes, based on the hypothesis
• According to our hypothesis, there should be a
9:3:3:1 ratio on the F2 generation
Phenotype Expected Expected Observed number
probability number
straight wings, 9/16 9/16 X 352 = 198 193
gray bodies
straight wings, 3/16 3/16 X 352 = 66 64
ebony bodies
curved wings, 3/16 3/16 X 352 = 66 62
gray bodies
curved wings, 1/16 1/16 X 352 = 22 24
ebony bodies
– Step 3: Apply the chi square formula

(O1 – E1)2 (O2 – E2)2 (O3 – E3)2 (O4 – E4)2


  + + +
E1 E2 E3 E4

(193 – 198)2 (69 – 66)2 (64 – 66)2 (26 – 22)2


 

198
+
66
+
66
+
22

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

– Low chi square values indicate a high probability that the


observed deviations could be due to random chance alone
– High chi square values indicate a low probability that the
observed deviations are due to random chance alone

– If the chi square value results in a probability that is less


than 0.05 (ie: less than 5%) it is considered statistically
significant
• The hypothesis is rejected
• Step 4: Interpret the chi square value

– Before we can use the chi square table, we have to


determine the degrees of freedom (df)
• The df is a measure of the number of categories that are
independent of each other
• If you know the 3 of the 4 categories you can deduce the
4th (total number of progeny – categories 1-3)
• df = n – 1
– where n = total number of categories
• In our experiment, there are four phenotypes/categories
– Therefore, df = 4 – 1 = 3
– Refer to Table 2.1
1.06
• Step 4: Interpret the chi square value

– With df = 3, the chi square value of 1.06 is slightly greater


than 1.005 (which corresponds to P-value = 0.80)

– P-value = 0.80 means that Chi-square values equal to or


greater than 1.005 are expected to occur 80% of the time
due to random chance alone; that is, when the null
hypothesis is true.

– Therefore, it is quite probable that the deviations between


the observed and expected values in this experiment can be
explained by random sampling error and the null hypothesis
is not rejected. What was the null hypothesis?
CHI- SQUARE THROUGH SPSS
Chi - Square
Test of null hypothesis when there are 1 or 2 independent variables.

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

H1 : Degree is 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

Rule # 3: If sig ˃ 0.05 Accept HO

* if αlpha is not mentioned = 0.05

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

Nominal by Nominal Phi 0. 183 .413


Cramer’s V
0.183 .413

N of valid cases 20

Therefore: Ho is accepted

• Degree has nothing to do with cholesterol.


• Age has nothing to do with cholesterol.
47
Analyze
Process of Computing Chi-
Descriptive Square through SPSS
Statistics

Crosstabs

Statistics

Phi &
Cramer’s V
Cells
Observed
Expected

Continue
Ok

48

You might also like