We now study how to compare two or more populations when
the response variable has two or more categories and how to
test whether two categorical variables are independent
The methods in this chapter answer questions such as:
o Are men and women equally likely to suffer lingering
fear symptoms after watching scary movies like jaws an
poltergeist at a young age?
o Is there an association between texting while driving
and automobile accidents?
o Does political preference predict making contributions
online?
Inference for Two-Way Table
We now record counts of all the outcomes in a two-way table
r x c table – to describe a two-way table of counts with r rows
and c columns
two categorical variables e.g. gender and frequent binge
drinker
The hypothesis; no association
the null hypothesis of interest in a two-way table is, there is no
association between the row variable and the column variable
The alternative hypothesis is that there is an association
between these two variables
o We cannot describe Ha as either one-sided or two-sided
Expected cell counts
To test the null hypothesis in r x c tables, we compare the
observed cell counts with expected cell counts calculated
under the assumption that the null hypothesis is true
The expected cell count is the product of the row and column
totals divided by the table total
row total ×column total
expected cell count=
n
The chi-square test
To test the null hypothesis that there is no association
between the row and column classifications, we use statistic
that compares the entire set of observed counts with the set
of expected counts
, The chi-square statistic is a measure of how much the
observed cell counts in a two-way table diverge from the
expected cell counts.
( observed count−expected count )2
X 2= ∑
expected count
Where observed represents an observed cell count, expected
represents the expected count for the same cell, and the sum is
over all r x c cells in the table
Large values of X2 provide evidence against the null hypothesis
and indicate that the expected and observed counts are very
different
Chi-square distribution X2 – like the t distribution, the chi-square
distribution form a family described by a single parameter, the
degrees of freedom
Chi-square test for two-way tables
The null hypothesis is that there is no association between the
row an column variables in a two-way variable. The alternative
is that these variables are related.
If H0 is true, the chi-square statistic has approximately a chi-
square distribution with (r – 1)(c – 1) degrees of freedom.
The P-value for the chi-square test is: P( x2 ≥ X2 )
Where x2 is a random variable having the x2 (df) distribution
with df = (r – 1)(c – 1)
The chi-square test uses always the upper tail of the chi-
square distribution, because any deviation from the null
hypothesis makes the statistic larger
The approximation of the chi-square distribution becomes
more accurate as the cell counts increases
Confounding … !
Our data don’t allow us to investigate possible confounding
variables
o Often a randomized comparative experiment can settle
the issue of causation
The chi-square test and z test
A comparison of the proportions of successes in two
populations leads to a 2 x 2 table
Chi-square test and two-sample z test give always exactly the
same result
o Because the chi-square statistic is equal to the square of
the z statistic, and the distribution values are the same
The advantage of the z test is that we can test either one-
sided or two-sided alternatives
The chi-square test always tests the two-sided alternative
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Jana1234. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $3.23. You're not tied to anything after your purchase.