Introduction to Statistics (MAT/SST 115.03 2008S)

R notes for Activity 25-3: Got a Tip?

We start by creating the table.

CardTips = data.frame(row.names=c("Tip","No Tip"),
  Joke = c(30,42),
  Ad = c(14,60),
  None = c(16,49))

Then we use the chi-square test.


To help ourselves think about the meaning, we build a table of expected values.

ExpectedTips = rowSums(CardTips) %o% colSums(CardTips)/sum(CardTips)

We then compare that table to our original table. (Do you notice anything interesting about the columns?)

CardTips - ExpectedTips

We then see what contributed to the high chi-square value.


Creative Commons License

Samuel A. Rebelsky,

Copyright (c) 2007-8 Samuel A. Rebelsky.

This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.