the chi-squared test,, of independence (contingency tables)

6
test, , of independence (contingency tables) www.ibmaths.com

Upload: diego-okeefe

Post on 27-Mar-2015

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: The chi-squared test,, of independence (contingency tables)

The chi-squared test, , of

independence (contingency tables)

www.ibmaths.com

Page 2: The chi-squared test,, of independence (contingency tables)

The chi-squared test can be used to test for: independence or goodness of fit.

This slideshow is for the independence of data.

That is you will be given two (or more) sets of data and we will test to see if the data is independent.

Page 3: The chi-squared test,, of independence (contingency tables)

The procedure to test for the independence:

1. State a hypotheses based on the fit of the data

2. Make a table of the observed and expected values. You will most likely be given the observed values.

3. Calculate the chi-squared test statistic, this is

4. Look up the chi-squared critical value from your chi-squared tables in the information booklet.

5. Compare your test statistic with your critical value and make a conclusion. If the test statistic lies in the critical region then reject H0 in favour of H1. Otherwise do not reject H0 in favour of H1.

At first glance this is similar to the goodness of fit test, but the test statistic is worked out differently.

Page 4: The chi-squared test,, of independence (contingency tables)

Degrees of freedom, v.When undertaking a chi-squared test you will have a table of observed and expected values. The degrees of freedom will be defined as:

v=(number of rows-1)(number of columns-1)

The chi-squared distribution.

The distribution will alter depending on the value of v. The general curve is shown opposite.

Page 5: The chi-squared test,, of independence (contingency tables)

Example of Chi-squared independence testThe headmaster of a large IB school is concerned that the maths

results are dependent on the maths teacher. There are 3 SL teachers and the results for each class have been shown below.These are the observed values.Test at the 5% level of significance to see if the grades are independent of the teacher.

1 2 3 4 5 6 7 Total

Mr. P 2 3 5 4 3 1 0 18

Ms. Q 1 2 5 6 4 1 1 20

Mrs. R

0 1 2 5 5 1 2 16

Total 3 6 12 15 12 3 3 54

Make your hypotheses:H0: the grade at maths SL is independent of the teacher.H1: the grade at maths SL is not independent of the teacher.Make a table of expected values. To do this take each row total x column total and divide by the grand total.This is shown opposite.

This value is the expected value for this cell.

Find the expected number of grade 2s that Mr. P gets.

Complete a table of expected values.

Page 6: The chi-squared test,, of independence (contingency tables)

1 2 3 4 5 6 7 Total

Mr. P 2 3 5 4 3 1 0 18

Ms. Q 1 2 5 6 4 1 1 20

Mrs. R

0 1 2 5 5 1 2 16

Total 3 6 12 15 12 3 3 54

continued ....

Observed

Expected

1 2 3 4 5 6 7 Total

Mr. P 1 2 4 5 4 1 1 18

Ms. Q1.11

2.22

4.44

5.56

4.44

1.11

1.11

20

Mrs. R

0.89

1.78

3.56

4.44

3.56

0.89

0.89

16

Total 3 6 12 15 12 3 3 54

Calculate the chi squared test statistic:

Find the critical value from your tables.v=(7-1)(3-1)=12

Critical value = 21.026

Make your conclusion:Do not reject the null hypothesis. At the 5% level of significance there is no evidence to suggest that the choice of teacher influences the grade achieved.

the p value