30
Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

  • View
    219

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Stat 512 – Lecture 13

Chi-Square Analysis (Ch. 8)

Page 2: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Comparing Proportions

Decrease in population proportion rating paper as largely believable?

H0: 98-02 = 0

Ha: 98-02 > 0 z = 1.64, p-value=.051 Weak evidence of a

decrease (0-.07) in the populations proportion

No cause and effect

Increase in survival rate with letrozole?

H0: treatment effect = 0

Ha: treatment effect (l-p) > 0

z = 7.14, p-value<.001 Very strong evidence of

an increase in survival rate (.044-.077) due to letrozole

At least for these volunteers

Page 3: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Last Time: Comparing Proportions If have independent random samples or a

randomized experiment with large sample sizes (at least 5 successes and 5 failures in each group), then can use 2-sample z-procedures (2 proportions) If an experiment with small group sizes, use two-way table

simulation as before Keep in mind

Parameter is the “difference” in population proportions or true treatment effect

Confidence interval is for the difference in population proportions/true treatment effect

Page 4: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Practice Problem

Compare proportion of all men voting for AS to proportion of all women voting for AS

Descriptive: The conditional proportion voting for Arnold is higher for the men (.49) than for the women (.43) in this sample.

Page 5: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Practice Problem

Inference: m vs. f H0: m – f = 0 (no difference in the population

proportions) Ha: m – f > 0 (male population would say they

voted for AS at a higher rate) The sample sizes are large (at least 5 voting and not

voting for Arnie in each sample) and we trust CNN to have collected representative samples. We are also willing to treat the samples of men and women as independent.

Page 6: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Practice Problem

Inference: m vs. f Using the applet, z = 3.91 and p-value < .0001 With such a small p-value, we reject the null

hypothesis of equal population proportions. We have strong evidence that males are more likely to say they voted for Arnie. We don’t know why but assuming CNN did their job right, we will generalize this difference to the population of voters.

We are 90% confident that a higher proportion of CA voting males than females would say they voted for Arnold by 3.5 to 8.5 percentage points.

Page 7: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Next Step

Comparing two population means/treatment effect with a quantitative response variable

Example 3: Observational units = volunteers in Shigella

vaccination trials Treat as samples from larger population of healthy

adults

Page 8: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 3: Body Temperatures Minitab commands depend on which format

typed data in Descriptive Analysis

Samples show slight tendency for higher body temperatures among women (mean = 98.40 vs. 98.10F) but similar variability and shape

Page 9: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 3: Body Temperatures Perhaps the population means are equal, and

these sample means differ just based on random sampling variability

H0:

Ha: ≠(“differs”) Technical conditions

Normal populations (works ok if n1, n2 >20) Large populations (N > 20n in each case) Independent random samples

Page 10: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Test statistic

2

2

2

1

2

1

21 )(

ns

ns

differenceedhypothesizxxt

2

2

2

1

2

121 )(:

n

s

n

stxxCI

Example 3: Body Temperatures

Result is statistically significant at 5% level but not 1% level. Moderate evidence that these sample means are further apart than we would expect from random sampling variability alone if the population means were equal. Conclude that the mean body temperature differs by .039oF to .54oF.

Page 11: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 4: Sleep Deprivation Case 2: Randomized Experiment

When samples sizes are large or each group distribution is normal, the randomization distribution is well approximated by the t distribution Pooled t test?

improvement

sleep c

onditio

n

4032241680-8-16

deprived

unrestricted

Page 12: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 4: Sleep Deprivation Case 2: Randomized Experiment

improvement

sleep c

onditio

n

4032241680-8-16

deprived

unrestricted

Validity?

Page 13: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 4 Conclusions

1. Statistically significant

2. Cause and effect conclusion valid

3. Generalizing to larger population?

Is it possible that we are making the wrong decision?

Yes, type I error…

Page 14: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Summary

Type of study Do you have (independent) random samples from two

populations?

OR Do you have a randomized experiment? Same calculations, different conclusions

Are the sample sizes large for you to use normal/t procedures? With small sample sizes, use Fisher’s Exact Test (two-way

table simulation) or randomization tests from before With larger samples, get test statistic and confidence

interval conveniently

Page 15: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 1: Dr. Spock’s Trial

Proportion of women on jury for each judge

Let i = probability a women each selected for judge i’s jury selection process

0%

20%

40%

60%

80%

100%

Judge1

Judge2

Judge3

Judge4

Judge5

Judge6

Judge7

men

women

Page 16: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 1: Dr. Spock’s Trial

What does it mean to say there is no “judge effect” or difference across the judges?

Page 17: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 1: Dr. Spock’s Trial

H0:

Big change? Now trying to compare more than two populations Would it be reasonable to analysis all of the two-

sample comparisons? Probability of making at least one type I error

increases as we increase the number of tests Would prefer one procedure, one type I error

Page 18: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 1: Dr. Spock’s Trial

How do we determine the “expected results” when the null hypothesis is true?

Apply the common rate to each Judge… How measure the discrepancy between the

observed counts and the expected counts?

Page 19: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Chi-Squared Statistic

New test statistic:

But doesn’t follow a normal distribution!

r

i

c

j ij

ijij

ectedexp

ectedexpobserved

1 1

22

Chi-square distribution• Skewed to the right• Characterized by “degrees of freedom”

Observed 2=62.7

Page 20: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Using Minitab

Enter two-way table Select Stat > Tables > Chi-Square Test

(Table in Worksheet) Output provides observed counts, expected

counts, test statistic value, degrees of freedom, p-value

Page 21: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Minitab output

Strongly reject H0, conclude that at least one of the judges has a different long-run probability of selecting a female (assuming these cases are representative of the overall performance for each judge)

Page 22: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Follow-up Analysis

If find a statistically significant difference, might want to say more about which population(s) appear to differ.

Look at the terms that are being added together to get the chi-square sum

Observed fewer women than expected

Observed more men than expected

women

men

Page 23: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 2: Near-sightedness

What would this bar graph look like if there was no association between lighting condition and eye sight?

Not that the proportion with each eye condition is the same but that the distribution of eye condition is the same for each lighting groups

Page 24: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 2: Near-sightedness

H0: Eye condition and Lighting are statistically independent (i.e., the two variables are not associated)

Ha: Not statistically independent (the two variables are associated)

Page 25: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 2: Near sightedness

Expected counts Proportion with hyperopia = .190 So of the 172 children in darkness, 19% with

hyperopia = 32.68 For the 232 children with night light, 19% with

hyperopia = 44.08 For the 75 children with room light, 19% with

hyperopia = 14.25

Page 26: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

In general

Expected counts =

row total × column total table total

Goal, same distribution across all explanatory variable groups

To measure the discrepancy between observed and expected counts, can again use chi-squared test statistic

Page 27: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Example 2: Near sightedness

Small p-value provides strong evidence of a real association between eye condition and lighting

Observational so no causation Even a little worried about generalizing beyond this

particular clinic

All expected counts exceed 5 (smallest = 14.25)Assuming random sample of children…

Page 28: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Summary – Chi-Square Procedures Chi-square tests arise in several situations

1. Comparing 2 or more population proportions H0:

Ha: at least one i differs

2. Comparing 2 or more population distributions on categorical response variable

H0: the population distributions are the same

Ha: the population distributions are not all the same

0%

20%

40%

60%

80%

100%

Judge1

Judge2

Judge3

Judge4

Judge5

Judge6

Judge7

Men on jury list

Women on jury list

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

1989 1993

Can’t

Rating 1

Rating 2

Rating 3

Rating 4

Page 29: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

Summary – Chi-Square Procedures3. Association between 2 categorical variables

Ho: no association between var 1 and var 2 (independent)

Ha: is an association between the variables Technical conditions:

Random Case 1 and 2: Independent random samples from each

population or randomized experiment Case 3: Random sample from population of interest

Large sample(s) All expected cell counts >5

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

darkness night light room light

myopia

emmetropia

hyperopia

Page 30: Stat 512 – Lecture 13 Chi-Square Analysis (Ch. 8)

For Tuesday

Start reading Ch. 12 Submit PP 11 in Blackboard HW 6 covers two-sample comparisons and

chi-square procedures Remember to include all relevant computer output