1 HYPOTHESIS TESTING: THE CHI-SQUARE STATISTIC
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
3 Parametric and Nonparametric Tests Two non-parametric hypothesis tests using the chisquare statistic: the chi-square test for goodness of fit the chi-square test for independence
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
5 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.
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 H 0 : The eyes color spread evenly for each type H 1 : 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 ( f e f ) 2 o f e 2 Since, total of observation is equal to 40 with 4 category. f e = 40 4 = 10
Step 4:Calculate the Test Statistic A computational table helps organize the computations. f o f e f o - f e (f o - f e ) 2 (f o - f e ) 2 /f e 12 10 21 10 3 10 4 10 40 40
Step 4:Calculate the Test Statistic Subtract each f e from each f o. The total of this column must be zero. f o f e f o - f e (f o - f e ) 2 (f o - f e ) 2 /f e 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 f o f e f o - f e (f o - f e ) 2 (f o - f e ) 2 /f e 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 f e for that cell. The sum of this column is chi square f o f e f o - f e (f o - f e ) 2 (f o - f e ) 2 /f e 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 Critical value Reject H 0,when test statistics value > critical value Fail to Reject H 0,when test statistics 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 H 0. There is enough evidence to conclude that the eyes color are differ for each types.
17 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.
The Chi-Square Test for Independence (cont.) 18 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.
The Chi-Square Test for Independence (cont.) Testing hypotheses about differences between proportions for two or more populations 19 The null hypothesis: The proportions (the distribution across categories) are the same for all of the populations
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 High gun sales 8 5 13 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 H 0 : The variables are independent Another way to state the H 0 : There is no relationship between the two variables H 1 : The variables are dependent Another way to state the H 1 : There is a relationship between the two variables
Step 2 & 3 : Level of significant and Critical Values Step 2 Alpha = 0.05 Step 3 where df = (r 1)(c 1) 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 ( f e f ) 2 o f e 2
Step 4:Calculate the Test Statistic f e = (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. f o f e f o - f e (f o - f e ) 2 (f o - f e ) 2 /f e 8 6.24 5 6.76 4 5.76 8 6.24 25 25
Step 4:Calculate the Test Statistic Subtract each f e from each f o. The total of this column must be zero. f o f e f o - f e (f o - f e ) 2 (f o - f e ) 2 /f e 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 f o f e f o - f e (f o - f e ) 2 (f o - f e ) 2 /f e 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 f e for that cell. The sum of this column is chi square f o f e f o - f e (f o - f e ) 2 (f o - f e ) 2 /f e 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 Critical value Reject H 0,when test statistics value > critical value Fail to Reject H 0,when test statistics 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 H 0. There is no significant relationship between homicide rate and gun sales.