june 18, 2008stat 111 - lecture 11 - confidence intervals 1 introduction to inference sampling...

33
June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing Statistics 111 - Lecture 11

Upload: griffin-cannon

Post on 28-Dec-2015

222 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

1

Introduction to Inference

Sampling Distributions, Confidence Intervals

and Hypothesis Testing

Statistics 111 - Lecture 11

Page 2: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

2

Administrative Notes

• No homework due Monday• Homework 4 will be due next Wednesday

June 24

Page 3: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

3

Sampling Distribution of Sample Mean

• Distribution of values taken by statistic in all possible samples of size n from the same population

• Assume: observations are independent and sampled from a population with mean and variance 2

Population

Parameters: and 2

Sample 1 of size nSample 2 of size nSample 3 of size nSample 4 of size nSample 5 of size nSample 6 of size nSample 7 of size nSample 8 of size n .

. .

Distributionof thesevalues?

Page 4: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

4

Sampling Distribution of Sample Mean

• The center of the sampling distribution of the sample mean is the population mean:• Over all samples, the sample mean will, on average, be

equal to the population mean (no guarantees for 1 sample!)

• The spread of the sampling distribution of the sample mean is

• As sample size increases, variance of the sample mean decreases!

• Central Limit Theorem: if the sample size is large enough, then the sample mean has an approximately Normal distribution• This is true no matter what the shape of the distribution of

the original data!

Page 5: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

5

Confidence Intervals

• Sample mean is the best estimate of • However, we realize that the sample mean is probably not

exactly equal to population mean, and that we would get a different value of the sample mean in another sample

• Solution is to use our sample mean as the center of an entire interval of likely values for our population mean

Population

Sample

Parameter:

Statistic:

Sampling Inference

Estimation

?

Page 6: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

6

Example: Chips Ahoy

• Nabisco guarantees that each 18 oz bag of Chips Ahoy contains at least 1,000 chips.

• In late 1990’s, company challenged students to confirm their claim

• Air Force Academy administered the study by sampling 42 bags from 275 sent by company

Page 7: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

7

Example: Chips Ahoy

• Dataset: number of chips per bag in 42 sampled bags

• What can we can we say about the average number of chips in the “population” of all bags produced?• Our sample mean is 1216 chips per bag, but that is probably

not exactly equal to our population mean• We need to use our sample mean to calculate an interval of

likely values for our population mean

Page 8: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

8

Sampling Dist. for Sample Mean

• We assume that each observation is an independent sample from the population with unknown mean

• We also assume (for now) that the population variance 2 is known to be equal to s2 = (117.5)2

• From last class, we know that the sampling distribution of the sample mean is Normal:

Page 9: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

9

Confidence Interval for • From the 68-95-99.7 rule,

we know that 95% of sample means should be within 2 SDs (36.2 chips) of the population mean

• So 95% of the time (or in 95% of the samples), the population mean should be contained in the interval

( - 36.2, + 36.2) = (1225.3,1297.7)

• We call this a 95% confidence interval for

Page 10: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

10

General Confidence Intervals for • The 95% is called the confidence level of the interval• More generally, we can make an interval with any

confidence level we want. The general formula for a 100·C % confidence interval for population mean is:

• is called the critical value of the interval. It is the value from a standard normal table that gives you a tail probability of (1-C)/2.

SD( )

Page 11: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

11

Example of Critical Values

• 95% interval means that C=0.95 so 1-C = 0.05• So we need a value Z* that gives us a tail probability

(area under curve) of (1-C)/2 = 0.025

• Looking at Standard Normal Table, we see that Z* = 1.96

• In previous example, we rounded Z* to 2

Page 12: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

12

Interpretation of confidence intervals

• If many different samples from same population were collected (each giving us a 95% confidence interval for ), then 95% of these intervals should contain the true population mean • Note that the interval for any one sample may not contain !

• All confidence intervals have the same form:

Estimate ± Margin of Error

• For population means, the estimate is the sample mean and the margin of error is Z*·SD( ) where critical value Z* is determined by our confidence level

Page 13: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

13

Margin of Error and Sample Size

• Before we sample our Chips Ahoy cookies bags, we want to decide the minimum number of bags needed for a certain margin of error (saves on cookies!)

• Confidence intervals for population mean have a

margin of error which means

• If we want a confidence level of 95% (so Z*=1.96) and we want a margin of error less than 100 chips, then

so we need to sample at least 6 bags of chips.

Page 14: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

14

Sampling Distribution for Proportion

• We also want to calculate confidence intervals for a population proportion p.

• From last class, we know the sampling distribution of the sample proportion is also Normal:

Page 15: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

15

Confidence Intervals for Proportions• Based on the sampling distribution, our confidence

interval for the population proportion p is

• However, this interval is not very useful, since it still depends on the unknown population proportion p.

• We fix this by using our sample proportion in place of p, so our 100·C% confidence interval for p is:

Page 16: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

16

Example: Gallup Poll

• Sample of 2000 people asked if they will vote for McCain. Had a sample proportion of 0.51 for “yes.”

• What is a 95% confidence interval for the true population proportion p of McCain voters?

• In this example, n = 2000, = 0.51 and we use Z*=1.96 so our 95% confidence interval for p is:

Interval contains values on both sides of 0.5, so we are not confident that McCain will win the election!

Page 17: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Confidence Intervals

17

Note of Caution

• All of these confidence intervals were calculated using the normal distribution, which is justified by the central limit theorem

• However, by doing this, we are making the assumptions that the sample size is large and the population variance is known!

• We will see later how to calculate confidence intervals when these assumptions are not true

Page 18: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 18

Hypothesis Testing

• Now use our sampling distribution results for a different type of inference: – testing a specific hypothesis

• In some problems, we are not interested in calculating a confidence interval, but rather we want to see whether our data confirm a specific hypothesis• This type of inference is sometimes called

statistical decision making, but the more common term is hypothesis testing

Page 19: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 19

Example: Blackout Baby Boom

• New York City experienced a major blackout on November 9, 1965• many people were trapped for hours in the dark and on

subways, in elevators, etc.

• Nine months afterwards (August 10, 1966), the NY Times claimed that the number of births were way up• They attributed the increased births to the blackout, and this

has since become urban legend!

• Does the data actually support the claim of the NY Times? • Using data, we will test the hypothesis that the birth rate in

August 1966 was different than the usual birth rate

Page 20: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 20

Number of Births in NYC, August 1966

Sun Mon Tue Wed Thu Fri Sat

452 470 431 448 467 377

344 449 440 457 471 463 405

377 453 499 461 442 444 415

356 470 519 443 449 418 394

399 451 468 432

• We want to test this data against the usual birth rate in NYC, which is 430 births/day

First two weeks

Page 21: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 21

Steps for Hypothesis Testing

1. Formulate your hypotheses:• Need a Null Hypothesis and an Alternative

Hypothesis

2. Calculate the test statistic:• Test statistic summarizes the difference between

data and your null hypothesis

3. Find the p-value for the test statistic:• How probable is your data if the null hypothesis

is true?

Page 22: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 22

Null and Alternative Hypotheses

• Null Hypothesis (H0) is (usually) an assumption that there is no effect or no change in the population

• Alternative hypothesis (Ha) states that there is a real difference or real change in the population

• If the null hypothesis is true, there should be little discrepancy between the observed data and the null hypothesis• If we find there is a large discrepancy, then we will reject the

null hypothesis

• Both hypotheses are expressed in terms of different values for population parameters

Page 23: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 23

Example: NYC blackout and birth rates

• Let be the mean birth rate in August 1966 • Null Hypothesis:

• Blackout has no effect on birth rate, so August 1966 should be the same as any other month

• H0: = 430 (usual birth rate)

• Alternative Hypothesis:• Blackout did have an effect on the birth rate

• Ha: 430

• This is a two-sided alternative, which means that we are considering a change in either direction

• We could instead use a one-sided alternative that only considers changes in one direction• Eg. only alternative is an increase in birth rate Ha: >430

Page 24: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 24

Test Statistic

• Now that we have a null hypothesis, we can calculate a test statistic

• The test statistic measures the difference between the observed data and the null hypothesis

• Specifically, the test statistic answers the question:

“How many standard deviations is our observed sample value from the hypothesized value?”

• For our birth rate dataset, the observed sample mean is 433.6 and our hypothesized mean is 430

• To calculate the test statistic, we need the standard deviation of our sample mean

Page 25: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 25

Sampling Distribution of Sample Mean

• The center of the sampling distribution of the sample mean is the population mean:

• The spread of the sampling distribution of the sample mean is

• Central Limit Theorem: if the sample size is large enough, then the sample mean has an approximately Normal distribution

Page 26: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 26

Test Statistic for Sample Mean

• Sample mean has a standard deviation of so our test statistic T is:

• T is the number of standard deviations between our sample mean and the hypothesized mean• 0 is the notation we use for our hypothesized mean

• To calculate our test statistic T, we need to know the population standard deviation

• For now we will make the assumption that is the same as our sample standard deviation s• Later, we will correct this assumption!

Page 27: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 27

Test Statistic for Birth Rate Example

• For our NYC births/day example, we have a sample mean of 433.6, a hypothesized mean of 430 and a sample standard deviation of 39.4

• Our test statistic is:

• So, our sample mean is 0.342 standard deviations different from what it should be if there was no blackout effect

• Is this difference statistically significant?

Page 28: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 28

Probability values (p-values)

• Assuming the null hypothesis is true, the p-value is the probability we get a value as far from the hypothesized value as our observed sample value

• The smaller the p-value is, the more unrealistic our null hypothesis appears

• For our NYC birth-rate example, T=0.342• Assuming our population mean really is 430, what

is the probability that we get a test statistic of 0.342 or greater?

Page 29: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 29

Calculating p-values

• To calculate the p-value, we use the fact that the sample mean has a normal distribution

• Under the null hypothesis, the sample mean has a normal distribution with mean 0 and

standard deviation so the test statistic:

has a standard normal distribution!

Page 30: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 30

p-value for NYC dataset

• If our alternative hypothesis was one-sided (Ha: >430), then our p-value would be 0.367

• Since are alternative hypothesis was two-sided our p-value is the sum of both tail probabilities

• p-value = 0.367 + 0.367 = 0.734

T = 0.342 T = -0.342

prob = 0.367 prob = 0.367

Page 31: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 31

Statistical Significance

• If the p-value is smaller than , we say the data are statistically significant at level

• The most common -level to use is = 0.05• Next class, we will see that this relates to 95%

confidence intervals!

• The -level is used as a threshold for rejecting the null hypothesis

• If the p-value < , we reject the null hypothesis that there is no change or difference

Page 32: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 32

Conclusions for NYC birth-rate data

• The p-value = 0.734 for the NYC birth-rate data, so we can clearly not reject the null hypothesis at -level of 0.05

• Another way of saying this is that the difference between null hypothesis and our data is not statistically significant

• So, we conclude that the data do not support the idea that there was a different birth rate than usual for the first two weeks of August, 1966. No blackout baby boom effect!

Page 33: June 18, 2008Stat 111 - Lecture 11 - Confidence Intervals 1 Introduction to Inference Sampling Distributions, Confidence Intervals and Hypothesis Testing

June 18, 2008 Stat 111 - Lecture 11 - Hyp. Tests 33

Next Class - Lecture 12

• More Hypothesis Testing!

• Moore, McCabe and Craig: Section 6.2-6.3