Fall 2002Biostat 511299 Inference for two-way tables General R x C tables Tests of homogeneity of a factor across groups or independence of two factors.

Slides:



Advertisements
Similar presentations
Contingency Tables Prepared by Yu-Fen Li.
Advertisements

Comparing Two Proportions (p1 vs. p2)
1 Contingency Tables: Tests for independence and homogeneity (§10.5) How to test hypotheses of independence (association) and homogeneity (similarity)
Chapter 13: Inference for Distributions of Categorical Data
Categorical Data. To identify any association between two categorical data. Example: 1,073 subjects of both genders were recruited for a study where the.
Analysis of frequency counts with Chi square
Copyright ©2011 Brooks/Cole, Cengage Learning More about Inference for Categorical Variables Chapter 15 1.
Copyright ©2006 Brooks/Cole, a division of Thomson Learning, Inc. More About Categorical Variables Chapter 15.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 25, Slide 1 Chapter 25 Comparing Counts.
CHAPTER 11 Inference for Distributions of Categorical Data
EPIDEMIOLOGY AND BIOSTATISTICS DEPT Esimating Population Value with Hypothesis Testing.
ChiSq Tests: 1 Chi-Square Tests of Association and Homogeneity.
EPI 809 / Spring 2008 Final Review EPI 809 / Spring 2008 Ch11 Regression and correlation  Linear regression Model, interpretation. Model, interpretation.
Chapter Goals After completing this chapter, you should be able to:
Statistics 303 Chapter 9 Two-Way Tables. Relationships Between Two Categorical Variables Relationships between two categorical variables –Depending on.
Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 14 Goodness-of-Fit Tests and Categorical Data Analysis.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Statistics for Business and Economics 7 th Edition Chapter 9 Hypothesis Testing: Single.
Previous Lecture: Analysis of Variance
Inferences About Process Quality
Statistics for Managers Using Microsoft® Excel 5th Edition
Review for Exam 2 Some important themes from Chapters 6-9 Chap. 6. Significance Tests Chap. 7: Comparing Two Groups Chap. 8: Contingency Tables (Categorical.
Presentation 12 Chi-Square test.
The Chi-Square Test Used when both outcome and exposure variables are binary (dichotomous) or even multichotomous Allows the researcher to calculate a.
AS 737 Categorical Data Analysis For Multivariate
Analysis of Categorical Data
September 15. In Chapter 18: 18.1 Types of Samples 18.2 Naturalistic and Cohort Samples 18.3 Chi-Square Test of Association 18.4 Test for Trend 18.5 Case-Control.
CHP400: Community Health Program - lI Research Methodology. Data analysis Hypothesis testing Statistical Inference test t-test and 22 Test of Significance.
Amsterdam Rehabilitation Research Center | Reade Testing significance - categorical data Martin van der Esch, PhD.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 26 Comparing Counts.
Copyright © 2010 Pearson Education, Inc. Warm Up- Good Morning! If all the values of a data set are the same, all of the following must equal zero except.
Chapter 11: Applications of Chi-Square. Count or Frequency Data Many problems for which the data is categorized and the results shown by way of counts.
Chapter 11: Applications of Chi-Square. Chapter Goals Investigate two tests: multinomial experiment, and the contingency table. Compare experimental results.
Dr.Shaikh Shaffi Ahamed Ph.D., Dept. of Family & Community Medicine
A Course In Business Statistics 4th © 2006 Prentice-Hall, Inc. Chap 9-1 A Course In Business Statistics 4 th Edition Chapter 9 Estimation and Hypothesis.
Contingency tables Brian Healy, PhD. Types of analysis-independent samples OutcomeExplanatoryAnalysis ContinuousDichotomous t-test, Wilcoxon test ContinuousCategorical.
Chi-Square Procedures Chi-Square Test for Goodness of Fit, Independence of Variables, and Homogeneity of Proportions.
Introduction Many experiments result in measurements that are qualitative or categorical rather than quantitative. Humans classified by ethnic origin Hair.
The binomial applied: absolute and relative risks, chi-square.
CHAPTER 11 SECTION 2 Inference for Relationships.
Analysis of Qualitative Data Dr Azmi Mohd Tamil Dept of Community Health Universiti Kebangsaan Malaysia FK6163.
+ Chi Square Test Homogeneity or Independence( Association)
© Copyright McGraw-Hill 2000
6.1 - One Sample One Sample  Mean μ, Variance σ 2, Proportion π Two Samples Two Samples  Means, Variances, Proportions μ 1 vs. μ 2.
Copyright © 2010 Pearson Education, Inc. Slide
Fall 2002Biostat Statistical Inference - Confidence Intervals General (1 -  ) Confidence Intervals: a random interval that will include a fixed.
1 Chapter 11: Analyzing the Association Between Categorical Variables Section 11.1: What is Independence and What is Association?
Chap 8-1 Fundamentals of Hypothesis Testing: One-Sample Tests.
N318b Winter 2002 Nursing Statistics Specific statistical tests Chi-square (  2 ) Lecture 7.
Copyright © Cengage Learning. All rights reserved. Chi-Square and F Distributions 10.
Copyright © 2010 Pearson Education, Inc. Warm Up- Good Morning! If all the values of a data set are the same, all of the following must equal zero except.
1 G Lect 7a G Lecture 7a Comparing proportions from independent samples Analysis of matched samples Small samples and 2  2 Tables Strength.
More Contingency Tables & Paired Categorical Data Lecture 8.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc. Chapter 10 Comparing Two Groups Section 10.1 Categorical Response: Comparing Two Proportions.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc. Chapter 11 Analyzing the Association Between Categorical Variables Section 11.2 Testing Categorical.
Lecture PowerPoint Slides Basic Practice of Statistics 7 th Edition.
Comparing Counts Chapter 26. Goodness-of-Fit A test of whether the distribution of counts in one categorical variable matches the distribution predicted.
THE CHI-SQUARE TEST BACKGROUND AND NEED OF THE TEST Data collected in the field of medicine is often qualitative. --- For example, the presence or absence.
Categorical Data Analysis
The Practice of Statistics, 5th Edition Starnes, Tabor, Yates, Moore Bedford Freeman Worth Publishers CHAPTER 11 Inference for Distributions of Categorical.
Introduction to Biostatistics, Harvard Extension School, Fall, 2005 © Scott Evans, Ph.D.1 Contingency Tables.
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall Statistics for Business and Economics 8 th Edition Chapter 9 Hypothesis Testing: Single.
Chapter 11: Categorical Data n Chi-square goodness of fit test allows us to examine a single distribution of a categorical variable in a population. n.
Lecture8 Test forcomparison of proportion
The binomial applied: absolute and relative risks, chi-square
Review for Exam 2 Some important themes from Chapters 6-9
AP Stats Check In Where we’ve been… Chapter 7…Chapter 8…
Hypothesis testing. Chi-square test
Chapter 10 Analyzing the Association Between Categorical Variables
STAT 312 Introduction Z-Tests and Confidence Intervals for a
Analyzing the Association Between Categorical Variables
Presentation transcript:

Fall 2002Biostat Inference for two-way tables General R x C tables Tests of homogeneity of a factor across groups or independence of two factors rely on Pearson’s X 2 statistic. X 2 is compared to a   ((r-1)x(c-1)) distribution Expected cell counts should be larger than 5. 2 x 2 tables Cohort (prospective) data (H 0 : relative risk for incidence = 1) Case-control (retrospective) data (H 0 : odds ratio = 1) Cross-sectional data (H 0 : relative risk for prevalence = 1) Paired binary data – McNemar’s test (H 0 : odds ratio = 1) For rare disease OR  RR Fisher’s exact test

Fall 2002Biostat Categorical Data Types of Categorical Data Nominal Ordinal Often we wish to assess whether two factors are related. To do so we construct an R x C table that cross-classifies the observations according to the two factors. Such a table is called a contingency table. We can test whether the factors are “related” using a  2 test. We will consider the special case of 2 x 2 tables in detail.

Fall 2002Biostat Categorical Data 1)We sample members of 2 (or more) groups (e.g. lung cancer vs control) and classify each member according to some qualitative characteristic (e.g. cigarette smoking). The hypothesis is H 0 : groups are homogeneous (p 1j =p 2j for all j) H A : groups are not homogeneous Contingency tables arise from two different, but related, situations:

Fall 2002Biostat )We sample members of a population and cross-classify each member according to two qualitative characteristics (e.g. willingness to participate in vaccine study vs education level). The hypothesis is H 0 : factors are independent (p ij =p i. p.j ) H A : factors are not independent Categorical Data Contingency tables arise from two different, but related, situations:

Fall 2002Biostat Categorical Data Example 1. Education versus willingness to participate in a study of a vaccine to prevent HIV infection if the study was to start tomorrow. Counts, row percents and row totals are given.

Fall 2002Biostat Categorical Data Example 2. From the 1984 General Social Survey

Fall 2002Biostat Categorical Data Example 3: From Doll and Hill (1952) - retrospective assessment of smoking frequency. The table displays the daily average number of cigarettes for lung cancer patients and control patients.

Fall 2002Biostat Test of Homogeneity In example 3 we want to test whether the smoking frequency is the same for each of the populations sampled. We want to test whether the groups are homogeneous with respect to a characteristic. The concept is similar to a t-test, but the response is categorical. H 0 : smoking frequency same in both groups H A : smoking frequency not the same Q: What does H 0 predict we would observe if all we knew were the marginal totals?

Fall 2002Biostat Test of Homogeneity A: H 0 predicts the following expectations: Each group has the same proportion in each cell as the overall marginal proportion. The “equal” expected number for each group is the result of the equal sample size in each group (what would change if there were half as many cases as controls?)

Fall 2002Biostat Test of Homogeneity Recall, we often use the Poisson distribution to model counts. Suppose the observed counts in each cell, O ij, are Poisson random variables with means  ij. Then would be approximately normal. It turns out that Z 2 has a known distribution … it follows a “chi-squared (  2 ) distribution with 1 degree of freedom” (MM table F). Further, the sum of squared independent standard normal random variables follows a chi-square distribution with n degrees of freedom. Let Z i be standard normals, N(0,1) and let X has a  2 (n) distribution

Fall 2002Biostat Therefore, We don’t know the  ij, but, under H 0, we can estimate them based on the margins. We call these the expected counts, E ij. Summing the differences between the observed and expected counts provides an overall assessment of H 0. X 2 is known as the Pearson’s Chi-square Statistic. Test of Homogeneity

Fall 2002Biostat Test of Homogeneity In example 3 the contributions to the X 2 statistic are: Looking in MM table F, we find that = Conclusion?

Fall 2002Biostat Test of Independence The Chi-squared Test of Independence is mechanically the same as the test for homogeneity. The only difference is that the R x C table is formed based on the levels of 2 factors that are cross-classified. Therefore, the null and alternative hypotheses are different: H 0 : The two factors are independent H A : The two factors are not independent Independence implies that each row has the same relative frequencies (or each column has the same relative frequency). Example 1 is a situation where individuals are classified according to two factors. In this example, the assumption of independence implies that willingness to participate doesn’t depend on the level of education.

Fall 2002Biostat Q: Based on the observed row proportions, how does the independence hypothesis look? Q: How would the expected cell frequencies be calculated? Q: How many degrees of freedom would the chi-square have?

Fall 2002Biostat The expected counts under independence are... X 2 = df p <.0001

Fall 2002Biostat Summary    Tests for R x C Tables 1.Tests of homogeneity of a factor across groups or independence of two factors rely on Pearson’s X 2 statistic. 2. X 2 is compared to a   ((r-1)x(c-1)) distribution (MM, table F or display chiprob(df,X 2 ) ). 3.Expected cell counts should be larger than We have considered a global test without using possible factor ordering. Ordered factors permit a test for trend (see Agresti, 1990).

Fall 2002Biostat x 2 Tables Example 1: Pauling (1971) Patients are randomized to either receive Vitamin C or placebo. Patients are followed- up to ascertain the development of a cold. Q: Is treatment with Vitamin C associated with a reduced probability of getting a cold? Q: If Vitamin C is associated with reducing colds, then what is the magnitude of the effect?

Fall 2002Biostat x 2 Tables Example 2: Keller (AJPH, 1965) Patients with (cases) and without (controls) oral cancer were surveyed regarding their smoking frequency (this table collapses over the smoking frequency categories). Q: Is oral cancer associated with smoking? Q: If smoking is associated with oral cancer, then what is the magnitude of the risk?

Fall 2002Biostat x 2 Tables Example 3: Norusis (1988) In 1984, a random sample of US adults were cross-classified based on their income and reported job satisfaction: Q: Is salary associated with job satisfaction? Q: If salary is associated with satisfaction, then what is the magnitude of the effect?

Fall 2002Biostat x 2 Tables Example 4: HIVNET (1995) Subjects were surveyed regarding their knowledge of vaccine trial concepts both at baseline and at month 3 after an informed consent process. The following table shows the subjects cross-classified according to the two responses. Q: Did the informed consent process improve knowledge? Q: If informed consent improved knowledge then what is the magnitude of the effect?

Fall 2002Biostat x 2 Tables Each of these tables can be represented as follows: The question of association can be addressed with Pearson’s X 2 (except for example 4) We compute the expected cell counts as follows: Expected:

Fall 2002Biostat Pearson’s chi-square is given by: Q: How does this X 2 test compare in Example 1 to simply using the 2 sample binomial test of 2 x 2 Tables

Fall 2002Biostat Example 1: Pauling (1971) H 0 : probability of disease does not depend on treatment H A : probability of disease does depend on treatment 2 x 2 Tables For the p-value we compute P(  2 (1) > 4.81) = Therefore, we reject the independence of treatment and disease.

Fall 2002Biostat Two sample test of binomial proportions: p 1 = P(cold | Vitamin C) p 2 = P(cold | placebo) H 0 : p 1 = p 2 H A : p 1  p 2 For the 2-sided p-value we compute 2  P(| Z | > 2.193) = Therefore, we reject H 0 with the exact same result as the  2 test. (Z 2 = X 2 )

Fall 2002Biostat Example 1 fixed the number of E and not E, then evaluated the disease status after a fixed period of time. This is a prospective study. Given this design we can estimate the relative risk: The range of RR is [0,  ). By taking the logarithm, we have (- , +  ) as the range for ln(RR) and a better approximation to normality for the estimated ln 2 x 2 Tables Applications In Epidemiology

Fall 2002Biostat The estimated relative risk is: We can obtain a confidence interval for the relative risk by first obtaining a confidence interval for the log- RR: For Example 1, a 95% confidence interval for the log relative risk is given by:

Fall 2002Biostat ± 1.96 × ± (-1.116, ) To obtain a 95% confidence interval for the relative risk we exponentiate the end-points of the interval for the log - relative risk. Therefore, ( exp(-1.116), exp(-0.050)) (.33,.95 ) is a 95% confidence interval for the relative risk.

Fall 2002Biostat x 2 Tables Applications In Epidemiology In Example 2 we fixed the number of cases and controls then ascertained exposure status. Such a design is known as case- control study. Based on this we are able to directly estimate: However, we generally are interested in the relative risk which is not estimable from these data alone - we’ve fixed the number of diseased and diseased free subjects. Instead of the relative risk we can estimate the exposure odds ratio which Cornfield (1951) showed equivalent to the disease odds ratio:

Fall 2002Biostat Odds Ratio Furthermore, for rare diseases, P(D | E)  0 so that the disease odds ratio approximates the relative risk: Since with case-control data we are able to effectively estimate the exposure odds ratio we are then able to equivalently estimate the disease odds ratio which for rare diseases approximates the relative risk.

Fall 2002Biostat Like the relative risk, the odds ratio has [0,  ) as its range. The log odds ratio has (- , +  ) as its range and the normal approximation is better as an approximation to the estimated log odds ratio. Confidence intervals are based upon: Therefore, a (1 -  ) confidence interval for the log odds ratio is given by: 2 x 2 Tables Applications in Epidemiology

Fall 2002Biostat Example 2: The estimated odds ratio (odds of cancer for smokers relative to the odds of cancer for non- smokers) is given by: A 95% confidence interval for the log odds ratio is given by:

Fall 2002Biostat To obtain a 95% confidence interval for the odds ratio we simply exponentiate the end-points of the interval for the log odds ratio. Therefore, ( exp(0.983), exp(1.883) ) or ( 2.672, ) is a 95% confidence interval for the odds ratio.

Fall 2002Biostat x 2 Tables Applications in Epidemiology Example 3 is an example of a cross-sectional study since only the total for the table is fixed in advance. The row totals or column totals are not fixed in advance. In epidemiological studies, the relative risk or odds ratio may be used to summarize the association when using a X-sectional design. The major distinction from a prospective study is that a cross- sectional study will reveal the number of cases currently in the sample. These are known as prevalent cases. In a prospective study we count the number of new cases, or incident cases.

Fall 2002Biostat Paired Binary Data Example 4 measured a binary response pre and post treatment. This is an example of paired binary data. One way to display these data is the following: Q: Can’t we simply use X 2 Test of Homogeneity to assess whether this is evidence for an increase in knowledge? A: NO!!! The X 2 tests assume that the rows are independent samples. In this design it is the same 595 people at Baseline and at 3 months.

Fall 2002Biostat Paired Binary Data For paired binary data we display the results as follows: This analysis explicitly recognizes the heterogeneity of subjects. Thus, those that score (0,0) and (1,1) provide no information about the effectiveness of the treatment since they may be “weak” or “strong” individuals. These are known as the concordant pairs. The information regarding treatment is in the discordant pairs, (0,1) and (1,0). p 1 = success probability at Time 1 p 2 = success probability at Time 2 H 0 : p 1 = p 2 H A : p 1  p 2

Fall 2002Biostat Under the null hypothesis, H 0 : p 1 = p 2, we expect equal numbers to change from 0 to 1 and from 1 to 0 (E[n 01 ] = E[n 10 ]). Specifically, under the null: Under H 0, Z 2 ~  2 (1), and forms the basis for McNemar’s Test for Paired Binary Responses. The odds ratio comparing the odds of success at Time 2 to Time 1 is estimated by: Confidence intervals can be obtained as described in Breslow and Day (1981), section 5.2, or in Armitage and Berry (1987), chapter 16. Paired Binary Data McNemar’s Test

Fall 2002Biostat Paired Binary Data A common epidemiological design is to match cases and controls regarding certain factors (e.g. age, gender…) then ascertain the exposure history (e.g. smoking) for each member of the pair. The results for all pairs can be summarized by: Given this design we can use McNemar’s Test to test the hypotheses H 0 : (OR = 1) H A : (OR  1)

Fall 2002Biostat Example 4: We can test H 0 : p 1 = p 2 using McNemar’s Test: Comparing to a  2 (1) we find that p < Therefore we reject the null hypothesis of equal success probabilities for Time 1 and Time 2. We estimate the odds ratio as

Fall 2002Biostat Summary for 2 x 2 Tables Cohort Analysis (Prospective) 1. H 0 : 2. RR for incident disease 3.  2 test Case Control Analysis (Retrospective) 1. H 0 : 2. OR (  RR for rare disease) 3.  2 test Cross-sectional Analysis 1. H 0 : 2. RR for prevalent disease 3.  2 test Paired Binary Data 1. H 0 : 2. OR 3. McNemar’s test

Fall 2002Biostat Fisher’s Exact Test Motivation: When a 2  2 table contains cells that have fewer than 5 expected observations, the normal approximation to the distribution of the log odds ratio (or other summary statistics) is known to be poor. This can lead to incorrect inference since the p-values based on this approximation are not valid. Solution: Use Fisher’s Exact Test

Fall 2002Biostat Fisher’s Exact Test Example: (Rosner, p. 370) Cardiovascular disease. A retrospective study is done among men aged who died over a 1-month period. The investigators tried to include equal numbers of men who died from CVD and those that did not. Then, asking a close relative, the dietary habits were ascertained. A calculation of the odds ratio yields: Interpret.

Fall 2002Biostat If we fix all of the margins then any one cell of the table will allow the remaining cells to be filled. Note that a must be greater than 0, less than both n 1 and m 1, and an integer. Thus there are only a relatively few number of possible table configurations if either n 1 or m 1 is small (with n 1, n 2, m 1, m 2 fixed). Under the null hypothesis, H 0 : OR = 1 we can use the hypergeometric distribution (a probability distribution for discrete rv’s) to compute the probability of any given configuration. Since we have the distribution of a statistic (a) under the null, we can use this to compute p-values. Fisher’s Exact Test

Fall 2002Biostat Example: (Rosner, p. 370) Cardiovascular disease. Possible Tables: Fisher’s Exact Test

Fall 2002Biostat Fisher’s Exact Test Using the hypergeometric distribution we can compute the exact probability of each of these tables (under H 0 : p 1 = p 2 ) (Rosner pg. 370) To compute a p-value we then use the usual approach of summing the probability of all events (tables) as extreme or more extreme than the observed data. For a one tailed test of p 1 p 2 ) we sum the probabilities of all tables with a less than or equal to (greater than or equal to) the observed a. For a two-tailed test of p 1 = p 2 we compute the two one-tailed p-values and double the smaller of the two. You will never do this by hand ….

Fall 2002Biostat Categorical data -summary  2 test for R x C table 2 x 2 ? 2 x k ? NoYes NoYes Samples independent? McNemar’s test NoYes Test for trend in proportions? No Yes Expected > 5? Fisher’s exact test No Yes No  2 test Exact test Expected > 5? Yes  2 test for trend 2 sample Z test for proportions or  2 test