Confidence Intervals and Hypothesis tests with Proportions.

45
Confidence Intervals and Hypothesis tests with Proportions

Transcript of Confidence Intervals and Hypothesis tests with Proportions.

Confidence Intervals and Hypothesis tests

with Proportions

What happens to your confidence as the interval gets smaller?

Your confidence level decreases with smaller intervals

%%

%%

Confidence level

• Is the success rate of the method used to construct the interval

• Using this method, ____% of the time the intervals constructed will contain the true population parameter

• Found from the confidence level• The upper z-score with probability p lying to

its right under the standard normal curve

Confidence level tail area z*

.05 1.645

.025 1.96

.005 2.576

Critical value (z*)

.05

z*=1.645

.025

z*=1.96

.005

z*=2.57690%95%99%

Confidence interval for a population proportion:

npp 1p̂ *z

Statistic + Critical value × Standard deviation of the statistic

Margin of error

npp ˆ1ˆ

But do we know the population proportion?

What are the steps for performing a confidence interval?

1.) Assumptions• SRS of context• Approximate Normal distribution because

np > 10 & n(1-p) > 10• Population is at least 10n

2.) Calculations

3.) Conclusion

We are ________% confident that the true proportion context is between ______ and ______.

• As the confidence level increases, do the intervals generally get wider or more narrow? Explain.

• As the sample size increases, do the intervals generally get wider or more narrow? Explain.

• When 100 confidence intervals are generated, why are they all different?

• If the confidence level selected is 90%, about how many of 100 intervals will cover the true percentage of

orange balls? Will exactly this number of intervals cover the true percentage each time 100 intervals are

created? Explain.

A May 2000 Gallup Poll found that 38% of a random sample of 1012 adults said that they believe in ghosts. Find a 95% confidence interval for the true proportion of adults who believe in ghost.

Assumptions:

•Have an SRS of adults

•np =1012(.38) = 384.56 & n(1-p) = 1012(.62) = 627.44 Since both are greater than 10, the distribution can be approximated by a normal curve

•Population of adults is at least 10,120.

41,.35.1012

)62(.38.96.138.

1*ˆ

npp

zP

We are 95% confident that the true proportion of adults who believe in ghosts is between 35% and 41%.

Step 1: check assumptions!

Step 2: make calculations

Step 3: conclusion in context

The manager of the dairy section of a large supermarket took a random sample of 250 egg cartons and found that 40 cartons had at least one broken egg. Find a 90% confidence interval for

the true proportion of egg cartons with at least one broken egg.

Assumptions:

•Have an SRS of egg cartons

•np =250(.16) = 40 & n(1-p) = 250(.84) = 210 Since both are greater than 10, the distribution can be approximated by a normal curve

•Population of cartons is at least 2500.

198,.122.250

)84(.16.645.116.

We are 90% confident that the true proportion of egg cartons with at least one broken egg is between 12.2% and 19.8%.

Step 1: check assumptions!

Step 2: make calculations

Step 3: conclusion in context

Another Gallop Poll is taken in order to measure the proportion of adults who approve of attempts to clone humans. What sample size is necessary to be within + 0.04 of the true proportion of adults who approve of attempts to clone humans with a 95% Confidence Interval?

To find sample size:

However, since we have not yet taken a sample, we do not know a p-hat (or p) to use!

npp

zm1

*

Another Gallop Poll is taken in order to measure the proportion of adults who approve of attempts to clone humans. What sample size is necessary to be within + 0.04 of the true proportion of adults who approve of attempts to clone humans with a 95% Confidence Interval?

60125.600

25.96.104.

5.5.96.104.

5.5.96.104.

1*

2

n

n

n

n

npp

zm

Use p-hat = .5

Divide by 1.96

Square both sides

Round up on sample size

What are hypothesis tests?

Calculations that tell us if the sample statistics (p-hat) occurs by random chance or not OR . . . if it is statistically significantIs it . . .

–a random occurrence due to natural variation?

–an occurrence due to some other reason?

Statistically significant means that it is NOT a random chance

occurrence!

Is it one of the sample

proportions that are likely to

occur?Is it one that isn’t likely to

occur?

These calculations (called the test statistic) will tell

us how many standard deviations a sample

proportion is from the population proportion!

Steps:

1) Assumptions2) Hypothesis statements &

define parameters3) Calculations4) Conclusion, in context

Assumptions for z-test:

• Have an SRS of context• Distribution is (approximately)

normal because both np > 10 and n(1-p) > 10

• Population is at least 10n

YEA –These are the same

assumptions as confidence intervals!!

How to write hypothesis statements• Null hypothesis – is the statement

(claim) being tested; this is a statement of “no effect” or “no difference”

• Alternative hypothesis – is the statement that we suspect is true

H0:

Ha:

How to write hypotheses:Null hypothesis H0: parameter = hypothesized value

Alternative hypothesis Ha: parameter > hypothesized value Ha: parameter < hypothesized value Ha: parameter = hypothesized value

Facts to remember about hypotheses:• Hypotheses ALWAYS refer to

populations (use parameters – never statistics)

• The alternative hypothesis should be what you are trying to prove!

• ALWAYS define your parameter in context!

Activity: For each pair of hypotheses, indicate which are not legitimate & explain why

1H1H e)

6H4H d)

1H1H c)

123H123H b)

15H15H a)

a0

a0

a0

a0

a0

.ˆ:;.ˆ:

.:;.:

.:;.:

:;:

:;:

pp

pp

xx

Must use parameter (population) x is a statistics

(sample)

p is the population proportion!

Must use same number as H0!P-hat is a statistic – Not a

parameter!

Must be NOT equal!

P-value -

• Assuming H0 is true, the probability that the statistic would have a value as extreme or more than what is actually observed

Notice that this is a conditional probability

The statistic is our p-hat!

Why not find the probability that the p-hat equals a certain value?

Remember that in continuous distributions, we cannot find

probabilities of a single value!

P-values -

• Assuming H0 is true, the probability that the statistic would have a value as extreme or more than what is actually observedIn other words . . . What

is the probability of getting values more (or

less) than our p-hat?p̂p̂

We can use normalcdf to find this probability.

Level of significance - • Is the amount of evidence

necessary before we begin to doubt that the null hypothesis is true

• Is the probability that we will reject the null hypothesis, assuming that it is true

• Denoted by a–Can be any value–Usual values: 0.1, 0.05, 0.01–Most common is 0.05

Statistically significant –• Our statistic (p-hat) is statistically

significant if the p-value is as small or smaller than the level of significance (a).

Decisions:• If p-value < a, “reject” the null

hypothesis at the a level.• If p-value > a, “fail to reject” the null

hypothesis at the a level.

Our “guilty” verdict.Our “not guilty” verdict.

Remember that the verdict is never “innocent” – so we can never decide

that the null is true!

Facts about p-values:• ALWAYS make the decision about

the null hypothesis!• Large p-values show support for

the null hypothesis, but never that it is true!

• Small p-values show support that the null is not true.

• Double the p-value for two-tail (≠) tests

• Never accept the null hypothesis!

Never “accept” the null hypothesis!

Never “accept” the null hypothesis!

Never “accept” the null hypothesis!

Calculating p-values• For z-test statistic (z) ––Use normalcdf(lb,ub) to find the probability of the test statistic or more extreme

–Remember the standard normal curve is comprised of z’s where m = 0 and s = 1

We will see how to compute this value

tomorrow.

Since we are in the standard normal curve,

we do not need , m s here.

Writing Conclusions:

1) A statement of the decision being made (reject or fail to reject H0) & why (linkage)

2) A statement of the results in context. (state in terms of Ha)

AND

“Since the p-value < (>) a, I reject (fail to reject) the H0. There is (is not) sufficient evidence to suggest that Ha.” Be sure to write Ha in

context (words)!

Formula for hypothesis test:statistic - parameter

Test statisticSD of parameter

z npp

pp

1

ˆ p̂ pp ˆ

Example 5: A company is willing to renew its advertising contract with a local radio station only if the station can prove that more than 20% of the residents of the city have heard the ad and recognize the company’s product. The radio station conducts a random sample of 400 people and finds that 90 have heard the ad and recognize the product. Is this sufficient evidence for the company to renew its contract?

Assumptions:

•Have an SRS of people

•np = 400(.2) = 80 & n(1-p) = 400(.8) = 320 - Since both are greater than 10, this distribution is approximately normal.

•Population of people is at least 4000.

H0: p = .2 where p is the true proportion of people who

Ha: p > .2 heard the ad

05.1056.25.1

400)8(.2.

2.225.

valuepz

Since the p-value > a, I fail to reject the null hypothesis. There is not sufficient evidence to suggest that the true proportion of people who heard the ad is greater than .2. The company will not renew their advertising contract with the radio station.

Use the parameter in the null hypothesis to check assumptions!

Use the parameter in the null hypothesis to calculate standard

deviation!

Calculate the appropriate confidence interval for the above problem.

CI = (.19066,.25934)

How do the results from the confidence interval compare to the results of the hypothesis test?

The confidence interval contains the parameter of .2 thus providing no evidence that more than 20% had heard the ad.

Two-Sample Proportions

Inference

Assumptions:

• Two, independent SRS’s from populations ( or randomly assigned treatments)

• Populations at least 10n• Normal approximation for both

1 1

1 1

10

1 10

n p

n p

2 2

2 2

10

1 10

n p

n p

Formula for confidence interval:

statistic of SD valuecritical statisticCI

21 ˆˆ pp *z 2

22

1

11 ˆ1ˆˆ1ˆ

npp

npp

Note: use p-hat when p is not known

Standard error!

Margin of error!

Example 1: At Community Hospital, the burn center is experimenting with a new plasma compress treatment. A random sample of 316 patients with minor burns received the plasma compress treatment. Of these patients, it was found that 259 had no visible scars after treatment. Another random sample of 419 patients with minor burns received no plasma compress treatment. For this group, it was found that 94 had no visible scars after treatment. What is the shape & standard error of the sampling distribution of the difference in the proportions of people with no visible scars between the two groups?

Since n1p1=259, n1(1-p1)=57, n2p2=94, n2(1-p2)=325 and all > 10, then the distribution of difference

in proportions is approximately normal.

0296.0419

)78(.22.316

)18(.82...

ES

Example 1: At Community Hospital, the burn center is experimenting with a new plasma compress treatment. A random sample of 316 patients with minor burns received the plasma compress treatment. Of these patients, it was found that 259 had no visible scars after treatment. Another random sample of 419 patients with minor burns received no plasma compress treatment. For this group, it was found that 94 had no visible scars after treatment. What is a 95% confidence interval of the difference in proportion of people who had no visible scars between the plasma compress treatment & control group?

Assumptions:

•Have 2 independent randomly assigned treatment groups

•Both distributions are approximately normal since n1p1=259, n1(1-p1)=57, n2p2=94, n2(1-p2)=325 and all > 5

•Population of burn patients is at least 7350.

Since these are all burn patients, we can add 316 + 419 = 735.

If not the same – you MUST list separately.

654.,537.419

78.22.316

18.82.96.122.82.

11*ˆˆ

2

22

1

1121

n

ppnpp

zpp

We are 95% confident that the true the difference in proportion of people who had no visible scars between the plasma compress treatment & control group is between 53.7% and 65.4%

Example 2: Suppose that researchers want to estimate the difference in proportions of people who are against the death penalty in Texas & in California. If the two sample sizes are the same, what size sample is needed to be within 2% of the true difference at 90% confidence?

nn)5(.5.)5(.5.

645.102. n25.25.

645.102.

Since both n’s are the same size, you have common denominators – so add!

n = 3383

Hypothesis statements:

H0: p1 - p2 = 0

Ha: p1 - p2 > 0

Ha: p1 - p2 < 0

Ha: p1 - p2 ≠ 0

Be sure to define

both p1 & p2!

H0: p1 = p2

Ha: p1 > p2

Ha: p1 < p2 Ha: p1 ≠ p2

Since we assume that the population proportions are equal in the null hypothesis, the variances are equal.

Therefore, we pool the variances!

21

21ˆnnxx

p

Formula for Hypothesis test:

statistic of SD

parameter - statisticstatisticTest

z

21

2121

11ˆ1ˆ

ˆˆ

nnpp

pppp

Usually p1 – p2 =0

Example 4: A forest in Oregon has an infestation of spruce moths. In an effort to control the moth, one area has been regularly sprayed from airplanes. In this area, a random sample of 495 spruce trees showed that 81 had been killed by moths. A second nearby area receives no treatment. In this area, a random sample of 518 spruce trees showed that 92 had been killed by the moth. Do these data indicate that the proportion of spruce trees killed by the moth is different for these areas?

Assumptions:

•Have 2 independent SRS of spruce trees

•Both distributions are approximately normal since n1p1=81, n1(1-p1)=414, n2p2=92, n2(1-p2)=426 and all > 10

•Population of spruce trees is at least 10,130.H0: p1=p2 where p1 is the true proportion of trees killed by moths Ha: p1≠p2 in the treated area p2 is the true proportion of trees killed by moths in the untreated area

59.0

5181

4951

83.17.

18.16.

11ˆ1ˆ

ˆˆ

21

21

nnpp

ppz P-value =

0.5547

a = 0.05

Since p-value > a, I fail to reject H0. There is not sufficient evidence to suggest that the proportion of spruce trees killed by the moth is different for these areas