STEVENS MA 331 - Lecture 12 Notes - Analysis of Two-Way Tables

Unformatted text preview:

Lecture 12What are two-way tables?Marginal distributionsSlide Number 4Parental smokingRelationships between categorical variablesConditional distributionsSlide Number 8Music and wine purchase decisionSlide Number 10Simpson’s paradoxInference for Two-Way tables.Expected counts in two-way tablesSlide Number 14Cocaine addictionThe chi-square testSlide Number 17When is it safe to use a 2 test?Chi-square test vs. z-test for two proportionsSlide Number 20Successful firmsSuccessful firmsSlide Number 23Slide Number 24Slide Number 25Analysis of Two-Way tablesCh 9` In statistics we call categorical variables present in an experimental design: FACTORS` Each possible value of the categorical variable (factor) is called a level of the factor.` With this language a two-way table is a representation of an experiment that studies the relationship between two factors. First factor: ageGroup by ageSecond factor: educationRecord educationWe can look at each categorical variable separately in a two-way table by studying the row totals and the column totals. They represent the marginal distributions, expressed in counts or percentages (They are written as if in a margin.)2000 U.S. censusThe marginal distributions can then be displayed on separate bar graphs, typically expressed as percents instead of raw counts. Each graph represents only one of the two variables, completely ignoring the second one.Does parental smoking influence the smoking habits of their high school children?Summary two-way table:High school students were asked whether they smoke and whether their parents smoke.Marginal distribution for the categorical variable “parental smoking”: The row totals are used and re-expressed as percent of the grand total.The percents are then displayed in a bar graph.The marginal distributions summarize each categorical variable independently. But the two-way table actually describes the relationship between both categorical variables. The cells of a two-way table represent the intersection of a given level of one categorical factor with a given level of the other categorical factor. Because counts can be misleading (for instance, one level of one factor might be much less represented than the other levels), we prefer to calculate percents or proportions for the corresponding cells. These make up the conditional distributions.The counts or percents within the table represent the conditional distributions. Comparing the conditional distributions allows you to describe the “relationship” between both categorical variables.Here the percents are calculated by age range (columns).29.30% = 1107137785= cell total .column totalThe conditional distributions can be graphically compared using side by side bar graphs of one variable for each value of the other variable.Here the percents are calculated by age range (columns).We want to compare the conditional distributions of the response variable (wine purchased) for each value of the explanatory variable (music played). Therefore, we calculate column percents.What is the relationship between type of music played in supermarkets and type of wine purchased? We calculate the column conditional percents similarly for each of the nine cells in the table:Calculations: When no music was played, there were 84 bottles of wine sold. Of these, 30 were French wine. 30/84 = 0.357 Î 35.7% of the wine sold was French when no music was played. 30 = 35.7%84=cell total . column totalFor every two-way table, there are two sets of possible conditional distributions.Wine purchased for each kind of music played (column percents)Music played for each kind of wine purchased (row percents) Does background music in supermarkets influence customer purchasing decisions?An association or comparison that holds for all of several groups can reverse direction when the data are combined (aggregated) to form a single group. This reversal is called Simpson’s paradox.Hospit al A Hospit al BDied 63 16Survived 2037 784Total 2100 800% surv. 97.0% 98.0%On the surface, Hospital B would seem to have a better record.Here patient condition was the lurking variable.Patients in good condition Patients in poor conditionHospital A Hospital B Hospital A Hospital BDied 6 8 Died 57 8Survived 594 592 Survived 1443 192Total 600 600 Total 1500 200% surv. 99.0% 98.7% % surv. 96.2% 96.0%But once patient condition is taken into account, we see that hospital A has in fact a better record for both patient conditions (good and poor). Example: Hospital death rates`The main test is to check whether or not the two factors are independent or if there is a relationship between them.◦Put it differently we check if the differences in sample proportions that are observed are likely to have occurred by just chance because of the random sampling. ` To assess this we use a chi-square (χ2) test to check the null hypothesis of no relationship between the two categorical variables of a two-way table.Two-way tables sort the data according to two categorical variables. We want to test the hypothesis that there is no relationship between these two categorical variables (H0).To test this hypothesis, we compare actual counts from the sample data with expected counts given the null hypothesis of no relationship.The expected count in any cell of a two-way table when H0is true (under independence hypothesis) is:Cocaine addictionCocaine produces short-term feelings of physical and mental well being. To maintain the effect, the drug may have to be taken more frequently and at higher doses. After stopping use, users will feel tired, sleepy and depressed.The pleasurable high followed by unpleasant after-effects encourage repeated compulsive use, which can easily lead to dependency.Desipramine is an antidepressantaffecting the brain chemicals that may become unbalanced and cause depression. It was thus tested for recovery from cocaine addiction.Treatment with desipramine was compared to a standard treatment (lithium, with strong anti-manic effects) and a placebo.25*26/74 ≈ 8.7825*0.3516.2225*0.659.1426*0.3516.8625*0.658.0823*0.3514.9225*0.65DesipramineLithiumPlaceboExpected relapse countsNo Yes35% 35%35%ExpectedObservedThe chi-square statistic (χ2) is a measure of how much the observed cell counts in a two-way table diverge from the expected cell counts.The formula for the χ2statistic is:(summed over all r * ccells in the table)χ2= observed count - expected count() 2expected


View Full Document

STEVENS MA 331 - Lecture 12 Notes - Analysis of Two-Way Tables

Download Lecture 12 Notes - Analysis of Two-Way Tables
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 12 Notes - Analysis of Two-Way Tables and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 12 Notes - Analysis of Two-Way Tables 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?