Introduction to Statistics (MAT/SST 115.03 2008S)
Primary: [Front Door] [Syllabus] [Current Outline] [R] - [Academic Honesty] [Instructions]
Groupings: [Applets] [Assignments] [Data] [Examples] [Handouts] [Labs] [Outlines] [Projects] [Readings] [Solutions]
External Links: [R Front Door] [SamR's Front Door]
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.
chisq.test(CardTips)
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.
(CardTips-ExpectedTips)^2/ExpectedTips
Primary: [Front Door] [Syllabus] [Current Outline] [R] - [Academic Honesty] [Instructions]
Groupings: [Applets] [Assignments] [Data] [Examples] [Handouts] [Labs] [Outlines] [Projects] [Readings] [Solutions]
External Links: [R Front Door] [SamR's Front Door]
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 http://creativecommons.org/licenses/by-nc/2.5/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.