Download - Chi Squared Test

Transcript
Page 1: Chi Squared Test

Chi Squared TestChi Squared Test

Page 2: Chi Squared Test

Why Chi Squared?Why Chi Squared?

•To test to see if, when we collect data, is the variation we see due to chance or due to something else?

•To test to see if, when we collect data, is the variation we see due to chance or due to something else?

Page 3: Chi Squared Test

•This is the Chi Squared Test Formula

•Greek letter “X” is “Chi”

•Don’t get confused- X2 is the name of the whole variable- you don’t have to ever take the square root of it or solve for X.

•This is the Chi Squared Test Formula

•Greek letter “X” is “Chi”

•Don’t get confused- X2 is the name of the whole variable- you don’t have to ever take the square root of it or solve for X.

Page 4: Chi Squared Test

Coin Flipping ExampleCoin Flipping Example•If you flip a coin 100 times and get this

data:•62 Heads•38 Tails

•The question we wonder about this data:•Is this due to chance? Or. . .•Is this not due to chance?

•For example:•Perhaps there something wrong

with the coin?•Perhaps there is something wrong

with the way I am flipping the coin, etc.?

•Chi Squared test lets us answer this!!

•If you flip a coin 100 times and get this data:•62 Heads•38 Tails

•The question we wonder about this data:•Is this due to chance? Or. . .•Is this not due to chance?

•For example:•Perhaps there something wrong

with the coin?•Perhaps there is something wrong

with the way I am flipping the coin, etc.?

•Chi Squared test lets us answer this!!

Page 5: Chi Squared Test

Null HypothesisNull Hypothesis•The Chi Squared Test begins with the Null

Hypothesis

•The Null Hypothesis says: There is no significant statistical difference between the observed and expected frequencies (i.e. the differences we see are simply due to chance).

•For a coin flipping experiment:

•The expected values are 50 heads, 50 tails.

•The observed values are 62 heads, 38 tails.

•Question we are trying to answer: are the observed values due to chance or. . . not due to chance?

•The Chi Squared Test begins with the Null Hypothesis

•The Null Hypothesis says: There is no significant statistical difference between the observed and expected frequencies (i.e. the differences we see are simply due to chance).

•For a coin flipping experiment:

•The expected values are 50 heads, 50 tails.

•The observed values are 62 heads, 38 tails.

•Question we are trying to answer: are the observed values due to chance or. . . not due to chance?

Page 6: Chi Squared Test

Degrees of Freedom and Critical Values

Degrees of Freedom and Critical Values

•We need to define and understand these terms before we can use the Chi Squared test.

•The whole point of a Chi Squared test is to either reject or “fail to reject” (accept) the Null Hypothesis.

•Key is to exceed or not exceed your critical value.

•But first we have to figure out which number it is in this chart.

•We need to define and understand these terms before we can use the Chi Squared test.

•The whole point of a Chi Squared test is to either reject or “fail to reject” (accept) the Null Hypothesis.

•Key is to exceed or not exceed your critical value.

•But first we have to figure out which number it is in this chart.

Page 7: Chi Squared Test

Degrees of FreedomDegrees of Freedom•Because we are comparing outcomes, we need

at least two outcomes in our experiment.

•We are flipping coins so we have two outcomes- heads or tails.

•To get degrees of freedom we simply subtract one from the two possible outcomes. 2-1= 1

•Therefore, in this experiment we have 1 degree of freedom

•Because we are comparing outcomes, we need at least two outcomes in our experiment.

•We are flipping coins so we have two outcomes- heads or tails.

•To get degrees of freedom we simply subtract one from the two possible outcomes. 2-1= 1

•Therefore, in this experiment we have 1 degree of freedom

Page 8: Chi Squared Test

Critical ValuesCritical Values•Next thing you are looking for is a critical value.

•We will always use p = 0.05 value.

•This means we are 95% sure we are either “failing to reject” the Null Hypothesis or “rejecting” our Null Hypothesis.

•Critical Values can vary. If we want a higher degree of certainty that our results are true, we can use p= 0.01 value and then we would have 99% certainty, but 95% certainty is used by most scientists.

•For 1 degree of freedom at p=.05 the critical value = 3.84.

•Next thing you are looking for is a critical value.

•We will always use p = 0.05 value.

•This means we are 95% sure we are either “failing to reject” the Null Hypothesis or “rejecting” our Null Hypothesis.

•Critical Values can vary. If we want a higher degree of certainty that our results are true, we can use p= 0.01 value and then we would have 99% certainty, but 95% certainty is used by most scientists.

•For 1 degree of freedom at p=.05 the critical value = 3.84.

Page 9: Chi Squared Test

Null HypothesisNull Hypothesis• Null Hypothesis says:

• There is no significant statistical difference between the observed and expected frequencies (i.e. the differences we see are simply due to chance).

• We either reject or “fail to reject” (accept) the null hypothesis.

• Reject the Null Hypothesis: This means there is a statistical difference between the observed and expected frequencies

• Fail to Reject (accept) the Null Hypothesis: This means there is no statistical difference between the observed and expected frequencies

• In this case the critical value is 3.841

• If your Chi Squared is greater than 3.841 you reject the Null Hypothesis

• Therefore, there is something aside from chance that is causing us to get more heads than tails.

• If your Chi Squared is less than 3.841 you “fail to reject” (accept) the Null Hypothesis.

• This is usually what happens unless you have something that is impacting your results

• Null Hypothesis says:

• There is no significant statistical difference between the observed and expected frequencies (i.e. the differences we see are simply due to chance).

• We either reject or “fail to reject” (accept) the null hypothesis.

• Reject the Null Hypothesis: This means there is a statistical difference between the observed and expected frequencies

• Fail to Reject (accept) the Null Hypothesis: This means there is no statistical difference between the observed and expected frequencies

• In this case the critical value is 3.841

• If your Chi Squared is greater than 3.841 you reject the Null Hypothesis

• Therefore, there is something aside from chance that is causing us to get more heads than tails.

• If your Chi Squared is less than 3.841 you “fail to reject” (accept) the Null Hypothesis.

• This is usually what happens unless you have something that is impacting your results

Page 10: Chi Squared Test

Practice- Coin TossPractice- Coin Toss• 50 tosses

• Expected: Heads: 25 Tails: 25

• Observed: Heads: 28 Tails: 22

• Do it for heads

• Do it for tails

• What is our Critical Value?

• 2-1 = 1

• 3.84

• If our Chi Squared is greater than the critical value we reject our Null Hypothesis

• If our Chi Squared is less than the critical value we “fail to reject” (accept) our Null Hypothesis

• This means there is no statistical significance between what we observed & what we expected. What we got is due to chance- nothing’s weird about the coins or the way we tossed them.

• 50 tosses

• Expected: Heads: 25 Tails: 25

• Observed: Heads: 28 Tails: 22

• Do it for heads

• Do it for tails

• What is our Critical Value?

• 2-1 = 1

• 3.84

• If our Chi Squared is greater than the critical value we reject our Null Hypothesis

• If our Chi Squared is less than the critical value we “fail to reject” (accept) our Null Hypothesis

• This means there is no statistical significance between what we observed & what we expected. What we got is due to chance- nothing’s weird about the coins or the way we tossed them.

Page 11: Chi Squared Test

Practice- DicePractice- Dice• 36 dice

• Expected: 6 of each

• Observed:

• 36 dice

• Expected: 6 of each

• Observed:

Page 12: Chi Squared Test

Practice- DicePractice- Dice• Chi Squared

• Degrees of Freedom

• 6-1=5

• Critical Value: 11.07

• “Fail to reject” (accept) the Null Hypothesis

• No difference between obs and exp

• What we see is due to chance!

• Chi Squared

• Degrees of Freedom

• 6-1=5

• Critical Value: 11.07

• “Fail to reject” (accept) the Null Hypothesis

• No difference between obs and exp

• What we see is due to chance!