stat 145 (notes) - unm mathmath.unm.edu/~alvaro/stat145-p4.pdf · stat 145 (notes) al nosedal ......

107
STAT 145 (Notes) Al Nosedal [email protected] Department of Mathematics and Statistics University of New Mexico Fall 2013

Upload: hakien

Post on 05-Feb-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

STAT 145 (Notes)

Al [email protected]

Department of Mathematics and StatisticsUniversity of New Mexico

Fall 2013

Page 2: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

CHAPTER 18

INFERENCE ABOUT A POPULATION MEAN.

Page 3: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Conditions for Inference about mean

I We can regard our data as a simple random sample (SRS)from the population. This condition is very important.

I Observations from the population have a Normal distributionwith mean µ and standard deviation σ. In practice, it isenough that the distribution be symmetric and single-peakedunless the sample is very small. Both µ and σ are unknownparameters.

Page 4: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Standard Error

When the standard deviation of a statistic is estimated from data,the result is called the standard error of the statistic. The standarderror of the sample mean x̄ is s√

n.

Page 5: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Travel time to work

A study of commuting times reports the travel times to work of arandom sample of 1000 employed adults. The mean is x̄ = 49.2minutes and the standard deviation is s = 63.9 minutes. What isthe standard error of the mean?

Page 6: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

The standard error of the mean is

s√n

=63.9√10000

= 2.0207 minutes

Page 7: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

The one-sample t statistic and the t distributions

Draw an SRS of size n from a large population that has theNormal distribution with mean µ and standard deviation σ. Theone-sample t statistic

t∗ =x̄ − µs/√

n

has the t distribution with n − 1 degrees of freedom.

Page 8: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

The t distributions

I The density curves of the t distributions are similar in shapeto the Standard Normal curve. They are symmetric about 0,single-peaked, and bell-shaped.

I The spread of the t distributions is a bit greater than of theStandard Normal distribution. The t distributions have moreprobability in the tails and less in the center than does theStandard Normal. This is true because substituting theestimate s for the fixed parameter σ introduces more variationinto the statistic.

I As the degrees of freedom increase, the t density curveapproaches the N(0, 1) curve ever more closely. This happensbecause s estimates σ more accurately as the sample sizeincreases. So using s in place of σ causes little extra variationwhen the sample is large.

Page 9: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Density curves

-4 -2 0 2 4

0.0

0.1

0.2

0.3

0.4

Std. Normalt(2)t(9)

Page 10: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Density curves

-4 -2 0 2 4

0.00.1

0.20.3

0.4

Std. Normalt(29)

Page 11: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Density curves

-4 -2 0 2 4

0.00.1

0.20.3

0.4

Std. Normalt(49)

Page 12: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Critical values

Use Table C or software to finda) the critical value for a one-sided test with level α = 0.05 basedon the t(4) distribution.b) the critical value for 98% confidence interval based on the t(26)distribution.

Page 13: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) t∗ = 2.132b) t∗ = 2.479

Page 14: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

More critical values

You have an SRS of size 30 and calculate the one-samplet-statistic. What is the critical value t∗ such thata) t has probability 0.025 to the right of t∗?b) t has probability 0.75 to the left of of t∗?

Page 15: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

Here, df = 30− 1 = 29.a) t∗ = 2.045b) t∗ = 0.683

Page 16: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

The one-sample t confidence interval

Draw an SRS of size n from a large population having unknownmean µ. A level C confidence interval for µ is

x̄ ± t∗s√n

where t∗ is the critical value for the t(n − 1) density curve witharea C between −t∗ and t∗. This interval is exact when thepopulation distribution is Normal and is approximately correct forlarge n in other cases.

Page 17: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Critical values

What critical value t∗ from Table C would you use for a confidenceinterval for the mean of the population in each of the followingsituations?a) A 95% confidence interval based on n = 12 observations.b) A 99% confidence interval from an SRS of 18 observations.c) A 90% confidence interval from a sample of size 6.

Page 18: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) df = 12− 1 = 11, so t∗ = 2.201.b) df = 18− 1 = 17, so t∗ = 2.898.c) df = 6− 1 = 5, so t∗ = 2.015.

Page 19: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Ancient air

The composition of the earth’s atmosphere may have changed overtime. To try to discover the nature of the atmosphere long ago, wecan examine the gas in bubbles inside ancient amber. Amber istree resin that has hardened and been trapped in rocks. The gas inbubbles within amber should be a sample of the atmosphere at thetime the amber was formed. Measurements on specimens of amberfrom the late Cretaceous era (75 to 95 million years ago) givethese percents of nitrogen:63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0Assume (this is not yet agreed on by experts) that theseobservations are an SRS from the late Cretaceous atmosphere. Usea 90% confidence interval to estimate the mean percent ofnitrogen in ancient air (Our present-day atmosphere is about78.1% nitrogen).

Page 20: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

µ = mean percent of nitrogen in ancient air. We will estimate µwith a 90% confidence interval.With x̄ = 59.5888, s = 6.2552, and t∗ = 1.860 (df = 9− 1 = 8),the 90% confidence interval for µ is

59.5888± 1.860

(6.2552√

9

)59.5888± 3.8782

55.7106 to 63.4670

Page 21: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

The one-sample t test

Draw an SRS of size n from a large population having unknownmean µ. To test the hypothesis H0 : µ = µ0, compute theone-sample t statistic

t∗ =x̄ − µ0

s/√

n

In terms of a variable T having the t(n − 1) distribution, theP-value for a test of H0 againstHa : µ > µ0 is P(T ≥ t∗).Ha : µ < µ0 is P(T ≤ t∗).Ha : µ 6= µ0 is 2P(T ≥ |t∗|).These P-values are exact if the population distribution is Normaland are approximately correct for large n in other cases.

Page 22: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Is it significant?

The one-sample t statistic for testingH0 : µ = 0Ha : µ > 0from a sample of n = 20 observations has the value t∗ = 1.84.a) What are the degrees of freedom for this statistic?b) Give the two critical values t from Table C that bracket t∗.What are the one-sided P-values for these two entries?c) Is the value t∗ = 1.84 significant at the 5% level? Is itsignificant at the 1% level?d) (Optional) If you have access to suitable technology, give theexact one-sided P-value for t∗ = 1.84?

Page 23: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) df = 20 -1 = 19.b) t∗ = 1.84 is bracketed by t = 1.729 (with right-tail probability0.05) and t = 2.093 (with right-tail probability 0.025). Hence,because this is a one-sided significance test,0.025 < P-value < 0.05.c) This test is significant at the 5% level because theP-value < 0.05. It is not significant at the 1% level because theP-value > 0.01.d) From TI-84, tcdf(1.84,1000,19), P-value = 0.0407.

Page 24: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Is it significant?

The one-sample t statistic from a sample of n = 15 observationsfor the two-sided test ofH0 : µ = 64Ha : µ 6= 64has the value t∗ = 2.12.a) What are the degrees of freedom for t∗?b) Locate the two-critical values t from Table C that bracket t∗.What are the two-sided P-values for these two entries?c) is the value t∗ = 2.12 statistically significant at the 10% level?At the 5% level?d) (Optional) If you have access to suitable technology, give theexact two-sided P-value for t∗ = 2.12.

Page 25: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) df = 15 -1 = 14.b) t∗ = 2.12 is bracketed by t = 1.761 (with two-tail probability0.10) and t = 2.145 (with two-tail probability 0.05). Hence,because this is a two-sided significance test, 0.05 < P-value < 0.10.c) This test is significant at the 10% level because theP-value < 0.10. It is not significant at the 5% level because theP-value > 0.05.d) From TI-84, tcdf(2.12,1000,19) = 0.0261,P-value = 2(0.0261) = 0.0522.

Page 26: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Ancient air, continued

Do the data of Exercise 18.7 (see above) give good reason to thinkthat the percent of nitrogen in the air during the Cretaceous erawas different from the present 78.1%? Carry out a test ofsignificance at the 5% significance level.

Page 27: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

Is there evidence that the percent of nitrogen in ancient air wasdifferent from the present 78.1%?1. State hypotheses. H0 : µ = 78.1% vs Ha : µ 6= 78.1%.2. Test statistic. t∗ = x̄−µ0

σ/√n

= 59.5888−78.16.2553/

√9

= −8.8778

3. P-value. For df = 8, this is beyond anything shown in Table C,so P-value < 0.001 (TI -84 gives 0.00002).4. Conclusion. We have very strong evidence (P-value < 0.001)that Cretaceous air is different from nitrogen than modern air.

Page 28: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Matched pairs t procedures

To compare the responses to the two treatments in a matchedpairs design, find the difference between the responses within eachpair. Then apply the one-sample t procedures to these differences.

Page 29: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Genetic engineering for cancer treatment

Here’s a new idea for treating advanced melanoma, the mostserious kind of skin cancer. Genetically engineer white blood cellsto better recognize and destroy cancer cells, then infuse these cellsinto patients. The subjects in a small initial study were 11 patientswhose melanoma had not responded to existing treatments. Onequestion was how rapidly the new cells would multiply afterinfusion, as measured by the doubling time in days. Here are thedoubling times:1.4 1.0 1.3 1.0 1.3 2.0 0.6 0.8 0.7 0.9 1.9a) Examine the data. Is it reasonable to use the t procedures?b) Give a 90% confidence interval for the mean doubling time. Areyou willing to use this interval to make an inference about themean doubling time in a population of similar patients?

Page 30: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) The stemplot does not show any severe evidence ofnon-Normality, so t procedures should be safe.

0 6 7 8 91 0 0 3 3 41 92 0

Page 31: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

b) With x̄ = 1.1727 days, s = 0.4606 days, and t∗ = 1.812 (df =10), the 90% confidence interval is

1.1727± 1.812

(0.4606√

11

)1.1727± 0.2516

0.9211 to 1.4243 days

Page 32: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

There is no indication that the sample represents an SRS of allpatients whose melanoma has not responded to existingtreatments, so inferring to the population of similar patients maynot be reasonable.

Page 33: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Genetic engineering for cancer treatment, continued

Another outcome in the cancer experiment described above ismeasured by a test for the presence of cells that trigger an immuneresponse in the body and so may help fight cancer. Here are datafor the 11 subjects: counts of active cells per 100,000 cells beforeand after infusion of the modified cells. The difference (after minusbefore) is the response variable.

Page 34: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Data

Before After Difference Difference/10

14 41 27 2.70 7 7 0.71 1 0 00 215 215 21.50 20 20 20 700 700 700 13 13 1.3

20 530 510 511 35 34 3.46 92 86 8.60 108 108 10.8

Page 35: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Genetic engineering for cancer treatment, continued

a) Examine the data. Is it reasonable to use the t procedures?b) If your conclusion in part a) is ”Yes”, do the data giveconvincing evidence that the count of active cells is higher aftertreatment?

Page 36: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) The stem plot of differences shows an extreme right skew, andone or two high outliers. The t procedures should not be used.

0 0 0 1 2 2 3 81 02 1345 167 0

Page 37: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

b) 1. State hypotheses. H0 : µ = 0 vs Ha : µ > 0.2. Test statistic. t∗ = x̄−µ0

σ/√n

= 156.3636−0234.2952/

√11

= 2.2134

3. P-value. For df = 10, using Table C we have that:1.812 < t∗ < 2.228. Which implies that: 0.025 < P-value < 0.05.TI -84 gives 0.0256.4. Conclusion. We would have strong evidence against H0

(P-value < 0.05). We would conclude that the count of active cellsis higher after treatment.

Page 38: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Robust Procedures

A confidence interval or significance test is called robust if theconfidence level or P-value does not change very much when theconditions for use of the procedure are violated.

Page 39: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Using t procedures

I Except in the case of small samples, the condition that thedata are an SRS from the population of interest is moreimportant than the condition that the population distributionis Normal.

I Sample size less than 15: Use t procedures if the data appearclose to Normal (roughly symmetric single peak, no outliers).If the data are clearly skewed or if outliers are present, do notuse t.

I Sample size at least 15: The t procedures can be used exceptin the presence of outliers or strong skewness.

I Large samples: The t procedures can be used even for clearlyskewed distributions when the sample is large, roughly n ≥ 40.

Page 40: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

CHAPTER 19

TWO-SAMPLE PROBLEMS

Page 41: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Two-sample problems

I The goal of inference is to compare the responses to twotreatments or to compare the characteristics of twopopulations.

I We have a separate sample from each treatment or eachpopulation.

Page 42: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Conditions for inference comparing two means

I We have two SRSs, from two distinct populations. Thesamples are independent. That is, one sample has no influenceon the other. Matching violates independence, for example.We measure the same response variable for both samples.

I Both populations are Normally distributed. The means andstandard deviations of the populations are unknown. Inpractice, it is enough that the distributions have similarshapes and that the data have no strong outliers.

Page 43: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

The Two-Sample Procedures

Draw an SRS of size n1 from a Normal population with unknownmean µ1, and draw and independent SRS of size n2 from anotherNormal population with unknown mean µ2. A confidence intervalfor µ1 − µ2 is given by

(x̄1 − x̄2)± t∗

√s2

1

n1+

s22

n2

Here t∗ is the critical value for the t(k) density curve with area Cbetween −t∗ and t∗. The degrees of freedom k are equal to thesmaller of n1 − 1 and n2 − 1.

Page 44: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

The Two-Sample Procedures

To test the hypothesis H0 : µ1 = µ2, calculate the two-sample tstatistic

t∗ =x̄1 − x̄2√s2

1n1

+s2

2n2

and use P-values or critical values for the t(k) distribution.

Page 45: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Degrees of freedom (Option 1)

Option 1. With software, use the statistic t with accurate criticalvalues from the approximating t distribution.The distribution of the two-sample t statistic is very close to the tdistribution with degrees of freedom df given by

df =

(s2

1n1

+s2

2n2

)2

(1

n1−1

)(s2

1n1

)2+(

1n2−1

)(s2

2n2

)2

This approximation is accurate when both sample sizes n1 and n2

are 5 or larger.

Page 46: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Degrees of freedom (Option2)

Option 2. Without software, use the statistic t with critical valuesfrom the t distribution with degrees of freedom equal to thesmaller of n1 − 1 and n2 − 1. These procedures are alwaysconservative for any two Normal populations.

Page 47: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Logging in the rain forest

”Conservationists have despaired over destruction of tropical rainforest by logging, clearing, and burning”. These words begin areport on a statistical study of the effects of logging in Borneo.Here are data on the number of tree species in 12 unlogged forestplots and 9 similar plots logged 8 years earlier:Unlogged: 22 18 22 20 15 21 13 13 19 13 19 15Logged : 17 4 18 14 18 15 15 10 12Does logging significantly reduce the mean number of species in aplot after 8 years? State the hypotheses and do a t test. Is theresult significant at the 5% level?

Page 48: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

Does logging significantly reduce the mean number of species in aplot after 8 years?1. State hypotheses. H0 : µ1 = µ2 vs Ha : µ1 > µ2, where µ1 isthe mean number of species in unlogged plots and µ2 is the meannumber of species in plots logged 8 years earlier.2. Test statistic.t∗ = x̄1−x̄2√

s21n1

+s22n2

= 2.1140 (x̄1 = 17.5, x̄2 = 13.6666 ,

s1 = 3.5290, s2 = 4.5, n1 = 12 and n2 = 9)3. P-value. Using Table C, we have df = 8, and0.025 < P-value < 0.05.Using TI-84, we have df = 14.793443, and P-value = 0.02595.4. Conclusion. Since P-value < 0.05, we reject H0. There is strongevidence that the mean number of species in unlogged plots isgreater than that for logged plots 8 year after logging.

Page 49: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Logging in the rainforest, continued

Use the data from the previous exercise to give a 99% confidenceinterval for the difference in mean number of species betweenunlogged and logged plots.

Page 50: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

1. Find x̄1 − x̄2. From what we did earlier:x̄1 − x̄2 = 17.5− 13.6666 = 3.83342. Find SE = Standard Error. We already know that: s1 = 3.5290,s2 = 4.5, n1 = 12 and n2 = 9

SE =

√s2

1

n1+

s22

n2=

√3.52902

12+

4.52

9= 1.8132

3. Find m = t∗SE . From Table C, we have df = 8 and 99%confidence level, then t∗ = 3.355. Hence,m = (3.355)(1.8132) = 6.0832.4. Find Confidence Interval.x̄1 − x̄2 ± t∗SE = 3.8334± 6.0832 = −2.2498 to 9.9166.TI 84 gives a 99% confidence interval of −1.52 to 9.1871 species,using df = 14.793443.

Page 51: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Alcohol and zoning out

Healthy men aged 21 to 35 were randomly assigned to one of twogroups: half received 0.82 grams of alcohol per kilogram of bodyweight; half received a placebo. Participants were then given 30minutes to read up to 34 pages of Tolstoy’s War and Peace(beginning at chapter 1, with each page containing approximately22 lines of text). Every two to four minutes participants wereprompted to indicate whether they were ”zoning out”. Theproportion of time participants indicated they were zoning out wasrecorded for each subject. The table below summarizes data on theproportion of episodes of zoning out. (The study report gave thestandard error of the mean s/

√n, abbreviated as SEM, rather than

the standard deviation s.)

Page 52: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Alcohol and zoning out

Group n x̄ SEM

Alcohol 25 0.25 0.05

Placebo 25 0.12 0.03

a) What are the two sample standard deviations?b) What degrees of freedom does the conservative Option 2 use fortwo-sample t procedures for these samples?c) Using Option 2, give a 90% confidence interval for the meandifference between the two groups.

Page 53: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) Call group 1 the Alcohol group,and group 2 the Placebo group.Then, because SEM = s/

√n, we have s = SEM

√n. Hence,

s1 = 0.05√

25 = 0.5(5) = 0.25 ands2 = 0.03

√25 = 0.03(5) = 0.15.

b) Using the conservative option 2,df = min{25− 1, 25− 1} = min{24, 24} = 24.

c) Here, with n1 = n2 = 25, SE =√

s21n1

+s2

2n2

=√

0.0034 = 0.0583.

With df = 24, we have t∗ = 1.711, and a 90% confidence intervalfor the mean difference in proportions is given by0.25− 0.12± 1.711(0.0583) = 0.13± 0.0997, that is, from 0.0303to 0.2297.

Page 54: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Stress and weight in rats

In a study of the effects of stress on behavior in rats, 71 rats wererandomly assigned to either a stressful environment or a control(non stressful) environment. After 21 days, the change in weight(in grams) was determined for each rat. The table belowsummarizes data on weight gain. (The study report gave thestandard error of the mean s/

√n, abbreviated as SEM, rather than

the standard deviation s).

Page 55: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Stress and weight in rats

Group n x̄ SEM

Stress 20 26 3

No stress 51 32 2

a) What are the standard deviations for the two groups?b) What degrees of freedom does the conservative Option 2 use forthe two-sample procedures for these data?c) Test the null hypothesis of no difference between the two groupmeans against the two-sided alternative at the 5% significancelevel. Use the degrees of freedom from part b).

Page 56: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) Call group 1 the Stress group,and group 2 the No stress group.Then, because SEM = s/

√n, we have s = SEM

√n. Hence,

s1 = 3√

20 = 13.4164 and s2 = 2√

51 = 14.2828.b) Using the conservative option 2,df = min{20− 1, 51− 1} = min{19, 50} = 19.c) 1. Set hypotheses. H0 : µ1 = µ2 vs Ha : µ1 6= µ2

2. Calculate test statistic. With n1 = 20 and n2 = 51,

SE =√

s21n1

+s2

2n2

=√

12.9999 = 3.6055, t∗ = x̄1−x̄2SE = −1.6641.

3. P-value. With df = 19, using Table C, 0.10 < P-value < 0.20.Using TI-84 (2-SampTTest), P-value = 0.10454. Conclusion. Since P-value > 0.05 we CAN’T reject H0. There islittle evidence in support of a conclusion that mean weights of ratsin stressful environments differ from those of rats without stress.

Page 57: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

CHAPTER 20

INFERENCE ABOUT A POPULATION PROPORTION

Page 58: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Problem

A market research consultant hired by the Pepsi-Cola Co. isinterested in determining the proportion of UNM students whofavor Pepsi-Cola over Coke Classic. A random sample of 100students shows that 40 students favor Pepsi over Coke. Use thisinformation to construct a 95% confidence interval for theproportion of all students in this market who prefer Pepsi.

Page 59: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Bernoulli Distribution

xi =

{1 i-th person prefers Pepsi0 i-th person prefers Coke

µ = E (xi ) = pσ2 = V (xi ) = p(1− p), i.e. σ =

√p(1− p)

Let p̂ be our estimate of p. Note that p̂ =∑n

i=1 xi = x̄ . If n is”big”, by the Central Limit Theorem, we know that: x̄ is roughly

N(µ, σ√

n

), that is, p̂ is roughly N

(p,√

p(1−p)n

)

Page 60: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Sampling distribution of a sample proportion

Draw an SRS of size n from a large population that containsproportion p of successes. Let p̂ be the sample proportion ofsuccesses,

p̂ =number of successes in the sample

n

Then:

I The mean of the sampling distribution of p̂ is p.

I The standard deviation of the sampling distribution is√p(1−p)

n .

I As the sample size increases, the sampling distribution of p̂becomes approximately Normal. That is, for large n, p̂ hasapproximately the N(p,

√p(1− p)/n).

Page 61: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Large-sample confidence interval for a populationproportion

Draw an SRS of size n from a large population that contains anunknown proportion p of successes. An approximate level Cconfidence interval for p is

p̂ ± z∗√

p̂(1− p̂)

n

where z∗ is the critical value for the standard Normal density curvewith area C between −z∗ and z∗.Use this interval only when the numbers of successes and failuresin the sample are both 15 or greater.

Page 62: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Problem

A survey of 611 office workers investigated telephone answeringpractices, including how often each office worker was able toanswer incoming telephone calls and how often incoming telephonecalls went directly to voice mail. A total of 281 office workersindicated that they never need voice mail and are able to takeevery telephone call.a. What is the point estimate of the proportion of the populationof office workers who are able to take every telephone call?b. At 90% confidence, what is the margin of error?c. What is the 90% confidence interval for the proportion of thepopulation of office workers who are able to take every telephonecall?

Page 63: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

p = proportion of the population of office workers who are able totake every telephone call.a . p̂ = 281

611 = 0.46

b. Margin of error = z∗√

p̂(1−p̂)n = 1.645

√(0.46)(0.54)

611 =

1.645(0.0201) = 0.0330

c. p̂ ± z∗√

p̂(1−p̂)n

0.46± .0330From 0.4270 to 0.4930.We are 90% confident that the proportion of the population ofoffice workers who are able to take every phone call lies between42.70% and 49.30%.

Page 64: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Computer/Internet-based crime

With over 50% of adults spending more than an hour a day on theinternet, the number experiencing computer-or Internet- basedcrime continues to rise. A survey in 2010 of a random sample of1025 adults, aged 18 and older, reached by random digit dialingfound 113 adults in the sample who said that they or a householdmember had been the victim of a computer or Internet crime ontheir home computer in the past year. Give the 99% confidenceinterval for the proportion p of all households that haveexperienced computer or Internet crime during the year before thesurvey was conducted.

Page 65: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

p = proportion of all households that have experienced computeror Internet crime during the year before the survey was conducted.Step 1. Find p̂.

p̂ = number of successessample size

= 1131025 = 0.1102.

Step 2. Find m = margin of error

z∗√

p̂(1−p̂)n = 2.576

√0.1102(1−0.1102)

1025 = 2.576(0.0097) = 0.0249Step 3. Find confidence interval, i.e. p̂ −m and p̂ + m.p̂ −m = 0.1102− 0.0249 = 0.0853p̂ + m = 0.1102 + 0.0249 = 0.1351Based on this sample, we are 99% confident that between 8.53%and 13.51% of Internet users were victims of computer or Internetcrime during the year before this survey was taken.

Page 66: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Sample Size for desired margin of error

The level C confidence interval for a population proportion p willhave margin of error approximately equal to a specified value mwhen the sample size is

n =

(z∗

m

)2

p∗(1− p∗)

where p∗ is a guessed value for the sample proportion. The marginof error will always be less than or equal to m if you take the guessp∗ to be 0.5.

Page 67: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Problem

The percentage of people not covered by health care insurance in2003 was 15.6%. A congressional committee has been chargedwith conducting a sample survey to obtain more currentinformation.a. What sample size would you recommend if the committee’s goalis to estimate the current proportion of individuals without healthcare insurance with a margin of error of 0.03? Use a 95%confidence level.b. Repeat part a) assuming that you have no prior information (i.e.p∗ = 0.5).c. Repeat part a) using a 99% confidence level.d. Repeat part c) assuming that you have no prior information (i.e.p∗ = 0.5).

Page 68: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a. n =(z∗

m

)2p∗(1− p∗) =

(1.960.03

)2(0.156)∗(1− 0.156) = 563

b. n =(z∗

m

)2p∗(1− p∗) =

(1.960.03

)2(0.5)∗(1− 0.5) = 1068

c. n =(z∗

m

)2p∗(1− p∗) =

(2.5760.03

)2(0.156)∗(1− 0.156) = 971

c. n =(z∗

m

)2p∗(1− p∗) =

(2.5760.03

)2(0.5)∗(1− 0.5) = 1844

Page 69: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Graph of p∗(1− p∗)

0.0 0.2 0.4 0.6 0.8 1.0

0.00

0.05

0.10

0.15

0.20

0.25

p*

p*(1-p*)

p*=0.5

Page 70: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Canadians and doctor-assisted suicide

A Gallup Poll asked a sample of Canadian adults if they thoughtthe law should allow doctors to end the life of a patient who is ingreat pain and near death if the patient makes a request in writing.The poll included 270 people in Quebec, 221 of whom agreed thatdoctor-assisted suicide should be allowed.a) What is the margin of error of the large-sample 95% confidenceinterval for the proportion of all Quebec adults who would allowdoctor-assisted suicide?b) How large a sample is needed to get the common ±3percentage point margin of error? Use the previous sample as apilot study to get p∗.

Page 71: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) We find that p̂ = 221270 = 0.8185 and SEp̂ =

√p̂(1−p̂)

n = 0.0234.

Hence, the margin of error for 95% confidence is(1.96)(0.0234) = 0.0458.b) For a ±0.03 margin of error, we need

n =(

1.960.03

)2(0.8185)(1− 0.8185) = 634.1105. Round this up in

order to obtain a required sample size of 635.

Page 72: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Significance tests for a proportion

Draw an SRS of size n from a large population that contains anunknown proportion p of successes. To test the hypothesisH0 : p = p0, compute the z∗ statistic

z∗ =p̂ − p0√p0(1−p0)

n

Find P-values from the standard Normal distribution.Use this test when the sample size n is so large that both np0 andn(1− p0) are 10 or more.

Page 73: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

P-values

To test the hypothesis H0 : p = p0, compute the z∗ statistic

z∗ =p̂ − p0√p0(1−p0)

n

In terms of a variable Z having the standard Normal distribution,the approximate P-value for a test of H0 againstHa : p > p0 is P(Z > z∗)Ha : p < p0 is P(Z < z∗)Ha : p 6= p0 is 2P(Z > |z∗|)

Page 74: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Problem

A study found that, in 2005, 12.5% of U.S. workers belonged tounions. Suppose a sample of 400 U.S. workers is collected in 2006to determine whether union efforts to organize have increasedunion membership.a. Formulate the hypotheses that can be used to determinewhether union membership increased in 2006.b. If the sample results show that 52 of the workers belonged tounions, what is the p-value for your hypothesis test?c. At α = 0.05, what is your conclusion?

Page 75: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

p = proportion of all U.S. workers who belonged to a union in2006.a.H0 : p = 0.125 vs Ha : p > 0.125b . p̂ = 52

400 = 0.13

z∗ = p̂−p0√p0(1−p0)

n

= 0.13−0.125√(0.125)(0.875)

400

= 0.30

Using Table A,P-value = P(Z > z∗) = P(Z > 0.30) = 1− 0.6179 = 0.3821c. P-value > 0.05, do not reject H0. We cannot conclude thatthere was an increase in union membership.

Page 76: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Problem

A study by Consumer Reports showed that 64% of supermarketshoppers believe supermarket brands to be as good as nationalname brands. To investigate whether this result applies to its ownproduct, the manufacturer of a national name-brand ketchup askeda sample of shoppers whether they believed that supermarketketchup was as good as the national brand ketchup.a. Formulate the hypotheses that could be used to determinewhether the percentage of supermarket shoppers who believe thatthe supermarket ketchup was as good as the national brandketchup differed from 64%.b. If a sample of 100 shoppers showed 52 stating that thesupermarket brand was as good as the national brand, what is thep-value?c. At α = 0.05, what is your conclusion?

Page 77: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

p = proportion of all shoppers who believe supermarket brands tobe as good as this particular national brand ketchup.a.H0 : p = 0.64 vs Ha : p 6= 0.64b . p̂ = 52

100 = 0.52

z∗ = p̂−p0√p0(1−p0)

n

= 0.52−0.64√(0.64)(0.36)

100

= −2.50

Using Table A, P-value = 2P(Z > |z∗|) = 2P(Z > | − 2.50|) =2P(Z > 2.50) = 2(0.0062) = 0.0124c. P-value < 0.05, reject H0. Proportion differs from the reported0.64.

Page 78: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Problem

The National Center for Health Statistics released a report thatstated 70% of adults do not exercise regularly. A researcher decidedto conduct a study to see whether the claim made by the NationalCenter for Health Statistics differed on a state-by-state basis.a. State the null and alternative hypotheses assuming the intent ofthe researcher is to identify states that differ from 70% reported bythe National Center for Health Statistics.b. At α = 0.05, what is the research conclusion for the followingstates?: Wisconsin: 252 of 350 adults did not exercise regularly.California: 189 of 300 adults did not exercise regularly.

Page 79: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution (Wisconsin)

p = proportion of all adults in the state of Wisconsin that do notexercise regularly.a.H0 : p = 0.70 vs Ha : p 6= 0.70b. (Wisconsin) p̂ = 252

350 = 0.72

z∗ = p̂−p0√p0(1−p0)

n

= 0.72−0.70√(0.70)(0.30)

350

= 0.82

Using Table A, P-value = 2P(Z > |z∗|) = 2P(Z > |0.82|) =2P(Z > 0.82) = 2(0.2061) = 0.4122c. P-value > 0.05, do not reject H0. We don’t have evidence toclaim that Wisconsin is one of those states where the proportion ofadults that do not exercise regularly differs from 70%.

Page 80: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution (California)

p = proportion of all adults in the state of California that do notexercise regularly.a.H0 : p = 0.70 vs Ha : p 6= 0.70b. (California) p̂ = 189

300 = 0.63

z∗ = p̂−p0√p0(1−p0)

n

= 0.63−0.70√(0.70)(0.30)

300

= −2.65

Using Table A, P-value = 2P(Z > |z∗|) = 2P(Z > | − 2.65|) =2P(Z > 2.65) = 2(1− 0.9960) = 0.0080c. P-value < 0.05, we reject H0. We have strong evidence to claimthat California’s proportion of adults that do not exercise regularlydiffers from 70%.

Page 81: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

CHAPTER 23

TWO CATEGORICAL VARIABLES: THE CHI-SQUARE TEST

Page 82: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Problem

A sample of 70 girls and boys was taken at random from apopulation of children (perhaps of a particular age of interest), andthen the numbers of right-handed boys, right-handed girls,left-handed boys, and left-handed girls were recorded as shownbelow:

Girls Boys Total

Left-handed 12 6 18

Right-handed 24 28 52

Total 36 34 70

Is there evidence that, in the sampled population, handedness isindependent of sex? (Use α = 0.05)

Page 83: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Step 1. State Hypotheses

H0 : In the sampled population, there is NO relationship betweenhandedness and sex.

Ha : In the sampled population, there is a relationship betweenhandedness and sex.

Page 84: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Step 2. Compute test statistic.

Draw an SRS from a large population and make a two-way table ofthe sample counts for two categorical variables. To test the nullhypotheses H0 that there is no relationship between the row andcolumn variables in the population, calculate the chi-squarestatistic

X 2 =∑ ( observed count - expected count )2

expected count

The sum is over all cells in the table.The chi-square test rejects H0 when χ2 is large. Sofware findsP-values from a chi-square distribution.

Page 85: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Step 2. (cont.)

Expected Counts.P(left-handed) = 18

70 P(right-handed) = 5270

Expected number of left-handed girls =number of girls× P(left-handed) = (36)( 18

70 ) = (36)(18)70 = 9.26.

Expected number of right-handed girls =number of girls× P(right-handed) = (36)( 52

70 ) = (36)(52)70 = 26.74.

Expected number of left-handed boys =number of boys× P(left-handed) = (34)( 18

70 ) = (34)(18)70 = 8.74.

Expected number of right-handed boys =number of boys× P(right-handed) = (34)( 52

70 ) = (34)(52)70 = 25.26.

Page 86: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Expected Counts

The expected counts in any cell of a two-way table when H0 is trueis:

expected count =row total x column total

table total

Page 87: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Table of Expected Counts

Girls Boys Total

Left-handed 9.26 8.74 18

Right-handed 26.74 25.26 52

Total 36 34 70

Page 88: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

X 2 = (12−9.26)2

9.26 + (24−26.74)2

26.74 + (6−8.74)2

8.74 + (28−25.26)2

25.26

X 2 = 0.8107 + 0.2807 + 0.8589 + 0.2972 = 2.2475

(Using TI-84, X 2 = 2.2523).

Page 89: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Step 3. Find P-value

d.f. = (r − 1)(c − 1) = (2− 1)(2− 1) = 1

Using Table D, 2.07 < X 2 = 2.2475 < 2.71 which implies that0.10 < P-value < 0.15. (Using TI-84,P-value = 0.1334.)

Page 90: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Step 4. Conclusion

Since P-value > 0.10 > 0.05 = α, we CAN’T reject H0. Weconclude that there is NO relationship between handedness andsex.

Page 91: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Example

Suppose the Federal Correction Agency wants to investigate thefollowing question: Does a male released from federal prison makebetter adjustment to civilian life if he returns to his hometown or ifhe goes elsewhere to live? To put it another way, is there arelationship between adjustment to civilian life and place ofresidence after release from prison?The agency’s psychologists interviewed 200 randomly selectedformer prisoners. Using a series of questions, the psychologistsclassified the adjustment of each individual to civilian life as beingoutstanding, good, fair, or unsatisfactory. The counts are given inthe following contingency table.Examine the hypothesis that there is no relationship betweenadjustment to civilian life and place of residence after release fromprison. Test at the α = 0.01 level.

Page 92: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Table of observed counts

Outstanding Good Fair Unsatisfactory Total

Hometown 27 35 33 25 120

Not hometown 13 15 27 25 80

Total 40 50 60 50 200

Page 93: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Step 1. State hypotheses

H0 : There is NO relationship between adjustment to civilian lifeand where the individual lives after being released from prison.

Ha : There is a relationship between adjustment to civilian life andwhere the individual lives after being released from prison.

Page 94: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Table of EXPECTED counts

Outstanding Good Fair Unsatisfactory Total

Hometown 24 30 36 30 120

Not hometown 16 20 24 20 80

Total 40 50 60 50 200

Page 95: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Step 2. Compute test statistic.

X 2 = (27−24)2

24 + (35−30)2

30 + (33−36)2

36 + (25−30)2

30 + (13−16)2

16 +(15−20)2

20 + (27−24)2

24 + (25−20)2

20

X 2 = 0.375 + 0.833 + 0.250 + 0.833 + 0.563 + 1.250 + 0.375 + 1.250X 2 = 5.729

(Using TI-84, X 2 = 5.7291).

Page 96: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Step 3. Find P-value

d.f. = (r − 1)(c − 1) = (2− 1)(4− 1) = 3

Using Table D, 5.32 < X 2 = 5.729 < 6.25 which implies that0.10 < P-value < 0.15. (Using TI-84,P-value = 0.1255.)

Page 97: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Step 4. Conclusion

Since P-value > 0.10 > 0.01 = α, we CAN’T reject H0. Weconclude that there is NO relationship between adjustment tocivilian life and where the prisoner resides after being released fromprison. For the Federal Correction Agency’s advisement program,adjustment to civilian life is not related to where the ex-prisonerlives after being released.

Page 98: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Cell counts required for the chi-square test

You can safely use the chi-square test with P-values from thechi-square distribution when no more than 20% of the expectedcounts are less than 5 and all individual expected counts are 1 orgreater. In particular, all four expected counts in a 2 × 2 tableshould be 5 or greater.

Page 99: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Majors for men and women in business

A study of the career plans of young women and men sentquestionnaires to all 722 members of the senior class in the Collegeof Business Administration at the University of Illinois. Onequestion asked which major within the business program thestudent had chosen. Here are the data from the students whoresponded:

Female Male Total

Accounting 68 56 124

Administration 91 40 131

Economics 5 6 11

Finance 61 59 120

Total 225 161 386

This is an example of a single sample classified according to twocategorical variables (gender and major).

Page 100: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Majors for men and women in business (cont.)

a) Test the null hypothesis that there is no relationship betweenthe gender of students and their choice of major. Give a P-valueand state your conclusion(Use α = 0.05.)b) Verify that the expected cell counts satisfy the requirement foruse of chi-square.c) Which two cells have the largest terms in the chi-squarestatistic? How do observed and expected counts differ in thesecells?

Page 101: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

a) Step 1. State Hypotheses.H0 : There is NO relationship between gender and choice of major.

Ha : There is a relationship between gender and choice of major.

Page 102: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

Expected counts.

Female Male Total

Accounting 72.28 51.72 124

Administration 76.36 54.64 131

Economics 6.41 4.59 11

Finance 69.95 50.05 120

Total 225 161 386

Page 103: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

Step 2. Compute test statistic.

X 2 = (68−72.28)2

72.28 + (56−51.72)2

51.72 + (91−76.36)2

76.36 + (40−54.64)2

54.64 +(5−6.41)2

6.41 + (6−4.59)2

4.59 + (61−69.95)2

69.95 + (59−50.05)2

50.05

X 2 = 0.253 + 0.354 + 2.807 + 3.923 + 0.311 + 0.434 + 1.145 + 1.600X 2 = 10.827

Page 104: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

Step 3. Find P-value.d.f. = (r − 1)(c − 1) = (2− 1)(4− 1) = 3

Using Table D, 9.84 < X 2 = 10.827 < 11.34 which implies that0.01 < P-value < 0.02. (Using TI-84,P-value = 0.0127.)

Page 105: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Solution

Step 4. Conclusion.Since P-value < 0.05, we reject H0. We have fairly strong evidencethat gender and choice of major are related.b) One expected count is less than 5, which is only one-eight(12.5%) of the counts in the table, so the chi-square procedure isacceptable.c) The largest chi-square components are the two from the”Administration” row. Many more women than we expect (91actual, 76.36 expected) chose this major, whereas only 40 menchose this (54.64 expected).

Page 106: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

The Chi-square distributions

The chi-square distributions are a family of distributions that takeonly positive values and are skewed to the right. A specificchi-square distribution is specified by giving its degrees of freedom.The chi-square test for a two-way table with r and c columns usescritical values from the chi-square distribution with (r-1)(c-1)degrees of freedom. The P-value is the area under the densitycurve of this chi-square distribution to the right of the value of thetest statistic.

Page 107: STAT 145 (Notes) - UNM Mathmath.unm.edu/~alvaro/stat145-p4.pdf · STAT 145 (Notes) Al Nosedal ... 63.4 65 64.4 63.3 54.8 64.5 60.8 49.1 51.0 ... a 90% con dence interval to estimate

Density curves

0 5 10 15 20

0.0

0.1

0.2

0.3

0.4

0.5 df=1

df=4df=8