Unit 2: Comparing Two Groups

69
Unit 2: Comparing Two Groups In Unit 1, we learned the basic process of statistical inference using tests and confidence intervals. We did all this by focusing on a single proportion. In Unit 2, we will take these ideas and extend them to comparing two groups. We will compare two proportions, two independent means, and paired data.

description

Unit 2: Comparing Two Groups. In Unit 1, we learned the basic process of statistical inference using tests and confidence intervals. We did all this by focusing on a single proportion. - PowerPoint PPT Presentation

Transcript of Unit 2: Comparing Two Groups

PowerPoint Presentation

Unit 2: Comparing Two GroupsIn Unit 1, we learned the basic process of statistical inference using tests and confidence intervals. We did all this by focusing on a single proportion.In Unit 2, we will take these ideas and extend them to comparing two groups. We will compare two proportions, two independent means, and paired data.Chapter 5:Comparing Two Proportions5.1: Descriptive (Two-Way Tables)5.2: Inference with Simulation-Based Methods5.3: Inference with Theory-Based MethodsPositive and Negative PerceptionsConsider these two questions:Are you having a good year?Are you having a bad year?

Do people answer each question in such a way that would indicated the same answer? (e.g. Yes for the first one and No for the second.)Researchers questioned 30 students (randomly giving them one of the two questions).They then recorded if a positive or negative response was given.Is this an observational study or randomized experiment?

Positive and Negative PerceptionsObservational unitsThe 30 students VariablesQuestion wording (good year or bad year)Perception of their year (positive or negative)Which is the explanatory and which is the response?Positive and Negative PerceptionsIndividualType of QuestionResponseIndividualType of QuestionResponse1Good YearPositive16Good YearPositive2Good YearNegative17Bad YearPositive3Bad YearPositive18Good YearPositive4Good YearPositive19Good YearPositive5Good YearNegative20Good YearPositive6Bad YearPositive21Bad YearNegative7Good YearPositive22Good YearPositive8Good YearPositive23Bad YearNegative9Good YearPositive24Good YearPositive10Bad YearNegative25Bad YearNegative11Good YearNegative26Good YearPositive12Bad YearNegative27Bad YearNegative13Good YearPositive28Good YearPositive14Bad YearNegative29Bad YearPositive15Good YearPositive30Bad YearNegativeRaw Data in a SpreadsheetA two-way table organizes data Summarizes two categorical variables Also called contingency table Are students more likely to give a positive response if they were given the good year question?

Two-Way TablesGood YearBad YearTotalPositive response15419Negative response3811Total181230Conditional proportions will help us better determine if there is an association between the question asked and the type of response.We can see that those given the positive question were more likely to respond positively.Two-Way TablesGood YearBad YearTotalPositive response15/18 0.834/12 0.33 19Negative response3811Total181230We can use segmented bar graphs to see this association.Remember that variables are associated if the conditional proportion of the outcomes for one group differ from the conditional proportion of outcomes in other groups.

Segmented Bar Graphs

Those responding to the good year question were more likely to answer positively (83% to 33%) than those responding positively to the bad year question. The statistic we will be using to measure this is the difference in proportions.0.83 - 0.33 = 0.50 higher for the good year question than the bad year question.

PerceptionsIn the next section we will conduct tests of significance to compare two proportions and I want to give you a preview of that here. We will assume there is no association between the variables (i.e. the two population proportions are the same) and decide if two sample proportions differ enough to conclude this would be very unlikely just by random chance.

A Sneak Peak at Comparing Two Proportions: Simulation-Based ApproachHypothesesNull Hypothesis: There is no association between which question is asked and the type of response. (The proportion of positive responses will be the same in each group. ) Alternative Hypothesis: There is an association between which question is asked and the type of response. (The proportion of positive responses will be different in each group. )

ResultsGood YearBad YearTotalPositive response15 (83%)4 (33%)19Negative response3811Total181230The difference in proportions of positive responses is 0.83 0.33 = 0.50.How likely is a difference this great or greater if the type of question asked made no difference in how the student would respond?Random ReassignmentNotice that 19 students gave a positive response. If the null hypothesis is true, these 19 would have given a positive response no matter which question was asked.Therefore, under a true null hypothesis, we can randomly place these 19 people into either group and they will still give a positive response. This replicates the random assignment that was done in the experiment. We will also keep constant the 18 that receive the positive question and 12 that receive the negative question.Good YearBad YearTotalPositive responserandomrandom19Negative responserandomrandom11Total181230You can think about this random reassignment with the raw data as well. It doesnt matter which question was asked, the responses will be the same. Therefore, we can shuffle the type of question and leave the responses fixed. This is equivalent to keeping the same column and row totals and just shuffling the inside of the two-way table as described earlier.IndividualType of QuestionResponseIndividualType of QuestionResponse1Good YearPositive16Good YearPositive2Good YearNegative17Bad YearPositive3Bad YearPositive18Good YearPositive4Good YearPositive19Good YearPositive5Good YearNegative20Good YearPositive6Bad YearPositive21Bad YearNegative7Good YearPositive22Good YearPositive8Good YearPositive23Bad YearNegative9Good YearPositive24Good YearPositive10Bad YearNegative25Bad YearNegative11Good YearNegative26Good YearPositive12Bad YearNegative27Bad YearNegative13Good YearPositive28Good YearPositive14Bad YearNegative29Bad YearPositive15Good YearPositive30Bad YearNegativeRandom ReassignmentI did this once and found a difference in the proportions of positive responses for the two questions of 0.50 0.83 = 0.33Good YearBad YearTotalPositive response9 (50%)10 (83%)19Negative response9211Total181230Random ReassignmentI did this again and found a difference in the proportions of positive responses for the two questions of 0.61 0.67 = 0.06Good YearBad YearTotalPositive response11 (61%)8 (67%)19Negative response7411Total181230Random ReassignmentI did this again and found a difference in the proportions of positive responses for the two questions of 0.67 0.58 = 0.09Good YearBad YearTotalPositive response12 (67%)7 (58%)19Negative response6511Total181230Random ReassignmentIn my three randomizations, I have yet to see a difference in proportions that is as far away from zero as the observed difference of 0.5.Lets do some more randomizations to develop a null distribution.

Random ReassignmentAfter 1000 randomizations, only 7 were as far away from zero as our observed proportion.

ConclusionSince we have a p-value of 7/1000 or 0.007, we can conclude the alternative hypothesis and say we have strong evidence that how the question is phrased affects the response.21AppletsLets look at how this is done in two applets Simulation for Two ProportionsSimulation for Multiple Proportions

Exploration 5.1: Murderous Nurse?

Example 5.2: Swimming With Dolphins

Is swimming with dolphins therapeutic for patients suffering from clinical depression?Researchers recruited 30 subjects aged 18-65 with a clinical diagnosis of mild to moderate depression. Discontinued antidepressants and psychotherapy 4 weeks prior to and throughout the experiment30 subjects went to an island near HondurasRandomly assigned to two treatment groupsSwimming with DolphinsBoth groups engaged in one hour of swimming and snorkeling each day. One group swam in the presence of dolphins and the other group did not.Participants in both groups had identical conditions except for the dolphinsAfter 2 weeks, each subjects level of depression was evaluated, as it had been at the beginning of the study The response variable is if the subject achieved substantial reduction in depression.

Swimming with DolphinsObservational units The 30 subjects with mild to moderate depression.Explanatory variableSwimming with dolphins or notResponse variableReduction in depression or notAre the variables quantitative or categorical? Swimming with DolphinsIs this study an observational study or an experiment? Are the subjects in this study a random sample from a larger population?Swimming with DolphinsResultsSwimming with DolphinsDolphingroupControl groupTotalImproved10 (67%)3 (20%)13Did Not Improve51217Total151530

The difference in proportions of improvers is 0.67 0.20 = 0.47.There are two possible explanations for an observed difference of 0.47.A tendency to be more likely to improve with dolphinsThe 13 subjects were going to show improvement with or without dolphins and random chance assigned more improvers to the dolphinsSwimming with DolphinsNull hypothesis: Dolphins dont helpSwimming with dolphins is not associated with substantial improvement in depressionAlternative hypothesis: Dolphins helpSwimming with dolphins increases the probability of substantial improvement in depression symptoms

Swimming with DolphinsSwimming with DolphinsNull Hypothesis: The probability someone exhibits substantial improvement after swimming with dolphins is the same as the probability someone exhibits substantial improvement after swimming without dolphins.Alternative Hypothesis: The probability someone exhibits substantial improvement after swimming with dolphins is higher than the probability someone exhibits substantial improvement after swimming without dolphins.

Swimming with DolphinsSwimming with DolphinsIf the null hypothesis is true (dolphin therapy is not better) we would have 13 improvers and 17 non-improvers regardless of the group they were in. Any differences we see between groups arise solely from the randomness in the assignment to the groups.

Swimming with DolphinsWe can perform this simulation with cards. 13 black cards represent the improvers 17 red cards represent the non-improversWe assume these outcomes would happen no matter which treatment group subjects were in. Shuffle the cards and put 15 in one pile (dolphin therapy) and 15 in another (control group)An improver is equally likely to be assigned to each groupSwimming with DolphinsIn the actual study, there were 10 improvers (diff of 0.47) in the dolphin group.We conducted 3 simulations and got 8, 5, and 6 improvers in the dolphin therapy group. (notice the diff in proportions)

Swimming with Dolphins

We did 1000 repetitions to develop a null distribution. Why is it centered at about 0?What does each dot represent?Swimming with Dolphins

Swimming with DolphinsA 95% confidence interval for the difference in the probability using the standard deviation from the null distribution is 0.467 + 2(0.178) = 0.467 + 0.356 or (0.111to 0.823)We are 95% confident that when allowed to swim with dolphins, the probability of improving is between 0.111 and 0.823 higher than when no dolphins are present. How does this interval back up our conclusion from the test of significance?

Swimming with DolphinsCan we say that the presence of dolphins caused this improvement? Since this was a randomized experiment, and assuming everything was identical between the groups, we have strong evidence that dolphins were the cause Can we generalize to a larger population?Maybe mild to moderately depressed 18-65 year old patients willing to volunteer for this studyWe have no evidence that random selection was used to find the 30 subjects.

Swimming with DolphinsExploration 5.2: Contagious Yawns?MythBusters investigated this. 50 subjects were ushered into a small room by co-host Kari. She yawned as she ushered 34 in the room and for 16 she didnt yawn. We will assume she randomly decided who would received the yawns.

Comparing Two Proportions: Theory-Based ApproachSection 5.3Introduction

Just as with a single proportion, we can often predict results of a simulation using a theory-based approach. The theory-based approach also gives a simpler way to generate a confidence intervals.

Smoking and Birth Gender

Smoking and GenderHow does parents behavior affect the sex of their children?Fukuda et al., 2002 (Japan) found the following: 255 of 565 births (45.1%) where both parents smoked more than a pack a day were boys. 1975 of 3602 births (54.8%) where both parents did not smoke were boys.Other studies have shown a reduced male to female birth ratio where high concentrations of other environmental chemicals are present (e.g. industrial pollution, pesticides)

Smoking and GenderA segmented bar graph and 2-way tableLets compare the proportions to see if the difference is statistically significantly.

Smoking and GenderSmoking and GenderWhat are the observational units in the study?What are the variables in this study?Which variable should be considered the explanatory variable and which the response variable? Can you draw cause-and-effect conclusions for this study? Smoking and GenderOK to shuffle?In the last section we re-randomized subjects to treatment groups to simulate the null distribution.In this study the parents werent randomized to the treatment, since its observational, but we can still represent the null hypothesis of no association through randomization. Smoking and GenderUse the 3S Strategy to asses the strength1. Statistic: The proportion of boys born to nonsmokers minus boys born to smokers is 0.548 0.451 = 0.097.Smoking and Gender2. Simulate: Use the Multiple Proportions applet to simulate Many repetitions of shuffling the 2230 boys and 1937 girls to the 565 smoking and 3602 nonsmoking parentsCalculate the difference in proportions of boys between the groups for each repetition. Shuffling simulates the null hypothesis of no associationSmoking and Gender3. Strength of evidence: Nothing as extreme as our observed statistic ( 0.097 or 0.097) occurred in 5000 repetitions, How many SDs is 0.097 above the mean?

Smoking and GenderNotice the null distribution is centered at zero and is bell-shaped. This, along with its standard deviation can be predicted using normal distributions.

Smoking and GenderWe can use either the Multiple Proportion applet or the Theory-Based Inference applet to find the p-value

Smoking and GenderSmoking and GenderFrom our test of significance, do we expect 0 to be in the interval of plausible values for the difference in the population proportions?

Smoking and GenderAgain, either applet can be used to determine a confidence interval.

We are 95% confident that the probability of a boy baby is 0.053 to 0.141 higher for families where neither parent smokes compared to families with two smoking parents

Smoking and GenderWe can also write the confidence interval in the form: statistic margin of error. Our statistic is the observed sample difference in proportions, 0.097. We can find the margin of error by subtracting the statistic (center) from the upper endpoint or 0.141 0.097 = 0.044. 0.097 0.044 Is the margin of error about the standard deviation?Smoking and GenderHow would the interval change if the confidence level was 99%?

Smoking and GenderWritten as the statistic margin of error 0.097 0.058. Margin of error 0.058 for the 99% confidence interval0.044 for the 95% confidence interval

Smoking and GenderSmoking and Gender (0.141, 0.053) or 0.097 0.044 instead of (0.053, 0.141) or 0.097 0.044

The negative signs indicate the probability of a boy born to smoking parents is lower than that for nonsmoking parents.

Smoking and GenderValidity Conditions of Theory-Based Same as with a single proportion.Should have at least 10 observations in each of the cells of the 2 x 2 table.Smoking ParentsNon-smoking ParentsTotalMale25519752230Female31016271937Total56536024167Smoking and GenderThe strong significant result in this study yielded quite a bit of press when it came outSoon other studies came out which found no relationship between smoking and genderOne article argued that confounding variables likesocial factors, diet, environmental exposure or stress were the reason for different studys results. (These are all possible since it was an observational study.)

FormulasFormulasStrength of EvidenceAs the proportions move farther away from each other, the strength of evidence increases.As sample size increases, the strength of evidence increases.

Lets run this previous test using both the Simulation-Based and the Theory-Based Applets.Donating BloodExploration 5.3Questions 1-14 (skip 2 and 5)