1 topic 6 - confidence intervals based on a single sample sampling distribution of the sample mean...

30
1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence interval for a population mean Confidence interval for a population variance Confidence interval for a population proportion

Upload: jemimah-terry

Post on 18-Jan-2016

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1

Topic 6 - Confidence intervals based on a single sample• Sampling distribution of the sample mean

• Sampling distribution of the sample variance

• Confidence interval for a population mean

• Confidence interval for a population variance

• Confidence interval for a population proportion

Page 2: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

22

Confidence Intervals• To use the CLT in our examples, we had to know the

population mean, , and the population standard deviation, .

• It is okay to estimate the population parameters if we have a huge amount of sample data, using and s respectively.

• In most cases, the primary goal of the analysis of our sample data is to estimate and to determine a range of likely values for these population values.

x

Page 3: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

33

Confidence interval for with known

• Suppose for a moment we know but not

• The CLT says that is approximately normal with a mean of and a variance of 2/n.

• So, will be standard normal.

• For the standard normal distribution, let z be such that

P(Z > z) =

X

xZ

n

Page 4: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

44

Confidence interval for with known• Safety tip…..When working with Confidence

Intervals, alpha is the total area of the curve outside the upper and lower boundaries.

For example, if you want a 95% confidence interval, the area between the extremes, limits or boundaries specified is 95% and the area outside, or alpha, is 5%.

/2 /2 /2( )P x Z x Z x Zn n n

Page 5: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

55

Confidence interval for with unknown

• For large samples (n ≥ 30), we can replace with s, so that is a (1-)100% confidence interval for .

• For small samples (n < 30) from a normal population,

is a (1-)100% confidence interval for .

• The value t,n-1 is the appropriate quantile from a t distribution with n-1 degrees of freedom.

• Demonstration of the t distribution calculator

/ 2x z s n

/ 2, 1nx t s n

Page 6: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

66

Acid rain data

• The EPA states that any area where the average pH of rain is less than 5.6 on average has an acid rain problem. The pH values collected at Shenandoah National Park are listed below.

• Calculate 95% and 99% confidence intervals for the average pH of rain in the park.

Page 7: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

77

Acid rain calculations by handSummary statistics:Column n Mean Variance Std. Dev.pH_level 90 4.5779 0.0836 0.2892

/2

0.28924.5779 (1.96)( ) 4.5182;4.6377

90

sx Z

n

Page 8: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

88

Light bulb data• The lifetimes in days of 10 light bulbs of a certain variety are

given below. Give a 95% confidence interval for the expected lifetime of a light bulb of this type. Do you trust the interval?

Summary statistics:Column n Mean Variance Std. Dev.lifetime 10 0.5580 0.9767 0.9883

.025 .025,91.96 2.2622

Using Z Using T

0.9883 0.98830.5580 1.96 0.5580 2.2622

10 10

( 0.0545;1.1705)

Z T

( 0.1499;1.2650)

Page 9: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

99

Interpreting confidence statements• For any % CI, a valid interpretation is, “If we perform

this study a large number of times, we would expect the estimated parameter to fall within our confidence interval that % of the time.” The “confidence” deals with the long-term view, not the percentage on any specific trial.

• Run the confidence interval applet in StatCrunch.

Page 10: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1010

Sample size effect• As sample size increases, the width of our confidence

interval clearly decreases (of course, as long as you’re dealing with sample means).

• If is known, the width of our interval for is

• Solving for n,

• If is known or we have a good estimate, we can use this formula to decide the sample size we need to obtain a certain interval length.

/ 22L zn

2/ 2(2 )n z

L

Page 11: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1111

Paint example

• Suppose we know from past data that the standard deviation of the square footage covered by a one gallon can of paint is somewhere between 2 and 4 square feet.

• How many one gallon cans do we need to test so that the width of a 95% confidence interval for the mean square footage covered will be at most 1 square foot?

2/ 2(2 )n z

L

Page 12: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1212

Additional sample size problem

We buy sacks of flour from a vendor that claims the average bag weighs 100 lbs. with a standard deviation of 2 lbs.

How many bags do we need to sample to estimate the actual average weight of bags from this vendor to within 0.5 lb. with 90% confidence?

How about with 95% confidence?

2/ 2(2 ) 61.4656 62n z

L

2 2/ 2

2(2 ) [2(1.645)( )] 43.2964 44

1n z

L

Page 13: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1313

Confidence interval for a variance

• In many cases, especially in manufacturing, understanding variability is very important.

• Often times, the goal is to reduce the variability in a system.• For samples from a normal population,

is a (1-)100% confidence interval for 2.

• The value ,n-1 is the appropriate quantile from a

distribution with n-1 degrees of freedom.

2 2

2 2/ 2, 1 1 ( / 2), 1

( 1) ( 1),

n n

n s n s

Page 14: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1414

Acid rain data• Calculate a 95% confidence interval for the variance of pH of

rain in the park.

• We have everything but the Chi-square values.

2 2

2 2/ 2, 1 1 ( / 2), 1

( 1) ( 1),

n n

n s n s

Summary statistics:Column n Mean Variance Std. Dev.pH_level 90 4.57789 0.08363 0.28919

Page 15: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1515

95% Chi-square values;

2 20.025,89 0.975,8964.79336, 116.98908

Summary statistics:Column n Mean Variance Std. Dev.pH_level 90 4.57789 0.08363 0.28919

Page 16: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1616

95% Chi-square values;2 20.025,89 0.975,8964.79336, 116.98908

(90 1)0.08363 (90 1)0.08363

,116.98908 64.79336

0.06362;0.11487

Summary statistics:Column n Mean Variance Std. Dev.pH_level 90 4.57789 0.08363 0.28919

Page 17: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1717

Confidence interval for a proportion

• A binomial random variable, X, counts the number of successes in n Bernoulli trials where the probability of success on each trial is p.

• In sampling studies, we are often times interested in the proportion of items in the population that have a certain characteristic.

• We think of each sample, Xi, from the population as a Bernoulli trial, the selected item either has the characteristic (Xi = 1) or it does not (Xi = 0).

• The total number with the characteristic in the sample is then

1

n

ii

X X

Page 18: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1818

Confidence interval for a proportion

• The proportion in the sample with the characteristic is then

• The CLT says that the distribution of this sample proportion is then normally distributed for large n with

• For the CLT to work well here, we need– X ≥ 5 and n-X ≥ 5– n to be much smaller than the population size

1

ˆ / /n

ii

p X n X n

( / ) ( ) 0(1 ) 1E X n E X p p p 2 2 2 2 2( ) ( ) ( ) 0 (1 ) 1 (1 )

( / )Var X E X E X p p p p p

Var X nn n n n

Page 19: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

1919

Confidence interval for a proportion• Example: In a survey of 277 randomly selected

shoppers, 69 stated that if the advertised item is unavailable, they request a rain check. Construct a 95% CI for µ.

• What is the underlying distribution? What is ? What is ?

p̂p

69ˆ 0.249

277

xp

n

ˆ 277(.249) 69 5

ˆ 277(.751) 208 5

np

nq

/2ˆ ˆ( )ˆ

(0.249*0.751)0.249 1.96 2770.249 0.051 or (0.198;0.300)

pqp Z n

Page 20: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2020

Murder case example

• Find a 95% confidence interval for the proportion of African Americans in the jury pool. (22 out of 295 African American in sample)

/2

0.074576 0.925424ˆ ˆ 22ˆ 1.96

295 295

.074576 0.02998 0.0446;0.10456

pqp Z

n

Page 21: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2121

Sample size considerations

• The width of the confidence interval is

• To get the sample size required for a specific length, we have

/ 2 ˆ ˆ2 (1 )/L z p p n

2/ 2

2 2/ 2

ˆ ˆ(2 / ) (1 )

or sometimes written as...

ˆ ˆ = 4 /

n z L p p

n Z pq L

Page 22: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2222

CI sample size with no clue for actual proportion

• Often in TV/Media polls, they talk about a margin of error of +/- 3%. This margin of error is actually a 95% confidence interval. How large of a sample do we need to have to result in a margin of error of 3%?

• How do we continue? What is ? We have a catch-22 situation, because to find the sample size we need an estimate of the population proportion and vice-versa.

2/2 2

22

3% .06

ˆ ˆ4

ˆ ˆ4(1.96 )

.06

L

pqn Z

Lpq

n

Page 23: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2323

CI sample size – “no clue for p” (cont)

So, if you have a good supportable estimate for the populationproportion, use it. If not, you 0.50.

Page 24: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2424

Nurse employment caseHow many sample records should be considered if we want the 95% confidence interval for the proportion all her records handled in a timely fashion to be 0.02 wide?

Where did the .9 come from? That was the original percentage from the nurses contract in Topic 3. If that wasn’t in place on average, there would be chaos in the hospital.

The additional file for Topic 6 contains examples of confidence intervals, sample size calculations and prediction intervals.

2/2 2 2

ˆ ˆ .9(.1)4 4(1.96)( ) 3457.44 3458

.02

pqn Z

L

Page 25: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2525

Prediction intervals

• Sometimes we are not interested in a confidence interval for a population parameter but rather we are interested in a prediction interval for a new observation.

• For our light bulb example, we might want a 95% prediction interval for the time a new light bulb will last.

• For our paint example, we might want a 95% prediction interval for the amount of square footage a new can of paint will cover.

Page 26: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2626

Prediction intervals

• Given a random sample of size n, our best guess at a new observation, xn+1, would be the sample mean, .

• Now consider the difference, .

X

1nx X

1( )nE x X

1( )nVar x X

Page 27: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2727

Prediction intervals• If is known and our population is normal, then using a

pivoting procedure gives

• If is unknown and our population is normal, a (1-)100% prediction interval for a new observation is

/ 2, 1

11nx t s

n

Page 28: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2828

Acid rain example• For the acid rain data, the sample mean pH was 4.577889

and the sample standard deviation was 0.2892. What is a 95% prediction interval for the pH of a new rainfall?

• Does this prediction interval apply for the light bulb data?

Page 29: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

2929

Additional Prediction Interval

• A 7th generation citrus farmer is worried about revenues from this year’s crop, specifically because if he doesn’t get at least an 82% yield, he won’t be able to make the payments on the family farm and the bank will foreclose.

• It’s late spring and the last cold snap is coming tonight; forecast low is 30-degrees. He pulls up the Department of Agriculture data for citrus crops for the area and finds 30 matches for impacts on crop yields due to a 30-degree night, with an average of 85% and a standard deviation of 3.5%.

• Right before bed, he mentions this all to his wife and the last thing his wife says is, “Well, I’m sure you’ve run some sort of prediction interval to tell whether we’re in trouble or not……….Zzzzzzz”

Page 30: 1 Topic 6 - Confidence intervals based on a single sample Sampling distribution of the sample mean Sampling distribution of the sample variance Confidence

3030

Additional Prediction Interval (cont)Will the farmer sleep well tonight (ie., is there a statisticalchance that he’s not going to make 82% or more on a crop yield?), using a95% Prediction Interval?

/ 2, 1

11nx t s

n

1.85 (2.0452)*035 1

30

.85 .0728 (0.7772;0.9228)

The answer would be no. His disaster number falls within the realm of reasonable values, given the historical values……

He could expect to lose the farm