chi square goodness of fit

117
What is a Chi-Square Test of Goodness of Fit?

Upload: byu-center-for-teaching-learning

Post on 20-Jun-2015

197 views

Category:

Education


0 download

DESCRIPTION

Chi square goodness of fit

TRANSCRIPT

Page 1: Chi square goodness of fit

What is a Chi-Square Test of Goodness of Fit?

Page 2: Chi square goodness of fit

Questions of goodness of fit have become increasingly important in modern statistics.

Page 3: Chi square goodness of fit

Questions of goodness of fit juxtapose complex observed patterns against hypothesized or previously observed patterns

to test overall and specific differences among

them.

Page 4: Chi square goodness of fit

Observed Hypothesized Difference

Page 5: Chi square goodness of fit

Observed Hypothesized Difference

If the difference is small then the FIT IS GOOD

Page 6: Chi square goodness of fit

Observed Hypothesized Difference

If the difference is small then the FIT IS GOOD

Observed Hypothesized Difference

Page 7: Chi square goodness of fit

Observed Hypothesized Difference

If the difference is small then the FIT IS GOOD

Observed Hypothesized Difference

For example:

Page 8: Chi square goodness of fit

Observed Hypothesized Difference

If the difference is small then the FIT IS GOOD

Observed Hypothesized Difference

For example:

51% Females 50% Females 1%

Page 9: Chi square goodness of fit

Observed Hypothesized Difference

Page 10: Chi square goodness of fit

Observed Hypothesized Difference

If the difference is BIG then the FIT IS NOT GOOD

Page 11: Chi square goodness of fit

Observed Hypothesized Difference

If the difference is BIG then the FIT IS NOT GOOD

Observed Hypothesized Difference

Page 12: Chi square goodness of fit

Observed Hypothesized Difference

If the difference is BIG then the FIT IS NOT GOOD

Observed Hypothesized Difference

For example:

Page 13: Chi square goodness of fit

Observed Hypothesized Difference

If the difference is BIG then the FIT IS NOT GOOD

Observed Hypothesized Difference

For example:

50% Females 22% Females

18%

Page 14: Chi square goodness of fit

Here is an example:

Page 15: Chi square goodness of fit

Here is an example:We want to know if a sample we have selected has the national percentages of a certain ethnic groups.

Page 16: Chi square goodness of fit

Here is an example:We want to know if a sample we have selected has the national percentages of a certain ethnic groups.

2% of sample is made of

members of this ethnic

group

10% of the population is made of this ethnic group

8% Difference

Page 17: Chi square goodness of fit

You will use certain statistical methods to determine if the goodness of fit is

significant or not.

Page 18: Chi square goodness of fit

You will use certain statistical methods to determine if the goodness of fit is

significant or not.

Here is an example:

Page 19: Chi square goodness of fit

You will use certain statistical methods to determine if the goodness of fit is

significant or not.

Here is an example:Problem – The chair of a statistics department suspects that some of her faculty are more popular with students than others.

Page 20: Chi square goodness of fit

There are three sections of introductory stats that are taught at the same time in the morning by Professors Cauforek, Kerr, and Rector.

Page 21: Chi square goodness of fit

There are three sections of introductory stats that are taught at the same time in the morning by Professors Cauforek, Kerr, and Rector.66 students are planning on enrolling in one of the three classes.

Page 22: Chi square goodness of fit

What would you expect the number of enrollees to be in each class if popularity were not an issue?

Page 23: Chi square goodness of fit

Professor Cauforek Professor Kerr Professor Rector

22 22 22

What would you expect the number of enrollees to be in each class if popularity were not an issue?

Page 24: Chi square goodness of fit

Professor Cauforek Professor Kerr Professor Rector

22 22 22

What would you expect the number of enrollees to be in each class if popularity were not an issue?

This is our expected value.

Page 25: Chi square goodness of fit

Now let’s see what was observed.

Page 26: Chi square goodness of fit

Now let’s see what was observed.The number who enroll for each class was:

Page 27: Chi square goodness of fit

Now let’s see what was observed.The number who enroll for each class was:

Professor Cauforek Professor Kerr Professor Rector

31 25 10

Page 28: Chi square goodness of fit

We will test the degree to which the observed data...

Page 29: Chi square goodness of fit

We will test the degree to which the observed data...

Professor Cauforek Professor Kerr Professor Rector

31 25 10

Page 30: Chi square goodness of fit

We will test the degree to which the observed data...

…fits the expected enrollments.

Professor Cauforek Professor Kerr Professor Rector

31 25 10

Page 31: Chi square goodness of fit

We will test the degree to which the observed data...

…fits the expected enrollments.

Professor Cauforek Professor Kerr Professor Rector

31 25 10

Professor Cauforek Professor Kerr Professor Rector

22 22 22

Page 32: Chi square goodness of fit

Here is the formula:

Page 33: Chi square goodness of fit

Here is the formula:

Page 34: Chi square goodness of fit

𝑥2=Σ(𝑂−𝐸)2

𝐸

Page 35: Chi square goodness of fit

Where:

𝑥2=Σ(𝑂−𝐸)2

𝐸

Page 36: Chi square goodness of fit

Where:

𝑥2=Σ(𝑂−𝐸)2

𝐸

𝒙𝟐= h𝐶 𝑖𝑆𝑞𝑢𝑎𝑟𝑒

Page 37: Chi square goodness of fit

Where:

𝑥2=Σ(𝑂−𝐸)2

𝐸

𝒙𝟐= h𝐶 𝑖𝑆𝑞𝑢𝑎𝑟𝑒

𝒙𝟐=Σ(𝑂−𝐸)2

𝐸

Page 38: Chi square goodness of fit

𝚺=𝑆𝑢𝑚𝑜𝑓

Page 39: Chi square goodness of fit

𝚺=𝑆𝑢𝑚𝑜𝑓

𝑥2=𝚺 (𝑂−𝐸)2

𝐸

Page 40: Chi square goodness of fit

𝐎=𝑜𝑏𝑠𝑒𝑟𝑣𝑒𝑑𝑠𝑐𝑜𝑟𝑒

Page 41: Chi square goodness of fit

𝐎=𝑜𝑏𝑠𝑒𝑟𝑣𝑒𝑑𝑠𝑐𝑜𝑟𝑒

𝑥2=Σ(𝑶−𝐸)2

𝐸

Page 42: Chi square goodness of fit

𝐎=𝑜𝑏𝑠𝑒𝑟𝑣𝑒𝑑𝑠𝑐𝑜𝑟𝑒

𝑥2=Σ(𝑶−𝐸)2

𝐸

Professor Cauforek Professor Kerr Professor Rector

31 25 10

Page 43: Chi square goodness of fit

𝐎=𝑜𝑏𝑠𝑒𝑟𝑣𝑒𝑑𝑠𝑐𝑜𝑟𝑒

𝑥2=Σ(𝑶−𝐸)2

𝐸

Professor Cauforek Professor Kerr Professor Rector

31 25 10

Page 44: Chi square goodness of fit

𝑬=𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑠𝑐𝑜𝑟𝑒

Page 45: Chi square goodness of fit

𝑬=𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑠𝑐𝑜𝑟𝑒

𝑥2=Σ(𝑂−𝑬 )2

𝐸

Page 46: Chi square goodness of fit

𝑬=𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑠𝑐𝑜𝑟𝑒

𝑥2=Σ(𝑂−𝑬 )2

𝐸

Professor Cauforek Professor Kerr Professor Rector

22 22 22

Page 47: Chi square goodness of fit

𝑬=𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑠𝑐𝑜𝑟𝑒

𝑥2=Σ(𝑂−𝑬 )2

𝐸

Professor Cauforek Professor Kerr Professor Rector

22 22 22

Page 48: Chi square goodness of fit

𝑬=𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑠𝑐𝑜𝑟𝑒

𝑥2=Σ(𝑂−𝐸)2

𝑬

Professor Cauforek Professor Kerr Professor Rector

22 22 22

Page 49: Chi square goodness of fit

Here is the null-hypothesis:

Page 50: Chi square goodness of fit

Here is the null-hypothesis:

There is no significant difference between the expected and the observed number of students

enrolled in three stats professors’ classes.

Page 51: Chi square goodness of fit

Now we will compute the value and compare it with the critical value.

Page 52: Chi square goodness of fit

Now we will compute the value and compare it with the critical value.• If the value exceeds the critical value, then we

will reject the null-hypothesis.

Page 53: Chi square goodness of fit

Now we will compute the value and compare it with the critical value.• If the value exceeds the critical value, then we

will reject the null-hypothesis.• If the value DOES NOT exceed the critical

value, then we will fail to reject the null-hypothesis.

Page 54: Chi square goodness of fit

Let’s compute the value.

Page 55: Chi square goodness of fit

Let’s compute the value. Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

Page 56: Chi square goodness of fit

Let’s compute the value. Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=𝚺 (𝑂−𝐸)2

𝐸

Page 57: Chi square goodness of fit

Let’s compute the value.

OR

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=𝚺 (𝑂−𝐸)2

𝐸

Page 58: Chi square goodness of fit

Let’s compute the value.

OR

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=𝚺 (𝑂−𝐸)2

𝐸

𝑥2=(𝑂−𝐸)2

𝐸+(𝑂−𝐸)2

𝐸+

(𝑂−𝐸)2

𝐸

Page 59: Chi square goodness of fit

Let’s compute the value.

OR

𝑥2=(𝑂−𝐸)2

𝐸+(𝑂−𝐸)2

𝐸+

(𝑂−𝐸)2

𝐸

𝑥2=𝚺 (𝑂−𝐸)2

𝐸

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

Page 60: Chi square goodness of fit

Let’s input each professor’s data into the equation.

Page 61: Chi square goodness of fit

Let’s input each professor’s data into the equation.

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

Page 62: Chi square goodness of fit

Let’s input each professor’s data into the equation.

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=(𝟑𝟏−𝐸)2

𝐸+(𝑂−𝐸)2

𝐸+(𝑂−𝐸)2

𝐸

Page 63: Chi square goodness of fit

Let’s input each professor’s data into the equation.

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=(31−𝟐𝟐)2

𝐸+(𝑂−𝐸)2

𝐸+(𝑂−𝐸)2

𝐸

Page 64: Chi square goodness of fit

Let’s input each professor’s data into the equation.

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=(31−22)2

𝟐𝟐+

(𝑂−𝐸)2

𝐸+

(𝑂−𝐸)2

𝐸

Page 65: Chi square goodness of fit

Let’s input each professor’s data into the equation.

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=(31−22)2

22+

(𝟐𝟓−𝐸)2

𝐸+(𝑂−𝐸)2

𝐸

Page 66: Chi square goodness of fit

Let’s input each professor’s data into the equation.

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=(31−22)2

22+

(25−𝟐𝟐)2

𝟐𝟐+(𝑂−𝐸)2

𝐸

Page 67: Chi square goodness of fit

Let’s input each professor’s data into the equation.

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=(31−22)2

22+

(25−22)2

22+(𝟏𝟎−𝐸)2

𝐸

Page 68: Chi square goodness of fit

Let’s input each professor’s data into the equation.

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22Observed 31 25 10

𝑥2=(31−22)2

22+

(25−22)2

22+(10−𝟐𝟐)2

𝟐𝟐

Page 69: Chi square goodness of fit

Now for the calculation:

Page 70: Chi square goodness of fit

Now for the calculation:

𝑥2=(31−22)2

22+

(25−22)2

22+(10−22)2

22

Page 71: Chi square goodness of fit

Now for the calculation:

𝑥2=(𝟗)2

22+

(25−22)2

22+(10−22)2

22

Page 72: Chi square goodness of fit

Now for the calculation:

𝑥2=𝟖𝟏22

+(25−22)2

22+(10−22)2

22

Page 73: Chi square goodness of fit

Now for the calculation:

𝑥2=8122

+(𝟑)2

22+(10−22)2

22

Page 74: Chi square goodness of fit

Now for the calculation:

𝑥2=8122

+ 𝟗22

+(10−22)2

22

Page 75: Chi square goodness of fit

Now for the calculation:

𝑥2=8122

+ 𝟗22

+(−𝟏𝟐)2

22

Page 76: Chi square goodness of fit

Now for the calculation:

𝑥2=8122

+922

+𝟏𝟒𝟒22

Page 77: Chi square goodness of fit

Convert the fractions into decimals:

𝑥2=8122

+922

+𝟏𝟒𝟒22

Page 78: Chi square goodness of fit

Convert the fractions into decimals:

𝑥2=8122

+922

+14422

Page 79: Chi square goodness of fit

Convert the fractions into decimals:

𝑥2=𝟑 .𝟕+922

+14422

Page 80: Chi square goodness of fit

Convert the fractions into decimals:

𝑥2=3.7+𝟎 .𝟒+14422

Page 81: Chi square goodness of fit

Convert the fractions into decimals:

𝑥2=3.7+0.4+𝟔 .𝟓

Page 82: Chi square goodness of fit

Sum the terms:

𝑥2=3.7+0.4+6.5

Page 83: Chi square goodness of fit

Sum the terms:

𝑥2=10.6

Page 84: Chi square goodness of fit

As a contrasting example note what the value would be if the observed and expected values were more similar:

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 24 22 20

Page 85: Chi square goodness of fit

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 24 22 20

𝑥2=(𝑂−𝐸)2

𝐸+(𝑂−𝐸)2

𝐸+

(𝑂−𝐸)2

𝐸

Page 86: Chi square goodness of fit

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22Observed 24 22 20

𝑥2=(𝑂−𝟐𝟐)2

𝟐𝟐+(𝑂−𝟐𝟐)2

𝟐𝟐+

(𝑂−𝟐𝟐)2

𝟐𝟐

Page 87: Chi square goodness of fit

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 24 22 20

𝑥2=(𝟐𝟒−22)2

22+(𝟐𝟐−22)2

22+(𝟐𝟎−22)2

22

Page 88: Chi square goodness of fit

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 24 22 20

𝑥2=(𝟐)2

22+

(𝟎)2

22+

(−𝟐)2

22

Page 89: Chi square goodness of fit

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 24 22 20

𝑥2=𝟒22

+𝟎22

+𝟒22

Page 90: Chi square goodness of fit

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 24 22 20

𝑥2=𝟎 .𝟐+𝟎 .𝟎+𝟎 .𝟐

Page 91: Chi square goodness of fit

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 24 22 20

𝑥2=𝟎 .𝟒

Page 92: Chi square goodness of fit

So the moral of the story is that the closer the expected and observed values are to one another, the smaller the Chi-square value or the greater the goodness of fit (as seen below).

Page 93: Chi square goodness of fit

So the moral of the story is that the closer the expected and observed values are to one another, the smaller the Chi-square value or the greater the goodness of fit (as seen below).

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

Page 94: Chi square goodness of fit

So the moral of the story is that the closer the expected and observed values are to one another, the smaller the Chi-square value or the greater the goodness of fit (as seen below).

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=𝟏𝟎 .𝟔

Page 95: Chi square goodness of fit

On the other hand, the farther the expected and observed values are from one another the smaller the Chi-square value or the greater the goodness of fit (as seen below).

Page 96: Chi square goodness of fit

On the other hand, the farther the expected and observed values are from one another the smaller the Chi-square value or the greater the goodness of fit (as seen below).

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

Page 97: Chi square goodness of fit

On the other hand, the farther the expected and observed values are from one another the smaller the Chi-square value or the greater the goodness of fit (as seen below).

Professor Cauforek Professor Kerr Professor Rector

Expected 22 22 22

Observed 31 25 10

𝑥2=𝟏𝟎 .𝟔

Page 98: Chi square goodness of fit

Now we determine if a of 10.6 exceeds the critical for terms.

Page 99: Chi square goodness of fit

To calculate the critical we first must determine the degrees of freedom as well as set the probability level.

Page 100: Chi square goodness of fit

To calculate the critical we first must determine the degrees of freedom as well as set the probability level.The probability or alpha level means the probability of a type 1 error we are willing to live with (i.e., this is the probability of being wrong when we reject the null hypothesis).

Page 101: Chi square goodness of fit

To calculate the critical we first must determine the degrees of freedom as well as set the probability level.The probability or alpha level means the probability of a type 1 error we are willing to live with (i.e., this is the probability of being wrong when we reject the null hypothesis). Generally this value is 0.5 which is like saying we are willing to be wrong 5 out of 100 times (0.05) before we will reject the null-hypothesis.

Page 102: Chi square goodness of fit

Degrees of Freedom are calculated by taking the number of groups and subtracting them by 1. (Three groups minus 1 = 2)

Page 103: Chi square goodness of fit

We now have all of the information we need to determine the critical .

Page 104: Chi square goodness of fit

We now have all of the information we need to determine the critical .We go to the Chi-Square Distribution Table and locate the degrees of freedom.

Page 105: Chi square goodness of fit

We now have all of the information we need to determine the critical .We go to the Chi-Square Distribution Table and locate the degrees of freedom.

df 0.100 0.050 0.025 1 2.71 3.84 5.02 2 4.61 5.99 7.38 3 6.25 7.82 9.35 4 7.78 9.49 11.14 5 9.24 11.07 12.83 6 10.64 12.59 14.45 7 12.02 14.07 16.10 8 13.36 15.51 17.54 9 14.68 16.92 19.20 … … … …

Page 106: Chi square goodness of fit

We now have all of the information we need to determine the critical .We go to the Chi-Square Distribution Table and locate the degrees of freedom.And then we locate the probability or alpha level:

df 0.100 0.050 0.025 1 2.71 3.84 5.02 2 4.61 5.99 7.38 3 6.25 7.82 9.35 4 7.78 9.49 11.14 5 9.24 11.07 12.83 6 10.64 12.59 14.45 7 12.02 14.07 16.10 8 13.36 15.51 17.54 9 14.68 16.92 19.20 … … … …

Page 107: Chi square goodness of fit

We now have all of the information we need to determine the critical .We go to the Chi-Square Distribution Table and locate the degrees of freedom.And then we locate the probability or alpha level:

df 0.100 0.050 0.025 1 2.71 3.84 5.02 2 4.61 5.99 7.38 3 6.25 7.82 9.35 4 7.78 9.49 11.14 5 9.24 11.07 12.83 6 10.64 12.59 14.45 7 12.02 14.07 16.10 8 13.36 15.51 17.54 9 14.68 16.92 19.20 … … … …

Page 108: Chi square goodness of fit

We now have all of the information we need to determine the critical .We go to the Chi-Square Distribution Table and locate the degrees of freedom.And then we locate the probability or alpha level:

df 0.100 0.050 0.025 1 2.71 3.84 5.02 2 4.61 5.99 7.38 3 6.25 7.82 9.35 4 7.78 9.49 11.14 5 9.24 11.07 12.83 6 10.64 12.59 14.45 7 12.02 14.07 16.10 8 13.36 15.51 17.54 9 14.68 16.92 19.20 … … … …

Where these two values intersect in the table we find the critical .

Page 109: Chi square goodness of fit

df 0.100 0.050 0.025 1 2.71 3.84 5.02 2 4.61 5.99 7.38 3 6.25 7.82 9.35 4 7.78 9.49 11.14 5 9.24 11.07 12.83 6 10.64 12.59 14.45 7 12.02 14.07 16.10 8 13.36 15.51 17.54 9 14.68 16.92 19.20 … … … …

We now have all of the information we need to determine the critical .We go to the Chi-Square Distribution Table and locate the degrees of freedom.And then we locate the probability or alpha level:

Where these two values intersect in the table we find the critical .

Page 110: Chi square goodness of fit

We now have all of the information we need to determine the critical .We go to the Chi-Square Distribution Table and locate the degrees of freedom.And then we locate the probability or alpha level:

df 0.100 0.050 0.025 1 2.71 3.84 5.02 2 4.61 5.99 7.38 3 6.25 7.82 9.35 4 7.78 9.49 11.14 5 9.24 11.07 12.83 6 10.64 12.59 14.45 7 12.02 14.07 16.10 8 13.36 15.51 17.54 9 14.68 16.92 19.20 … … … …

Where these two values intersect in the table we find the critical .

Page 111: Chi square goodness of fit

Since the chi-square goodness of fit value (10.6) exceeds the critical (5.99) we will reject the null hypothesis:

Page 112: Chi square goodness of fit

Since the chi-square goodness of fit value (10.6) exceeds the critical (5.99) we will reject the null hypothesis:

There is no significant difference between the expected and the observed number of students

enrolled in three stats professors’ classes.

Page 113: Chi square goodness of fit

Since the chi-square goodness of fit value (10.6) exceeds the critical (5.99) we will reject the null hypothesis:

There is no significant difference between the expected and the observed number of students

enrolled in three stats professors’ classes.

Page 114: Chi square goodness of fit

Since the chi-square goodness of fit value (10.6) exceeds the critical (5.99) we will reject the null hypothesis:

There actually is a significant difference.

There is no significant difference between the expected and the observed number of students

enrolled in three stats professors’ classes.

Page 115: Chi square goodness of fit

In summary,

Page 116: Chi square goodness of fit

In summary,Questions of goodness of fit juxtapose observed patterns against hypothesized to test overall and specific differences among them.

Page 117: Chi square goodness of fit

In summary,Questions of goodness of fit juxtapose observed patterns against hypothesized to test overall and specific differences among them.

Observed Hypothesized Difference