Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the...
Transcript of Hypothesis Testing: The Chi-Square Statistic · 7 steps of Hypothesis Testing 1. State the...
HYPOTHESIS TESTING:
THE CHI-SQUARE
STATISTIC
1
7 steps of Hypothesis Testing
1. State the hypotheses
2. Identify level of significant
3. Identify the critical values
4. Calculate test statistics
5. Compare critical values with test statistics
6. Conclusion
7. Conclusion in words
Parametric and Nonparametric Tests
• Two non-parametric hypothesis tests using the chi-
square statistic:
• the chi-square test for goodness of fit
• the chi-square test for independence
3
Parametric and Nonparametric Tests
(cont.) • The term "non-parametric" refers to the fact that
the chi-square tests do not require assumptions
about population parameters nor do they test
hypotheses about population parameters.
• For chi-square, the data are frequencies rather
than numerical scores.
4
The Chi-Square Test for Goodness-of-Fit
• The chi-square test for goodness-of-fit uses frequency
data from a sample to test hypotheses about the shape or
proportions of a population.
• Each individual in the sample is classified into one
category on the scale of measurement.
• The data, called observed frequencies, simply count
how many individuals from the sample are in each
category.
5
The Chi-Square Test for Goodness-of-Fit
(cont.) • The null hypothesis specifies the proportion of the
population that should be in each category.
• The proportions from the null hypothesis are used to
compute expected frequencies that describe how the
sample would appear if it were in perfect agreement with
the null hypothesis.
6
Example 1
Test the hypothesis that eye colors spread evenly for each type at 1% level
of significant
Step 1 State Hypothesis
• H0: The eyes color spread evenly for each type
• H1: The eyes color not spread evenly for each type
Step 2 & 3 : Level of significant and
Critical Values Step 2
Alpha = 0.01
Step 3
df = n – 1
Df = 4-1=3
𝜒2 = 4.541
Step 4:Calculate the Test Statistic
Formula to find 𝜒2 test statistics
Since, total of observation is equal to 40 with 4 category.
𝑓𝑒 =40
4= 10
e
oe
f
ff 22 )(
Step 4:Calculate the Test Statistic
• A computational table helps organize the
computations.
fo fe fo - fe (fo - fe)2 (fo - fe)
2 /fe
12 10
21 10
3 10
4 10
40 40
Step 4:Calculate the Test Statistic
• Subtract each fe from each fo. The total of this
column must be zero.
fo fe fo - fe (fo - fe)2 (fo - fe)
2 /fe
12 10 2
21 10 11
3 10 -7
4 10 -6
40 40 0
Step 4:Calculate the Test Statistic
• Square each of these values
fo fe fo - fe (fo - fe)2 (fo - fe)
2 /fe
12 10 2 4
21 10 11 121
3 10 -7 49
4 10 -6 36
40 40 0
Step 4:Calculate the Test Statistic
• Divide each of the squared values by the fe for that cell. The
sum of this column is chi square
fo fe fo - fe (fo - fe)2 (fo - fe)
2 /fe
12 10 2 4 0.4
21 10 11 121 12.1
3 10 -7 49 4.9
4 10 -6 36 3.6
40 40 0 χ2 = 21
Step 5 & 6: Compare and Conclude
• Reject H0 ,when test statistics value > critical value
• Fail to Reject H0 ,when test statistics value < critical value
Critical value
Step 5 & 6: Compare and Conclude
• χ2 (critical value) = 4.541
• χ2 (test statistics) = 21
• The test statistic is in the Critical Region. Reject the H0.
• There is enough evidence to conclude that the eyes color
are differ for each types.
The Chi-Square Test for Independence
• Can be used and interpreted in two different ways:
1. Testing hypotheses about the relationship between two variables in a population, or
2. Testing hypotheses about differences between proportions for two or more populations.
17
The Chi-Square Test for Independence
(cont.)
Testing hypotheses about the relationship between two
variables in a population
The null hypothesis :
There is no relationship between the two variables; that is,
the two variables are independent.
18
The Chi-Square Test for Independence
(cont.)
Testing hypotheses about differences between proportions
for two or more populations
The null hypothesis:
The proportions (the distribution across categories) are the
same for all of the populations
19
The Chi-Square Test for Independence (cont.)
• The data (observed frequencies), show how many
individuals are in each cell of the matrix.
• Both chi-square tests use the same test statistic.
The relationship of homicide rate and gun sales
Low homicide
High homicide
Totals
Low gun sales
8 5 13
High gun sales
4 8 12
Totals 12 13 25
Tables
Notice the following about these tables
1. Table must have a title
2. Independent variable must go into columns
3. Subtotals are called marginals.
4. N is reported at the intersection of row and
column marginals.
Tables
Title
Rows Column 1 Column 2
Row 1 cell a cell b Row Marginal 1
Row 2 cell c cell d Row Marginal 2
Column Marginal 1
Column Marginal 2
N
Example 2
Test association the homicide rate and volume of gun sales related
for a sample of 25 cities, with 5% level of significant?
Low High
High 8 5 13
Low 4 8 12
12 13 25
Step 1 State Hypothesis
• H0: The variables are independent
Another way to state the H0: There is no
relationship between the two variables
•H1: The variables are dependent
Another way to state the H1: There is a
relationship between the two variables
Step 2 & 3 : Level of significant and
Critical Values Step 2
Alpha = 0.05
Step 3
df = (r – 1)(c – 1) where
r = the number of rows
c = the number of columns
Df = (2-1)(2-1)=1
𝜒2 = 3.841
Step 4:Calculate the Test Statistic
Formula to find 𝜒2 test statistics
e
oe
f
ff 2
2 )(
Step 4:Calculate the Test Statistic
fe = (column marginal)(row marginal)
N
•
Step 4:Calculate the Test Statistic
• Expected frequencies:
Low High
High 6.24 6.76 13
Low 5.76 6.24 12
12 13 25
Step 4:Calculate the Test Statistic
• A computational table helps organize the
computations.
fo fe fo - fe (fo - fe)2 (fo - fe)
2 /fe
8 6.24
5 6.76
4 5.76
8 6.24
25 25
Step 4:Calculate the Test Statistic
• Subtract each fe from each fo. The total of this
column must be zero.
fo fe fo - fe (fo - fe)2 (fo - fe)
2 /fe
8 6.24 1.76
5 6.76 -1.76
4 5.76 -1.76
8 6.24 1.76
25 25 0
Step 4:Calculate the Test Statistic
• Square each of these values
fo fe fo - fe (fo - fe)2 (fo - fe)
2 /fe
8 6.24 1.76 3.10
5 6.76 -1.76 3.10
4 5.76 -1.76 3.10
8 6.24 1.76 3.10
25 25 0
Step 4:Calculate the Test Statistic
• Divide each of the squared values by the fe for that cell. The
sum of this column is chi square
fo fe fo - fe (fo - fe)2 (fo - fe)
2 /fe
8 6.24 1.76 3.10 .50
5 6.76 -1.76 3.10 .46
4 5.76 -1.76 3.10 .54
8 6.24 1.76 3.10 .50
25 25 0 χ2 = 2.00
Step 5 & 6: Compare and Conclude
• Reject H0 ,when test statistics value > critical value
• Fail to Reject H0 ,when test statistics value < critical value
Critical value
Step 5 & 6: Compare and Conclude
• χ2 (critical value) = 3.841
• χ2 (test statistics) = 2.00
• The test statistic is not in the Critical Region. Fail to reject
the H0.
• There is no significant relationship between homicide rate
and gun sales.