Chi-Squared Tests. Semester 1. Chi-Squared Tests

Similar documents
Chapter 10. Chapter 10. Multinomial Experiments and. Multinomial Experiments and Contingency Tables. Contingency Tables.

11-2 Multinomial Experiment

Chi-square (χ 2 ) Tests

15: CHI SQUARED TESTS

We know from STAT.1030 that the relevant test statistic for equality of proportions is:

Chi-square (χ 2 ) Tests

Introduction to Statistical Data Analysis Lecture 7: The Chi-Square Distribution

10.2: The Chi Square Test for Goodness of Fit

:the actual population proportion are equal to the hypothesized sample proportions 2. H a

12.10 (STUDENT CD-ROM TOPIC) CHI-SQUARE GOODNESS- OF-FIT TESTS

Lecture 41 Sections Mon, Apr 7, 2008

Statistics for Managers Using Microsoft Excel

Chi-Square. Heibatollah Baghi, and Mastee Badii

The goodness-of-fit test Having discussed how to make comparisons between two proportions, we now consider comparisons of multiple proportions.

HYPOTHESIS TESTING: THE CHI-SQUARE STATISTIC

Example. χ 2 = Continued on the next page. All cells

STAT Chapter 13: Categorical Data. Recall we have studied binomial data, in which each trial falls into one of 2 categories (success/failure).

Chapter 12: Inference about One Population

Hypothesis Tests and Estimation for Population Variances. Copyright 2014 Pearson Education, Inc.

Chapte The McGraw-Hill Companies, Inc. All rights reserved.

11 CHI-SQUARED Introduction. Objectives. How random are your numbers? After studying this chapter you should

Module 10: Analysis of Categorical Data Statistics (OA3102)

Chapter 10: Chi-Square and F Distributions

Chi Square Analysis M&M Statistics. Name Period Date

Parametric versus Nonparametric Statistics-when to use them and which is more powerful? Dr Mahmoud Alhussami

ij i j m ij n ij m ij n i j Suppose we denote the row variable by X and the column variable by Y ; We can then re-write the above expression as

SL - Binomial Questions

13.1 Categorical Data and the Multinomial Experiment

Ling 289 Contingency Table Statistics

Sampling, Confidence Interval and Hypothesis Testing

Department of Economics. Business Statistics. Chapter 12 Chi-square test of independence & Analysis of Variance ECON 509. Dr.

Chapter 26: Comparing Counts (Chi Square)

THE ROYAL STATISTICAL SOCIETY HIGHER CERTIFICATE

Topic 21 Goodness of Fit

Previous Exam Questions, Chapter 2

Chapter 8 Student Lecture Notes 8-1. Department of Economics. Business Statistics. Chapter 12 Chi-square test of independence & Analysis of Variance

The Purpose of Hypothesis Testing

Hypothesis Testing. ) the hypothesis that suggests no change from previous experience

Contingency Tables. Contingency tables are used when we want to looking at two (or more) factors. Each factor might have two more or levels.

10: Crosstabs & Independent Proportions

Inferential statistics

MATH/STAT 3360, Probability

There are statistical tests that compare prediction of a model with reality and measures how significant the difference.

The Multinomial Model

Random Variables Example:

POLI 443 Applied Political Research

CS 1538: Introduction to Simulation Homework 1

Institute of Actuaries of India

Basic Business Statistics, 10/e

Exam 2 (KEY) July 20, 2009

PhysicsAndMathsTutor.com

Test 2 VERSION B STAT 3090 Spring 2017

10.4 Hypothesis Testing: Two Independent Samples Proportion

MTH U481 : SPRING 2009: PRACTICE PROBLEMS FOR FINAL

Marketing Research Session 10 Hypothesis Testing with Simple Random samples (Chapter 12)

Hypothesis for Means and Proportions

Inference for Categorical Data. Chi-Square Tests for Goodness of Fit and Independence

Chapter 11. Hypothesis Testing (II)

Hypothesis Testing: Chi-Square Test 1

S2 QUESTIONS TAKEN FROM JANUARY 2006, JANUARY 2007, JANUARY 2008, JANUARY 2009

Section VII. Chi-square test for comparing proportions and frequencies. F test for means

Section 9.5. Testing the Difference Between Two Variances. Bluman, Chapter 9 1

Analysis of Call Center Data

Problem Points S C O R E Total: 120

Summary of Chapters 7-9

This is a multiple choice and short answer practice exam. It does not count towards your grade. You may use the tables in your book.

Lecture 14: Introduction to Poisson Regression

Modelling counts. Lecture 14: Introduction to Poisson Regression. Overview

Chapter 5: HYPOTHESIS TESTING

Lecture 28 Chi-Square Analysis

Discrete distribution. Fitting probability models to frequency data. Hypotheses for! 2 test. ! 2 Goodness-of-fit test

Joseph O. Marker Marker Actuarial a Services, LLC and University of Michigan CLRS 2010 Meeting. J. Marker, LSMWP, CLRS 1

Ch 13 & 14 - Regression Analysis

CHAPTER 10 HYPOTHESIS TESTING WITH TWO SAMPLES

1 Binomial Probability [15 points]

Review of One-way Tables and SAS

Chapter Seven: Multi-Sample Methods 1/52

Exam details. Final Review Session. Things to Review

Relate Attributes and Counts

(x t. x t +1. TIME SERIES (Chapter 8 of Wilks)

Teaching S1/S2 statistics using graphing technology

Dover- Sherborn High School Mathematics Curriculum Probability and Statistics

Math 152. Rumbos Fall Solutions to Exam #2

Classroom Activity 7 Math 113 Name : 10 pts Intro to Applied Stats

Lecture 9. Selected material from: Ch. 12 The analysis of categorical data and goodness of fit tests

Section 6.2 Hypothesis Testing

Tables Table A Table B Table C Table D Table E 675

Sociology 6Z03 Review II

Fundamental Statistical Concepts and Methods Needed in a Test-and-Evaluator s Toolkit. Air Academy Associates

Non-parametric Hypothesis Testing

Ch. 11 Inference for Distributions of Categorical Data

JUST THE MATHS UNIT NUMBER PROBABILITY 7 (The Poisson distribution) A.J.Hobson

Discrete Multivariate Statistics

2 and F Distributions. Barrow, Statistics for Economics, Accounting and Business Studies, 4 th edition Pearson Education Limited 2006

One- and Two-Sample Tests of Hypotheses

their contents. If the sample mean is 15.2 oz. and the sample standard deviation is 0.50 oz., find the 95% confidence interval of the true mean.

CHAPTER 17 CHI-SQUARE AND OTHER NONPARAMETRIC TESTS FROM: PAGANO, R. R. (2007)

Lecture 22. December 19, Department of Biostatistics Johns Hopkins Bloomberg School of Public Health Johns Hopkins University.

Chapters 10. Hypothesis Testing

This is particularly true if you see long tails in your data. What are you testing? That the two distributions are the same!

Transcription:

Semester 1

Goodness of Fit Up to now, we have tested hypotheses concerning the values of population parameters such as the population mean or proportion. We have not considered testing hypotheses about the form of a population s distribution. We next consider the problem of determining whether or not a population follows a particular distribution.

Goodness of Fit For example, we may be interested in determining whether the number of emails arriving per minute at a server follows a Poisson distribution or not. Similarly, we may wish to test if the lengths of components from an automated process follow a normal distribution. Another similar question is whether a 6-sided die is fair or not.

Goodness of Fit The general procedure for testing hypotheses on the distribution of a population is as follows. (i) The null hypothesis H 0 is that some distribution describes the population. (ii) We choose a sample of size n from the population. This might involve recording the results of n rolls of the die or recording the number of mails arriving in n minute-long intervals. (iii) The observations in our sample are grouped into k bins or classes and we record the number of observations that fall into each bin or the frequency of each bin. O i represents the number of observations or observed frequency for the i th bin. (iv) Under the null hypothesis, we can calculate the expected frequency E i for each bin.

Goodness of Fit (v) The test statistic we use is χ 2 0 = k i=1 (E i O i ) 2 E i. If the null hypothesis is true, then χ 2 0 has approximately a chi-squared distribution with k p 1 degrees of freedom. Here p is the number of parameters of the distribution that we have to estimate with our sample data. (vi) We reject H 0 at the significance level α if the value of χ 2 0 calculated with our sample data exceeds the critical value χ 2 k p 1,α which we obtain from a table of chi-square critical values.

Goodness of Fit For example: For testing the fairness of a die, we would use 6 bins for the numbers 1 to 6 and O i would count the number of times the number i came up in the n rolls. For the email server example, the bins might represent 0 emails, 1 email, 2 emails, 3 emails and 4 emails. In this case, we would have 5 bins in total, and O 1 would count the number of minutes in which we received 0 emails, O 2 the number of minutes in which we received 1 email, O 3 the number of minutes in which we received 2 emails and so on.

Goodness of Fit If the 6-sided die is fair, then the expected frequency is E i = n 6 for each bin. If the number of emails arriving at the server per minute follows a Poisson distribution with mean λ, the expected number of minutes in which no emails arrive would be e λ n. The expected number of minutes in which 1 email arrives would be e λ λ 1 n 1! and so on.

Goodness of Fit The key point is that we can compute expected frequencies based on the null hypothesis and then compare the expected frequencies with the actual frequencies observed in a sample. When the deviation between the expected frequencies and the observed frequencies is too large we reject the null hypothesis concerning the population. To determine when the difference between observed and expected frequencies is too large, we use a special distribution known as the chi-squared distribution.

Poisson Goodness of Fit Example The number of emails arriving at a server per minute is claimed to follow a Poisson distribution. To test this claim, the number of emails arriving in 70 randomly chosen 1-minute intervals is recorded. The table below summarises the results. Number of emails 0 1 2 3 4 Frequency 13 22 23 12 0 Test the hypothesis that the number of emails per minute follows a Poisson distribution? Use a significance level of α = 0.05.

Poisson Goodness of Fit To calculate the expected frequencies, we need the Poisson parameter λ. This is simply the mean number of emails per minute. We need to estimate this from the sample data: λ = 13(0) + 22(1) + 23(2) + 12(3) 70 = 1.49. Our Null Hypothesis is H 0 : Number of emails per minute has a Poisson Distribution with λ = 1.49. H 1 : Number of emails per minute does not have a a Poisson Distribution with λ = 1.49. Significance Level: α = 0.05. Test Statistic: We treat the last two bins as one (as no minutes contained 4 or more calls) so the number of bins is k = 4. 4 χ 2 (E i O i ) 2 0 =. E i i=1

Poisson Goodness of Fit We reject H 0 if our sample data gives a value of χ 2 0 > χ2 2,0.05 = 5.99. We have lost two degrees of freedom because we have to estimate the parameter λ from sample data. To do the calculation, we require: Number of emails Observed Freq. Expected Freq. 0 13 15.78 1 22 23.51 2 23 17.5 3 12 13.2

Poisson Goodness of Fit The actual value of χ 2 0 is then: (15.78 13) 2 15.78 which is equal to 2.417. (23.51 22)2 (17.51 23)2 (13.2 12)2 + + + 23.51 17.51 13.2 We cannot reject the null hypothesis at the 5% level of significance.

Binomial Goodness of Fit It is also possible to perform a goodness of fit test for distributions other than the Poisson distribution. The approach is essentially the same - all that changes is the distribution used to calculate the expected frequencies. We next consider an example based on the Binomial distribution.

Binomial Goodness of Fit Example Bits are sent over a communications channel in packets of 8. In order to characterise the performance of this channel, 80 packets are sent over the channel and the number of corrupted bits in each packet is recorded. The results of this experiment are recorded below. Number of Corrupt Bits 0 1 2 3 4 Number of Packets 35 31 10 4 0 Test the hypothesis that the number of corrupted bits in a packet sent over this channel follows a binomial distribution. Use a significance level of α = 0.025

Binomial Goodness of Fit To calculate the expected frequencies, we need the binomial parameter p. We need to estimate this from the sample data. Out of the 640 bits sent over the channel, 63 were corrupt. So our estimate of p is 63 640 = 0.098

Binomial Goodness of Fit H 0 : Population is binomial with p = 0.098. H 1 : Population is not binomial. Significance Level: α = 0.025. Test Statistic: We treat the last two bins as one (as no packets contain 4 or more corrupt bits) so the number of bins is k = 4. 4 χ 2 (E i O i ) 2 0 =. E i i=1 We reject H 0 if our sample data gives a value of χ 2 0 > χ2 2,0.025 = 7.378. We have lost two degrees of freedom because we have to estimate the parameter p from sample data.

Binomial Goodness of Fit To do the calculation, we require: Number of Corrupt Bits Observed Freq. Expected Freq. 0 35 35.04 1 31 30.48 2 10 11.6 3 4 2.88 The actual value of χ 2 0 is then: (35.04 35) 2 + 35.04 (30.48 31)2 + 30.48 (11.6 10)2 (2.88 4)2 + 11.6 2.88 We cannot reject the null hypothesis at the 1% level of significance. = 0.665.

Normal Goodness of Fit The final example of goodness of fit that we shall consider is for the Normal distribution. For this case, the situation is a little more complicated as the distribution is continuous. This means that we need to be more careful in selecting the bins. In practice, it is usual to choose bins so that the expected frequency for each bin is the same. We shall see how to do this in an example below.

Normal Goodness of Fit Example A text processing tool can be downloaded from a particular webserver. The administrator of the server wishes to test if the download times are adequately described by a normal distribution. A random sample of 80 users is selected and their download times recorded. The mean and standard deviation of the download times (in seconds) for the sample are 20.2 and 2.1 respectively.

Normal Goodness of Fit Suppose we wish to use 8 bins. We first find the intervals that divide the standard normal distribution into 8 equal parts. From the table of standard normal probabilities we can see that these intervals are: (, 1.15], ( 1.15, 0.675], ( 0.675, 0.32], ( 0.32, 0] and their mirror images on the other side of 0. This allows us to construct the bins in which to group our data.

Normal Goodness of Fit The first bin will be x 20.2 1.15(2.1) = 17.785, the second bin will be 17.785 < x 20.2 0.675(2.1) = 18.7825 and so on. The table below summarises the observed download times for the 80 users in the sample as well as the expected frequencies for each bin. Download Time (x) Observed Freq. Expected Freq x 17.785 8 10 17.785 < x 18.7825 9 10 18.7825 < x 19.528 13 10 19.528 < x 20.2 8 10 20.2 < x 20.872 10 10 20.872 < x 21.6175 12 10 21.6175 < x 22.615 8 10 22.615 < x 12 10

Normal Goodness of Fit We can now test the data for normality at a 5% level of significance following the same procedure as before. 1 H 0 : The form of the distribution is normal. 2 H 1 : The form of the distribution is non-normal. 3 Significance Level: α = 0.05. 4 Test Statistic χ 2 0 = 8 i=1 (E i O i ) 2 E i. 5 We reject H 0 if our sample data gives a value of χ 2 0 > χ2 5,0.05 = 11.07. The number of degrees of freedom is 8 2 1 = 5 because we estimated two parameters from the data. 6 The actual value of χ 2 0 for our sample is 3. As this is not greater than the critical value of 11.07 we cannot reject the null hypothesis at the 5% level of significance.

Contingency Tables Another use of the chi-square distribution is to assess the independence of two different ways of classifying a population. For example, we could classify drivers according to age and according to the insurance premium they pay and test whether these classifications are independent. Another example would be to classify computer users by the number of times their computer crashes per week and also by the operating system they use.

Contingency Tables If the first way of classifying the population has r levels (r different age categories for the drivers) and the second has c levels (c different categories of insurance premiums), the observed frequencies can be recorded in an r c contingency table with r rows and c columns. A sample of n observations is selected. For 1 i r and 1 j c, we let O ij denote the frequency observed for level i in the first classification and level j in the second classification. t i denotes the total number of observations in category i in the first way of classifying the population and s j denotes the total number of observations in category j in the second way of classifying the population.

Contingency Tables If the two methods of classification are independent then the expected frequency of cell (i, j), denoted E ij is t i s j n. Similar to goodness of fit tests, we use the test statistic χ 2 0 = r c (E ij O ij ) 2 E ij i=1 j=1 which has a chi-square distribution with (r 1)(c 1) degrees of freedom if the hypothesis of independence is true.

Contingency Tables Example A car rental company wishes to test if the age of a car rented to a customer and the customer s level of satisfaction are independent of each other. When a customer returns a car they rate their level of satisfaction as one of dissatisfied, no opinion, satisfied, very satisfied. The company only rents out cars that are two years old or less. A random sample of 60 customers is selected and the results of the sample are recorded in the table below.

Contingency Tables Satisfaction Level Age of Car Dissatisfied No Opinion Satisfied Very Satisfied New 4 6 13 7 1 Year 3 10 6 1 2 Years 3 3 4 0 Test the hypothesis that the level of satisfaction is independent of the age of the car at a 5% level of significance.

Contingency Tables 1 H 0 : The two methods of classification are independent. 2 H 1 : The two methods of classification are not independent. 3 Significance Level: α = 0.05. 4 Test Statistic: χ 2 0 = 3 4 i=1 j=1 (E ij O ij ) 2 E ij. 5 Reject H 0 if the value of χ 2 0 is greater than χ2 6,0.05 = 12.59. We have 6 = (3 1)(4 1) degrees of freedom. 6 The value of χ 2 0 for our sample is 9.91. 7 As this is not greater than the critical value of 12.59, we cannot reject H 0 at the 5% level of significance.