# Chi Squared Tests Hypothesis Tests for Linear Regression

## Presentation on theme: "Chi Squared Tests Hypothesis Tests for Linear Regression"— Presentation transcript:

Chi Squared Tests Hypothesis Tests for Linear Regression
AP Statistics Topic 7 Chi Squared Tests Hypothesis Tests for Linear Regression

These are the last 2 things we’ll study
Chi-squared tests Goodness of Fit Independence and Homogeneity Hypothesis tests for linear regression The significance of the linear relationship We’ll spend one week on each

Chi-Squared Tests Analysis of categorical data
The tests we’ll study are Goodness of Fit test tests for homogeneity and independence These tests are performed exactly the same way For homogeneity, we look at two samples and one characteristic For independence, we look at one sample and two characteristics

Goodness of Fit Test Measures the extent to which some empirical distribution “fits” the distribution expected under the null hypothesis 20 30 40 50 60 Fork length 10 Frequency

For example Time % 12-3AM 17 3-6AM 8 6-9AM 8 9AM-noon 6 Noon-3PM 10
A GEICO Direct magazine had an interesting article concerning the percentage of teenage motor vehicle deaths and the time of day. The following percentages were given from a sample. Time % 12-3AM 17 3-6AM 8 6-9AM 8 9AM-noon 6 Noon-3PM 10 3-6 PM 16 6-9 PM 15 9PM-12AM 19

The Distribution and Hypothesis Statements
Is the percentage of teenage motor vehicle deaths the same for each time period? Conduct a hypothesis test at the 1% level. Ho: The percent of teenage motor vehicle deaths is the same for each time period. Ha: The percent of teenage motor vehicle deaths is not the same for each time period.

Let’s look at this more closely
In this problem, what type of data are we considering? Categorical data – that is, the time of day How many classes is our data divided into? 8 different classes

Put another way …. We want to see if the distribution of our data is consistent with the hypothesized distribution In this case, we want to see if the distribution of accidents is uniform – about 12.5% per period

So how can we do this? We have our observed occurrences
Are these consistent with our hypothesis? What should we compare with these? Expected values -- Time 12-3 3-6 6-9 9-12 Count 17 8 6 10 16 15 19 Time 12-3 3-6 6-9 9-12 Observed 17 8 6 10 16 15 19 Expected 12.38

Test Statistic Our test statistic is

Chi-squared Distribution
Family of curves identified by deg of freedom (k-1) Mean = degrees of freedom Variance = 2(degrees of freedom) As deg of freedom increases, curves approach normal

How we’ll use the chi-squared distribution
We’ll use the chi-squared distribution to determine our p-value If our test statistic is large, then we’ll reject the null hypothesis P-value

How can we find p-values?
Calculate the chi-squared statistic Use the chi-squared table Use the chi-squared cdf function on your TI-83

The Chi-square table

Graphing Calculator 2nd DIST

Graphing Calculator STAT Inputs Observed data list Expected data list
Degrees of freedom

Assumptions We have 2 assumptions for this test
First, the observed cell counts are based on a random sample (our sample is random) Our sample is large. How do we determine large? Expected cell counts must all be greater than or equal to 5

Our conclusions? The same as we’ve always done
We reject or fail to reject the null based on a comparison of the p-value and our significance level We interpret our conclusion in the context of our alternative hypothesis

Let’s summarize Use the same 9 steps for hypothesis testing
Identify the parameter Null Alternative Choose significance level Test Statistic Assumptions Calculate Test Statistic Determine P-value Make your conclusion

Let’s finish the Geico Problem
Let’s identify the parameter Proportion of teenage accidents Null Hypothesis Ho: The percent of teenage motor vehicle deaths is the same for each time period. Alternative Hypothesis Ha: The percent of teenage motor vehicle deaths is not the same for each time period. Significance level

Continuing … Test Statistic Assumptions: The sample is random
The sample is large

Continuing … Calculate the Test Statistic Time 12-3 3-6 6-9 9-12
Observed 17 8 6 10 16 15 19 Expected 12.38

Conclusion We fail to reject the null hypothesis because the p-value (.056) is greater than the significance level (.01). The data does not suggest that the distribution of accidental deaths is not distributed differently among the time periods.

Homework 7-1 Read section 12.1 in the textbook 12.10 12.12 12.14

Let’s try this for some practice
Using a test, investigate whether it’s reasonable to assume the random number table is random. Use a significance level of .05.

Tests for Homogeneity and Independence
In these tests we’ll be taking n samples and looking at one characteristic. Take samples of 1000 people from 4 different countries and ask how they feel about whether the use of torture against suspected terrorist is justified. In this case we’d like to see if the responses are distributed equally (homogenous) among the countries. Or, we’ll take one sample and look at two characteristics. Take a sample of 300 adults and determine each person’s political philosophy and what television news station they watch In this case we’d like to see if political philosophy and news station are independent.

Let’s do an example of each
First, let’s do a test for independence Big Office is a chain of large office supply stores that sell an extensive line of desktop and laptop computers. Company executives want to know whether the demands for these types of computers are related in any way. They might act as complementary products or sales may not be related. Big Office randomly selected 250 business days categorized demand for each type of computer as Low, MedLow, MedHi and Hi. Desktops Low MedLow MedHi Hi 4 17 5 43 8 23 22 27 80 16 20 14 70 10 19 11 57 38 77 72 63 250 Laptops

So how many samples do we have
So how many samples do we have? Is the data we are collecting categorical or numerical? How many characteristics are we investigating? How many classes within those characteristics?

Hypotheses Statements
Ho: The two variables are independent. Ha: The two variables are not independent.

How do we test for independence?
Low MedLow MedHi Hi 4 17 5 43 8 23 22 27 80 16 20 14 70 10 19 11 57 38 77 72 63 250 Recall that if events A and B are independent So, we’ll assume the two variables are independent. Then we’ll determine expected cell counts for each cell. We’ll look at the differences between the expected and observed counts for out test.

Test Statistic

Assumptions The sample is random. The sample is large
Each expected cell count is at least 5

At this point … We can calculate the p-value using the chi-squared table The chi-squared CDF function on our calculator Or, use the chi-squared test

Let’s look at the Chi-Squared Test
This test is a piece of cake …. First, put your observed matrix into the calculator STAT – TEST – Now just select Calculate The calculator creates the Expected matrix Output : value of your test statistic and p-value

So let’s do this problem using our 9 steps of hypothesis testing

Chi-Squared Test for Homogeniety
The paper “No Evidence of Impaired Neurocognitive Performance in Collegiate Soccer Players’ compared collegiate soccer players, athletes in sports other than soccer, and a group of students who were not involved in collegiate sports with respect to head injuries. Three independent random samples were chosen and each person in the sample was asked to complete a medical history survey. The following 2-way contingency table was created based on reported concussions. 1 2 3+ Soccer 45 25 11 10 91 Other 68 15 8 5 96 Non 3 53 158 22 240

So how many samples do we have?
Is the data we are collecting categorical or numerical? How many characteristics are we investigating? How many classes within those characteristics?

Hypotheses Statements
Ho: The populations are homogenous or, The category proportions are the same for all populations. Ha: The populations are not homogenous. or, the category proportions are not the same for all populations.

Test Statistic

Assumptions The samples are random and independent.
The sample is large The expected cell counts are at least 5

Everything else is the same
Let’s finish this test using our 9 steps. 1 2 3+ Soccer 45 25 11 10 91 Other 68 15 8 5 96 Non 3 53 158 22 240

To summarize … Test for Independence Test for Homogeneity One sample
Two characteristics Assumptions: Sample is random Sample is large Test for Homogeneity Multiple samples One characteristic Samples are independent and random Samples are large

Homework 7-2 Read Section 12.2 12.18 12.22

Similar presentations