Statistic work

profilemehett
chi-square_testing.pdf

Agenda

• Introduction to Nonparametric Tests of Significance

• Chi Square Test • One way chi square

• Two way chi square

Parametric versus Nonparametric Tests

• Parametric Test- A test that makes assumptions about the population parameters and the data

• Nonparametric Test- Tests that make fewer assumptions about the population parameters and the data

The One Way Chi Square Test – Terminology

• One way Chi-Square test: Testing for differences between the distribution of one variable among its categories.

• Two way Chi-Square Test: Testing for differences between the distribution of one variable by another variable.

• Observed frequencies: Frequencies that actually occur based on data we collected.

• Expected frequencies: Frequencies that we would expect IF the null hypothesis was true.

The One Way Chi Square Test – Intuition

• Expected frequencies are the frequencies that would occur if the null hypothesis was true

• We want to test the null hypothesis

• Can test it by seeing if the observed frequencies are significantly different from the expected frequencies • If differences are small they might be sampling error  retain H0 • If the differences are large enough, however, they probably represent true

differences  reject H0

The One Way Chi Square Test – Intuition

• Is the coin fair?

Coin Observed Frequency

Expected Frequency

Head 80 50

Tails 20 50

• Calculate expected frequencies for each category. • Divide total number of observations by K, the number of categories.

• Calculate Chi-Square statistic • Consult textbook page 323

The One Way Chi Square Test – Specific Steps

The One Way Chi Square Test – Specific Steps

• Look up the critical Chi Square value in the table (p.557) • Degrees of Freedom = K-1

• Compare critical Chi Square to calculated Chi square • If your calculated Chi Square is > your critical Chi square you reject the null

hypothesis

• If your calculated Chi Square is < you critical Chi Square you fail to reject the null hypothesis

The One Way Chi Square Test – Example

• The following table summarizes the self-reported ideology of a sample of students from Stony Brook. Test the null hypothesis that ideological self-identification is distributed equally through the student body.

Ideology

Liberal 30 50 -20 400 8

Moderate 75 50 25 625 12.5

Conservative 45 50 -5 25 .5

150

The One Way Chi Square Test – Exercise

• A researcher is interested in studying the voting turnout of university students. She takes a sample of 50 students and asks them whether they voted or not in the last election. She finds that only 15 students reported voting while 35 reported not voting. Test the null hypothesis that voters and non-voters are distributed equally among university students.

The Two Way Chi Square Test

• Are the differences in a cross tabulation statistically significant? • Remember a cross tabulation looks at the distribution of one variable by

categories of another variable

• The null hypothesis is that frequency of one variable does not differ by categories of the other variable

• Procedure is largely the same as the One Way Chi Square Test • Only major difference is how you calculate the expected frequencies and the

degrees of freedom

The Two Way Chi Square Test- Specific Steps

The Two Way Chi Square Test – Specific Steps

The Two Way Chi Square Test – Example

Democrat Republican Total

Obama 20 10 30

Romney 5 65 70

Total 25 75 100

Row Marginal Totals

Column Marginal Totals

N

The Two Way Chi Square Test – Example

Dem. Rep. Total

Obama 20 10 30

Romney 5 65 70

Total 25 75 100

Observed Frequencies

Dem. Rep. Total

Obama 7.5 22.5 30

Romney 17.5 52.5 70

Total 25 75 100

Expected Frequencies

The Two Way Chi Square Test – Example

Cell

Dems for Obama

20 7.5

Dems for Romney

5 17.5

Reps for Obama

10 22.5

Reps for Romney

65 52.5

Total 100 100

12.5

-12.5

-12.5

-12.5

156.25

156.25

156.25

156.25

20.83

8.93

6.94

2.98

39.68

The Two Way Chi Square Test- Example

Computer Skills

Did Not Take Course

Took Course Total

Above Average

15 19 34

Average 25 23 48

Below Average

10 8 18

50 50 100

The Two Way Chi Square Test- Example

Cell

No Course AA 15 17

No Course A 25 24

No Course BA 10 9

Course AA 19 17

Course A 23 24

Course BA 8 9

-2

1

.24

2

-1

-1

4

1

1

1

4

1

1

.04

.11

.24

.04

.11

.78

Requirements/Assumptions for Using Chi Square

• The samples are independent

• The samples are random

• The expected frequency of any one cell should not be too small • Can use Yates Correction if this occurs

Next Class

• Introduction to Correlation

• Homework will be on Blackboard after class • Deadline: April 20th, 5pm.