Two Way Tables
Sponsored Links
This presentation is the property of its rightful owner.
1 / 62

Two Way Tables Chi Square Test PowerPoint PPT Presentation


  • 112 Views
  • Uploaded on
  • Presentation posted in: General

Two Way Tables Chi Square Test. 2 categorical variables. Data collected in a table with counts. Can test whether there is association between the 2 variables.

Download Presentation

Two Way Tables Chi Square Test

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Two Way Tables

Chi Square Test


2 categorical variables


Data collected in a table with counts.


Can test whether there is association between the 2 variables.


Market researchers think that background music can influence the mood and purchasing behavior of customers. One study compared 3 treatments: no music, French accordion music, and Italian string music. Under each condition, the researchers recorded the number of bottles of French, Italian, and other wine purchased.


Market researchers think that background music can influence the mood and purchasing behavior of customers. One study compared 3 treatments: no music, French accordion music, and Italian string music. Under each condition, the researchers recorded the number of bottles of French, Italian, and other wine purchased.


Music and wine data in counts

243 bottles total


Marginal Distribution


What percent of wine bought was Italian?


What percent of wine bought was Italian?


What percent of wine was purchased from a store with no music playing


What percent of wine was purchased from a store with no music playing


Marginal Distributions

Only ask about 1 variable

Use values in “margins”


What percent of all wine bought was Italian with French music playing in the store?


What percent of all wine bought was Italian with French music playing in the store?


Joint distribution

Ask about both variables

Use values inside table and total


What percent of all wine bought was Italian with French music playing in the store?


Of the Italian wine purchased, what percent was from a store playing French music?


What percent of the wine purchased from French music-playing stores was French?


What percent of the wine purchased from French music-playing stores was French?


Conditional distribution

Asks about both variables

Given one variable

Use values inside table and margins


Hypothesis Testing


  • H0

Null Hypothesis

  • Ha

Alternative Hypothesis


  • H0

Half of the deck is black

  • Ha

Half of the deck is notblack


  • Possible Outcomes

    • Reject H0

    • Fail to reject H0

  • Never

    • Prove

    • Accept


Standard: α = 0.05


Chi-square hypothesis tests

H0: There is NO association between music and wine in the population.

Ha: There is an association between music and wine in the population.


Observed Data vs. Expected Data


Have: Observed Counts

Want: Expected Counts if Music and Wine were Independent


Expected counts


Expected Counts


Expected Counts


Expected Counts vs Observed Counts


Chi-square test statistic


Partial Chi-Square values


Chi-Square Value

χ2 = 0.52 + 2.31 + 0.52 + 0.0084 + 7.70 + 6.44 + 0.39 + 0.00029 + 0.43

χ2 = 18.31


Chi-Square Table


Degrees of Freedom

DF = (r-1)(c-1)

r = 3

c = 3

DF= (3-1)*(3-1)= 2x2 =4


Chi-Square Table

Test statistic = 9.49


Test Statistic

If table value < χ2 then reject H0

If table value > χ2 then fail to reject H0


Chi-square hypothesis tests

X2 = 18.31 > 9.49

Reject H0.

We have evidence there is an association between music and wine in the population.


Is table value < χ2

Yes

No

reject H0

Fail to reject H0

We have evidence Ha

We do not have evidence Ha


When is chi-square test appropriate?


Tables larger than 2x2:

  • the smallest expected count ≥ 1

  • <20% of cells have expected counts < 5.

    2x2 tables:

  • all 4 expected cell counts ≥ 5


Psychological and social factors can influence the survival of patients with serious diseases. One study examined the relationship between survival of patients with coronary heart disease and pet ownership. Each of 92 patients was classified as having a pet or not and by whether they survived for one year. The researchers suspect that having a pet might be connected to the patient status.


Pet ownership and heart disease data (counts)


Assuming a patient is still alive, what is the probability he owns a pet?


Assuming a patient is still alive, what is the probability he owns a pet?


What is the probability a patient is still alive and owns a pet? (J,M,C)


What is the probability a patient is still alive and owns a pet? (J,M,C)


What is the probability a patient owns a pet?

(J,M,C)


What is the probability a patient owns a pet?

(J,M,C)


Steps for ALL Chi-Square Tests

Write Hypothesis

Find Expected Counts (check if test is appropriate)

Find value by adding all partial chi-square values

Find DF

Find “test statistic” (table value use )

Write Conclusion


Chi-square test for pet ownership and patient status

H0: There is NO association between pet ownership

and patient status in the population.

Ha: There is an association between pet ownership and patient status in the population.


Expected Counts


Partial Chi-Square Values

χ2 = 0.786 + 0.579 + 4.408 + 3.211

χ2 = 8.984


df = (2-1)(2-1) = 1

Critical value from table for α = 0.05 is 3.84.

Since 8.984 > 3.84, we can reject H0and conclude that we have evidence that owning a pet and survival are not independent.


M&Ms and Two-way Tables


Full-class M&Ms data in counts(large sample size necessary for test)


  • Login