Presentation is loading. Please wait.

Presentation is loading. Please wait.

Inference for Distributions of Categorical Variables

Similar presentations


Presentation on theme: "Inference for Distributions of Categorical Variables"— Presentation transcript:

1 Inference for Distributions of Categorical Variables
Chi-Square Procedures

2 Case Study… Do dogs resemble their owners?
Researchers at UCSD designed an experiment; they believed that resemblance between a dog and owner might differ for pure breeds and mixed-breed dogs Random sample of 45 dogs and their owners, photographed separately Constructed triads of pictures of one owner, the owner’s dog, and one other dog Subjects were 28 under-grad psychology students; each subject was presented with individual sets of photos and asked to ID which dog belonged to the pictured owner Dogs were classified as resembling owner if more than ½ of 28 under-grads matched dog to correct owner

3 Case Study… Do dogs resemble their owners?
Do these data provide convincing evidence of an association between dogs’ breed status and whether or not they resemble their owner? for purebreds: 16/25 = 0.64 for mixed-breed: 7/20 = 0.35

4 Do these data provide convincing evidence of an association between dogs’ breed status and whether or not they resemble their owner? You have already learned how to… calculate, graph, and compare the conditional distributions You should be able to determine if the events ‘a randomly selected dog looks like its owner’ & ‘a randomly selected dog is a purebred’ are independent for the dogs in the sample

5 Do these data provide convincing evidence of an association between dogs’ breed status and whether or not they resemble their owner? Now in this chapter, we go one step further and ask if there is convincing evidence of an association between dogs’ breed status and whether or not they resemble their owners for all dogs in the population Making an inference about the relationship between two categorical variables in a population based on data from a sample requires that we do a significance test to account for the variability due to random sampling.

6 6-sided dies; some fair some not.

7 Three tests... Two procedures...
Test of Goodness of Fit  one-way tables, 1 variable Chi-Square Test for Homogeneity Two-way table, 2 categorical variables; 2 populations Chi-Square Test of Association/Independence Two-way table, 2 categorical variables, 1 population; same exact procedure as Homogeneity Homogeneity: whether the distribution of a categorical variable is the same for each of several populations or treatments; Independence: whether there is convincing evidence of an association between the row and column variables in a two-way table, from which all the data is from one population.

8 M&M Mars Company claims...
that you will receive, in each bag of milk chocolate candies M&M’s ... 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow What is one way we can we test this claim? Discuss for 1 minute...

9 Claim: Customers will receive 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow
We could conduct a one-proportion z procedure/ hypothesis test for each of the following: Ho: pBrown = Ha: pBrown ≠ 0.13 Ho: pRed = Ha: pRed ≠ 0.13 Ho: pOrange = Ha: pOrange ≠ 0.20 Ho: pBlue = Ha: pBlue ≠ 0.24 Ho: pGreen = Ha: pGreen ≠ 0.14 Ho: pYellow = Ha: pYellow ≠ 0.14 Lots of work, time-consuming...

10 Claim: Customers will receive 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow
We could conduct a one-proportion z procedure/ hypothesis test six times... Lots of work, time- consuming... But more importantly, this process would lead us to the problem of multiple comparisons (more on this later), taking all the colors into consideration So, we have a single test to determine if our observed sample distribution is significantly different in some way from the hypothesized population distribution of all M&M colors

11 Claim: Customers will receive 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow
We will get back to this claim in a few days… and better yet, we will prove or disprove the claim using (and eating) lots and lots and lots of M&M’s 

12 Chi-Square (X2) Test for Goodness of Fit
Are you more likely to have a motor vehicle collision when using a cell phone on a given day of the week? A study of 699 randomly chosen drivers who were using a cell phone when they were involved in a collision examined this question. These drivers made 26,798 cell phone calls during a 14-month study period. Each of the 699 collisions was classified in various ways. Here are the counts for each day of the week:

13 Are accidents equally likely to occur on any day of the week?
Observation: In this sample, #’s are not equal... But is this just due to sampling variability OR are accidents truly not equally likely to occur on any day of the week? To answer this question, we must conduct an hypothesis test; Chi-Square Good of Fit test

14 SIDE NOTE... In this situation, the question is “Are accidents equally likely to occur on any day of the week?” Versus In the M&M situation, the question was “Will we receive, in each bag of milk chocolate candies M&M’s, 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow ? Look at claim or question for what we are testing

15 Side note… In chapters 9 & 10, we conducted significance tests about population parameters, such as a population proportion or the difference between two population means. In this chapter, we are conducting tests about distributions of categorical data

16 Side note… In chapters 9 & 10, the alternative hypothesis could be one-sided or two-sided, depending on the question we were trying to answer. In this chapter, there will be no one-sided tests. The alternative hypothesis will always be ‘the null hypothesis is not correct,’ in context of course.

17 Ho: Motor vehicle accidents involving cell phone use are equally likely to occur on each of 7 days of the week OR Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: The probability of a motor vehicle accident involving cell phone use vary from day-to-day (not all the same; at least one day is different from another). OR At least one of the proportions differs from the stated value(s); Look at claim or question for what we are testing

18 Side note… Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) If you choose to state your hypotheses in symbols, make sure you do not use 𝑝 to represent a population parameter proportion! Look at claim or question for what we are testing

19 Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7
Ha: At least one of the proportions differs from the stated value(s) GENERAL IDEA: Goodness of Fit Test compares observed (our sample) versus what we expect (our null hypothesis, Ho) Does our sample support our null hypothesis or does it support our alternative hypothesis? Look at claim or question for what we are testing

20 Check Conditions for Performing a Chi Square Test for Goodness of Fit

21 Random: Subjects were randomly selected
Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) Random: Subjects were randomly selected 10%: We are sampling without replacement, so we must assume that the population is at least (10)(699) Large Count: All expected counts must be at least 5; let’s calculate our expected counts.

22 699 total accidents that given week
Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) We have observed count data (our sample data above), now we need our expected count data 699 total accidents that given week Expected accidents each day (if Ho is true) = 699 ÷ 7 = each day (Ho; null hypothesis; 1/7 of total each day)

23 Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7
Ha: At least one of the proportions differs from the stated value(s) Expected accidents each day = 699 ÷ 7 = each day (Ho; null hypothesis; 1/7 of total each day) NOTE: Observed is count data; no such thing as 3-1/2 accidents on a given day; either 3 or 4; BUT the EXPECTED accidents CAN be a decimal/fraction.

24 AP Exam Common Error… Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) Expected accidents each day = 699 ÷ 7 = each day (Ho; null hypothesis; 1/7 of total each day) Some students mistakenly round the expected counts, believing that they must be integers. Students will lose points for this on the AP exam because it shows a misunderstanding of what expected counts represent, the average number of observations in a given category in many, many random samples.

25 Large Counts: All individual expected counts are at least 5. ✔
Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) Expected accidents each day = 699 ÷ 7 = each day (Ho; null hypothesis; 1/7 of total each day) Large Counts: All individual expected counts are at least 5. ✔

26 Do. Remember the other test statistics we have learned (z and t) measure how far apart the sample value is from the hypothesized value, just on a different scale. The formula for the chi-square statistic is included on the formula sheet that is provided on both sections of the AP exam.

27 Chi-Square procedure has degrees of freedom (just like t procedures)
degrees of freedom = k – 1 (unlike t-distribution, where df depends on n; chi-square depends on number of categories; careful!) If calculating by hand and using the Chi-Square table, be conservative; use the lower degrees of freedom

28 A little X2 detour... properties of X2
Distribution is skewed to the right; area under density curve still = 1 Degrees of freedom = k – 1 As df increase (as categories increase), density curve becomes less right skewed P-value: use table C or calculator “Rejection zone” idea still same Default α still 5% Table set up at that value and to the right

29 OK, now we are really ready to ‘Do”:
Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) OK, now we are really ready to ‘Do”: One method... Input observed into L1 & input expected into L2 Now, in L3, at the top, enter ((L1 – L2)2) ÷ L2 then sum (L3) (get to ‘sum’ by 2nd-list-math-5); this is your X2 value (from which you will get your p-value)

30 Ho:. Psunday = pmonday = ptuesday =. = psaturday = 1/7 Ha:
Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) Calculations: X2 = df = k – 1 = 7 – 1 = 6 Look at Chi-Square table (table C)  p-value < Remember, either reference formula or name of procedure when doing calculations

31 Or (easier) using our calculator:
Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) Or (easier) using our calculator: Input observed into L1 & expected into L2 stat, test, X2 GOF test, observed L1, expected L2, df 6, calculate X2 = p-value = 2.48 E-42 ≈ 0, df = 6

32 Each of these are the components of your X2 = 208.84
Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) SIDE NOTE: Notice CNTRB = {63.86, 10.99, 6.84, 35.02, 13.07, 1.72, 77.30} Each of these are the components of your X2 = Sometimes you will be asked what was the biggest (or the least) as well as direction of contributor/ component to the X2 statistic? No need to do the follow-up analysis unless you are asked to do so.

33 So what type of error would be possible? Why?
Ho: Psunday = pmonday = ptuesday = ... = psaturday = 1/7 Ha: At least one of the proportions differs from the stated value(s) Conclude: Reject Ho. As p-value ≈ 0, which is less than any reasonable α, we conclude all accidents like these types of accidents are not equally likely to occur on each of the seven days of the week. So what type of error would be possible? Why?

34 AP Exam Common Error… When stating conclusions for chi-square tests, students often accept the null hypothesis. Points will always be deducted on the AP exam for this error. When you are embedding your context, always speak to the alternative hypothesis (not the null).

35 Other helpful hints… The chi-square test statistic compares observed and expected counts. Don’t try to perform calculations with the observed and expected proportions in each category! When checking the Large Counts condition, be sure to examine the expected counts, not the observed counts. Also you cannot simply state that the expected counts are at least 5; not sufficient; students must list the expected counts to prove/show that they have actually checked them.

36 FYI… Unlike the other significance tests we have learned so far, the P-value for chi-square test for goodness of fit is always found by calculating the area to the right of the observed chi-square statistic. Because we are squaring the differences between the observed and expected counts, the chi-square statistic can never be negative; and bigger values of the chi-square statistic indicate bigger differences from the hypothesized distribution. Fortunately, Table C is already set up to find areas to the right.

37 Interesting facts… The mean of a chi-square distribution is equal to the degrees of freedom; this can help students get an impression of how unusual a chi-square statistic is. For example, with 10 degrees of freedom, 𝑋 2 = 11.2 is not very unusual; but , 𝑋 2 = 54.3 would be very unusual. Also, the variance is two times the degrees of freedom and the median is approximately equal to degrees of freedom minus 2/3 when the degrees of freedom are greater than 2.

38 Saving birds from windows...
Many birds are injured or killed by flying into windows. It appears that birds see windows as open space. Can tilting windows down so that they reflect earth rather than sky reduce bird strikes? Suppose we place three windows at the edge of a woods: one vertical, one tilted 20 degrees, and one tilted 40 degrees. During the next four months, there are 53 bird strikes: 31 on the vertical window, 14 on the 20- degree window, and 8 on the 40-degree window. If tilting had no effect, we would expect strikes on all three windows to have equal probability. Test this null hypothesis. What do you conclude?

39 53 bird strikes; 31 on the vertical window, 14 on the 20 degree window, 8 on the 40 degree window
We want to test Ho: pv = pt20 = pt40 = 1/3 Ha: At least one of these proportions is different

40 53 bird strikes; 31 on the vertical window, 14 on the 20 degree window, 8 on the 40 degree window
Plan: Random, 10%, Large Count 53 birds total in our sample; so expected counts are for each 53 ÷ 3 = Each expected count is > 5 ✔ (all individual expected counts are at least 5

41 53 bird strikes; 31 on the vertical window, 14 on the 20 degree window, 8 on the 40 degree window
Calculations: Chi-Square Goodness of Fit Test Enter 31, 14, 8 into L1 (observed) Enter 17.67, 17.67, into L2 (expected) stat, test, X2 GOF Test, L1, L2, df = 2, calculate X2 = p-value ≈ 0

42 53 bird strikes; 31 on the vertical window, 14 on the 20 degree window, 8 on the 40 degree window
Calculations: X2 = p-value ≈ 0 Remember, CNTRB = {10.05, 0.76, 5.29}

43 53 bird strikes; 31 on the vertical window, 14 on the 20 degree window, 8 on the 40 degree window
Interpretation Reject null hypothesis. Since the p-value ≈ 0 (less than α = 5%), there is strong evidence that all tilts like these tilts result in differ numbers of bird strikes. Type I or Type II error? Why?

44 The University of Chicago's General Social Survey (GSS) is the nation's most important social science sample survey. The GSS regularly asks its subjects their astrological sign. Above are the counts of randomly- selected responses in the most recent year this question was asked. If births were spread uniformly across the year, we would expect all 12 signs to be equally likely. Are they?

45 We want to test using a Chi-Square Goodness of Fit Test (if conditions are met) Ho: pAries = pTaurus = pGemini = ... = pPisces = 1/12 Ha: At least one of the proportions differs from 1/12

46 Ho: pAries = pTaurus = pGemini =
Ho: pAries = pTaurus = pGemini = ... = pPisces = 1/12 Ha: At least one of the proportions differs from 1/12 Plan: Random, 10%, Large Count There were 2779 responses, so we would expect 2779 ÷ 12 = for each sign Each expected count is > 5 ✔ (all individual expected counts are at least 5)

47 Ho: pAries = pTaurus = pGemini =
Ho: pAries = pTaurus = pGemini = ... = pPisces = 1/12 Ha: At least one of the proportions differs from 1/12 Calculations: X2 Goodness of Fit Test All 12 observed counts into L1; expected counts (231.58) into L2 stat, test, X2 Goodness of Fit Test, L1, L2, df = 11  X2 = p-value = 0.21

48 Ho: pAries = pTaurus = pGemini =
Ho: pAries = pTaurus = pGemini = ... = pPisces = 1/12 Ha: At least one of the proportions differs from 1/12 Conclude: Fail to reject. With a p-value of 0.21, which is larger than any reasonable α, there is not enough evidence to conclude that all births are not uniformly spread throughout the year. What type of error is possible in this situation?

49 Number off… and assign partners…
… using StatCrunch

50 M&M’s Activity... Mars claims: 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow in each bag of milk chocolate M&Ms Think-Pair-Share… how is this different from accidents/days of the week; bird strikes; signs/births ? Based on our sample data, do we have reason to doubt the color distribution claim made by M&M/Mars Company? Give appropriate statistical evidence to support your conclusion. Form Groups and turn in one paper, start to finish, with all of your group’s names on the paper.

51 Mars claims: 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow in each bag of milk chocolate M&Ms Ho: pred = 13% pbrown = 13% porange = 20% pblue = 24% pgreen = 16% pyellow = 14% Ha: At least one of these proportions is different

52 Mars claims: 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow in each bag of milk chocolate M&Ms Conditions: All individual expected counts are at least 5 (0.13)(Total) (0.13)(Total) (0.20)(Total) (0.24)(Total) (0.16)(Total) (0.14)(Total)

53 Mars claims: 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow in each bag of milk chocolate M&Ms Calculations Observed  L1 Expected  L2 degrees of freedom = 5 X2 = p-value =

54 Mars claims: 13% red, 13% brown, 20% orange, 24% blue, 16% green, 14% yellow in each bag of milk chocolate M&Ms Interpretation: Reject/Fail to reject; reference α and p-value, in context of problem

55 Homework... Page 693 #1, 3, 7, 9 MC: All, page 695 #19-22 FRQ’s as needed Section Quiz on 11-1 on …

56 Inference for 2-way tables...
Two tests possible with 2-way tables Test of Homogeneity – independent SRS’s from each of ‘c’ populations (2, 3, 4, etc. populations) OR Test of Independence/Association – one SRS, one population

57 Inference for 2-way tables...
Same test (Chi-Square Test) used for either homogeneity or independence/association Test of Homogeneity – independent SRS’s from each of ‘c’ populations (2, 3, 4, etc. populations) OR Test of Independence/Association – one SRS, one population

58 Test of Homogeneity of Populations... two-way tables...
2 independent random samples 3 randomly selected groups

59 Chi-Square Test of Homogeneity of Populations... (2 or more populations)
rows & columns r x c always; (never c x r) don’t count the ‘totals’ as a row or a column categories in rows and other categories in columns separate and independent SRS’s from each population

60 Chi-Square Test of Homogeneity of Populations... (2 or more populations)
Ho (null hypothesis): distribution of variables is the same in all populations Ha (alternative hypothesis): distribution of variables is not all the same in all populations Still use:

61 Chi-Square Test of Homogeneity of Populations... (2 or more populations)
Ho: distribution of variables is the same in all populations Ha: distribution of variables if not all the same in all populations Idea is still... How far are observed counts from expected counts?

62 Chi-Square Test of Homogeneity of Populations... (2 or more populations)
Calculations for expected cell count, for EACH cell: So, in this table, you would have to calculate 15 expected values... lots of time and work...

63 Chi-Square Test of Homogeneity of Populations... (2 or more populations)
Don’t worry... you rarely will have to manually calculate expected values by this formula Most of the time, you will input your data into a matrix and the matrix will calculate your expected values automatically Note: original 2-way table is always in whole counts; but expected counts may not be whole counts (quite often are decimals)

64 Chi-Square Test of Homogeneity of Populations... (2 or more populations)
Won’t use lists (like Goodness of Fit; one-way tables) but rather will use matrices Will input the observed data into a matrix, and the expected values matrix will be automatically calculated Also, calculator will automatically calculate X2 statistic, p-value, and degrees of freedom

65 Chi-Square Test of Homogeneity of Populations... (2 or more populations)
degrees of freedom... up to now, general rule k – 1 now, 2-way tables, so df = (r – 1)(c – 1) p-value is area to the right, under the X2 density curve

66 Chi-Square Test of Homogeneity of Populations... (2 or more populations)
Plan.... Random, 10%, Large Count (again… still) Random 10%: Population must be at least 10 times the sample size(s) & data is from two independent samples All individual expected counts must be ≥ 5 It’s all about expected

67 Chi-Square Test of Homogeneity of Populations... (2 or more populations)
Birthdays… Has modern technology changed the distribution of birthdays? With more babies being delivered by planned C-section, a statistics class hypothesized that the day-of- the week distribution for births would be different for people born after 1993 compared to people born before After all, why would a doctor plan a C-section for the weekend?

68 Chi-Square Test of Homogeneity of Populations
Chi-Square Test of Homogeneity of Populations... (2 or more populations) … Birthdays To investigate, they selected a random sample of people from each of the two age categories and recorded the day of the week on which they were born. Is there convincing evidence that the distribution of birthdays has changed? Before 1980 After 1993 Total Sunday 12 9 21 Monday 11 23 Tuesday 14 25 Wednesday 10 22 Thursday 7 17 24 Friday 18 Saturday 6 77 73 150

69 State Ho: There is no difference in the distributions of birthdays for people born before 1980 and people born after 1993. Ha: There is a difference in the distributions of birthdays … Before 1980 After 1993 Total Sunday 12 9 21 Monday 11 23 Tuesday 14 25 Wednesday 10 22 Thursday 7 17 24 Friday 18 Saturday 6 77 73 150

70 Plan: Random, 10%, Large Count
Random; stated in problem 10%; assume populations are each at least 10 times each sample size, so (10)(77) and (10)(73) & data are from 2 independent samples. Before 1980 After 1993 Total Sunday 12 9 21 Monday 11 23 Tuesday 14 25 Wednesday 10 22 Thursday 7 17 24 Friday 18 Saturday 6 77 73 150

71 Plan: Random, 10%, Large Count
Large Count: We need to check expected counts… all expected counts must be at least 5… stay with me here… Before 1980 After 1993 Total Sunday 12 9 21 Monday 11 23 Tuesday 14 25 Wednesday 10 22 Thursday 7 17 24 Friday 18 Saturday 6 77 73 150

72 We are going to actually run the test to check our expected counts condition…
All expected cell counts are ≥ 5 second – matrix – edit – 7  2 – enter Arrow up and down to enter data into the 7 x 2 matrix Note: don’t input totals; not part of the matrix You need to actually write your expected matrix #s down on your FRQ to show you actually checked this condition.

73 Do stat – test – X2 test – enter – observed select matrix [A] – expected select matrix [B] – calculate Before 1980 After 1993 Total Sunday 12 9 21 Monday 11 23 Tuesday 14 25 Wednesday 10 22 Thursday 7 17 24 Friday 18 Saturday 6 77 73 150

74 We are going to actually run the test to check our expected counts condition…
You need to actually write your expected matrix #s down on your FRQ to show you actually checked this condition. 10.8 10.2 11.8 11.2 12.8 12.2 11.3 10.7 12.3 11.6 9.2 8.8 8.7 8.3

75 Ho: There is no difference in the distributions of birthdays for people born before 1980 and people born after Ha: There is a difference in the distributions of birthdays … Stat – test – X2 test – enter – observed select matrix [A] – expected select matrix [B] – calculate X2 = p-value = df = 6

76 Ho: There is no difference in the distributions of birthdays for people born before 1980 and people born after Ha: There is a difference in the distributions of birthdays … X2 = p-value = df = 6 Fail to reject. Because the p-value is , which is greater than any reasonable alpha level, we do not have sufficient evidence to show that there is a difference in the distributions of all birthdays for people born before 1980 and people born after 1993.

77 Follow-up... Largest components of X2?

78 How do we use the X2 table? Table is like t-table in that it is at that value to the right (is that how table A works?) It is an approximation (like table A and t-table) Find the row for df = 6, then find the two columns that X2 = fits between p-value is beyond the left side of the table (less than 7.84) Using calculator, we got p = which is greater than 0.25

79 AP Exam Common Error… Some students mistakenly round the expected counts, believing that they must be integers. Students will lose points for this on the AP exam because it shows a misunderstanding of what an expected count represents –the average number of subjects in a treatment group with that response in repeated reassignments of the treatments, assuming the treatments have the same effect.

80 AP Exam Common Error… When checking conditions, many students examine the observed counts rather than the expected counts. Also, many students forget to list the expected counts, especially when doing the calculations on their calculators. Simply stating that the expected counts are at least 5 is not sufficient –students must list the expected counts to prove they have actually checked them.

81 How to quit smoking... It's hard for smokers to quit. Perhaps prescribing a drug to fight depression will work as well as the usual nicotine patch. Perhaps combining the patch and the drug will work better than either treatment alone. Here are 4 independent samples from 4 different populations. The data is from a randomized, double- blind trial that compared the four treatments. A “success” means that the subject did not smoke for a year following the beginning of the study.

82 How to quit smoking... Perform a Chi-Square test (of homogeneity) to determine if the success rate is the same for all four treatments. Notice!!! Subjects vs. successes! We want successes vs. failures!

83 Perform a Chi-Square test (of homogeneity) to determine if the success rate is the same for all four treatments Ho: Distribution of treatments have the same effectiveness in all 4 populations of treatment Ha: Distribution of 4 treatments do not have the same effectiveness.

84 Plan: Random, 10%, Large Count
Perform a Chi-Square test (of homogeneity) to determine if the success rate is the same for all four treatments Plan: Random, 10%, Large Count Treatment Successes Failures Nicotine Patch 40 204 Drug 74 170 Patch + Drug 87 158 Placebo 25 135

85 Perform a Chi-Square test (of homogeneity) to determine if the success rate is the same for all four treatments Conditions continued... Enter above data into matrix [A], then run test (stat – test – X2 Test – observed [A] – expected [B] – calculate NOW, go back into matrix [B] to finish your conditions Treatment Successes Failures Nicotine Patch 40 104 Drug 74 170 Patch + Drug 87 158 Placebo 25 135

86 Perform a Chi-Square test (of homogeneity) to determine if the success rate is the same for all four treatments Conditions continued...Expected counts in matrix [B]: All expected counts are ≥ 5 ✔ Treatment Successes Failures Nicotine Patch 40 204 Drug 74 170 Patch + Drug 87 158 Placebo 25 135

87 Perform a Chi-Square test (of homogeneity) to determine if the success rate is the same for all four treatments Calculations: stat – calc – X2 Test – observed [A] – expected [B] – calculate X2 = p = E -7 df = 3 Treatment Successes Failures Nicotine Patch 40 104 Drug 74 170 Patch + Drug 87 158 Placebo 25 135

88 Perform a Chi-Square test (of homogeneity) to determine if the success rate is the same for all four treatments X2 = p = E -7 df = 3 Interpretation Reject Ho. With a p-value ≈ 0, which is less than any reasonable α, there is sufficient evidence to show that the effectiveness of different treatments is not the same for all people like the subjects in this experiment.

89 How are schools doing? The nonprofit group Public Agenda conducted telephone interviews with 3 independent, randomly selected groups of parents of high school children. There were 202 black parents, 202 Hispanic parents, and 201 white parents. One question asked was “Are the high schools in your state doing an excellent, good, fair, or poor job, or don't you know enough to say?” Here are the survey results:

90 How are schools doing? Conduct a test of significance to determine if the distributions for these three populations are the same. (Chi-Square Test of Homogeneity of Populations)

91 How are schools doing? Ho: The distributions of responses to this question are the same for each group. Ha: The distributions of responses to this question are not the same.

92 How are schools doing? Plan: Random, 10%, Large Count

93 How are schools doing? Conditions continued... all expected cell counts must be ≥

94 How are schools doing? Do... stat – test – X2 Test – observed [A] – expected [B] – calculate X2 = p = df = 8

95 How are schools doing? X2 = p = df = 8 Conclude: With a p-value of which is less than any reasonable α level, reject Ho and conclude that all people who would fall into these 4 groups would have different opinions about performance of high schools in their state.

96 One more X2 Test.... When do we use Chi-Square tests? Why haven’t we used them before now? Chi-Square Goodness of Fit Test Chi-Square Test of Homogeneity Now, Chi-Square Test of Association/Independence

97 Chi-Square Test of Association/Independence...
Two-way table (like X2 test of homogeneity) BUT this test involves only a single population/sample; single SRS, with each individual classified according to both of two categorical variables You must be able to distinguish between which test (homogeneity vs. independence/association) to use; you must name the correct test Bonus (or not....), we use the exact same procedure in the calculator for BOTH of these tests; conditions are the same as well

98 Chi-Square Test of Association/Independence...
Ho: No association between categorical variables OR Categorical variables are independent Ha: There is an association (or they are not independent) Caution: Do not use ‘cause;’ the most we can say is that there is/is not a relation or they are/are not associated or they are/are not independent

99 Franchises that succeed...
Many popular businesses, like McDonalds, are franchises. The owner of a local franchise benefits from the brand recognition, national advertising, and detailed guidelines provided by the franchise chain. In return, he or she pays fees to the franchise firm and agrees to follow its policies. The relationship between the local entrepreneur and the franchise firm is spelled out in a detailed contract.

100 Franchises that succeed...
One clause that the contract may contain is the entrepreneur's right to an exclusive territory. This means that the new outlet will be the only representative of the franchise in a specified territory and will not have to compete with other outlets of the same chain. How does the presence of an exclusive-territory clause in the contract relate to the survival of the business? A study designed to address this question collected data from a sample of 170 new franchise firms.

101 Franchises that succeed...
How does the presence of an exclusive territory clause in a contract relate to the survival of a business? i.e., are these two qualities related/associated? Are they independent?

102 Franchises that succeed...
Ho: Success and exclusive-territory are independent (not associated). Ha: Success and exclusive-territory are dependent (associated)

103 Plan: Random, 10%, Large Count
Ho: Success and exclusive-territory are independent (not associated). Ha: Success and exclusive-territory are dependent (associated) Plan: Random, 10%, Large Count

104 Ho:. Success and exclusive-territory are independent (not associated)
Ho: Success and exclusive-territory are independent (not associated). Ha: Success and exclusive-territory are dependent (associated) Input data into matrix [A]; caution: don’t include totals!; then run test; then go back and check matrix [B] for expected cell counts

105 Ho:. Success and exclusive-territory are independent (not associated)
Ho: Success and exclusive-territory are independent (not associated). Ha: Success and exclusive-territory are dependent (associated) Plan continued... Expected cell counts – all must be ≥ 5 Expected cell counts:

106 Ho:. Success and exclusive-territory are independent (not associated)
Ho: Success and exclusive-territory are independent (not associated). Ha: Success and exclusive-territory are dependent (associated) Do: stat – calc – X2 test – observed [A] – expected [B] – calculate X2 = 5.91 p = df = 1

107 Ho:. Success and exclusive-territory are independent (not associated)
Ho: Success and exclusive-territory are independent (not associated). Ha: Success and exclusive-territory are dependent (associated) X2 = 5.91 p = df = 1 Conclude: Reject Ho. With a p-value of and an α = 0.05, we have sufficient evidence to conclude that success and exclusive territory clause are dependent (there is an association between the two qualities) for all businesses similar to the ones in this study. Caution: This procedure does not show ‘cause;’ don’t use that word; ever.

108 Extracurricular Activities & Grades...
North Carolina State University studied student performance in a course required by its chemical engineering major. One question of interest is the relationship between time spent in extracurricular activities and whether a student earned a C or better in the course. Here are the data from a SRS of 119 students who answered a question about extracurricular activities:

109 Extracurricular Activities & Grades...
Is there statistically significant evidence of an association between the amount of time spent on extracurricular activities and grades earned in the course?

110 Extracurricular Activities & Grades...
Ho: There is no association (they are independent) between amount of time spent on extracurricular activities and grades earned in the course Ha: There is an association (they are not independent)

111 Extracurricular Activities & Grades...
Plan: Random, 10%, Large Count

112 Extracurricular Activities & Grades...
Conditions continued... each expected cell count ≥ 5 ??? Expected cell counts

113 Do: stat – test – X2 test – observed [A] – expected [B] – calculate X2 = 6.93 p = df = 2 Conclude: Reject Ho. With a p-value of and an α = 0.05, there is sufficient evidence to conclude that there is an association between extracurricular activities and grades earned in the course for all students similar to the ones in this study.

114 X2 = p = df = 2 Reject Ho.

115 Case Closed… In the chapter-opening Case Study, we described a study that investigated whether or not dogs resemble their owners. The researchers who conducted the experiment believe that resemblance between dog and owner might differ for purebred and mixed-breed dogs. Above is a two-way table summarizing the results of the experiment:

116 Answer the following in your groups…
Do the data from this study provide convincing evidence of an association between dogs’ breed status and whether or not they resemble their owners?

117 Homework... Page 725, # 33, 35, 43, 45, 47 MC: Page 728, #51 – 56
FRQ’s as needed Section Quiz… Chapter 11 Test …


Download ppt "Inference for Distributions of Categorical Variables"

Similar presentations


Ads by Google