Top Banner
Hypothesis Testing
126

Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Dec 16, 2015

Download

Documents

Elvis Sowl
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Hypothesis Testing

Page 2: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

OverviewThis is the other part of inferential

statistics, hypothesis testingHypothesis testing and estimation are two

different approaches to two similar problems Estimation is the process of using sample data to

estimate the value of a population parameter Hypothesis testing is the process of using sample

data to test a claim about the value of a population parameter

Page 3: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

What is Hypothesis Testing?

The environment of our problem is that we want to test whether a particular claim is believable, or not.

Hypothesis testing involves two steps Step 1 – to state what we think is true Step 2 – to quantify how confident we are in our

claim

Page 4: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

My Plan

Finding the appropriate Hypothesis

to Test

Complete Hypothesis

Testing Procedure

Result of the

Hypothesis Test

Page 5: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

An example of what we want to quantify

A car manufacturer claims that a certain model of car achieves 29 miles per gallon

We test some number of cars We calculate the sample mean … it is 27 Is 27 miles per gallon consistent with the

manufacturer’s claim? How confident are we that the manufacturer has significantly overstated the miles per gallon achievable?

Page 6: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

An example of what we want to quantify

● How confident are we that the gas economy is definitely less than 29 miles per gallon?

● We would like to make either a statement“We’re pretty sure that

the mileage is less than 29 mpg”or

“It’s believable that themileage is equal to 29 mpg”

Page 7: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Definition● A hypothesis test for an unknown

parameter is a test of a specific claim Compare this to a confidence interval which

gives an interval of numbers, not a “believe it” or “don’t believe it” answer

● The level of significance represents the confidence we have in our conclusion

Page 8: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Null HypothesisHow do we state our claim?Our claim

Is the statement to be tested Is called the null hypothesis Is written as H0 (and is read as “H-naught”)

Page 9: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

A Useful Analogy● In the judicial system, the defendant “is

innocent until proven guilty” Thus the defendant is presumed to be innocent The null hypothesis is that the defendant is

innocent H0: the defendant is innocent

Page 10: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Alternative Hypothesis

How do we state our counter-claim?Our counter-claim

Is the opposite of the statement to be tested Is called the alternative hypothesis Is written as H1 (and is read as “H-one”)

Page 11: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● If the defendant is not innocent, then The defendant is guilty The alternative hypothesis is that the defendant

is guilty H1: the defendant is guilty

● The summary of the set-up H0: the defendant is innocent

H1: the defendant is guilty

Page 12: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● There are different types of null hypothesis -alternative hypothesis pairs, depending on the claim and the counter-claim

● One type of H0 / H1 pair, called a two-tailed test, tests whether the parameter is either equal to, versus not equal to, some value H0: parameter = some value

H1: parameter ≠ some value

Page 13: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a two-tailed test● A bolt manufacturer claims that the diameter

of the bolts average 10 mm H0: Diameter = 10

H1: Diameter ≠ 10

● An alternative hypothesis of “≠ 10” is appropriate since A sample diameter that is too high is a problem A sample diameter that is too low is also a problem

● Thus this is a two-tailed test

Page 14: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Another type of pair, called a left-tailed test, tests whether the parameter is either equal to, versus less than, some value H0: parameter = some value H1: parameter < some value

Page 15: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a left-tailed test● A car manufacturer claims that the mpg of

a certain model car is at least 29.0 H0: MPG = 29.0

H1: MPG < 29.0

● An alternative hypothesis of “< 29” is appropriate since A mpg that is too low is a problem A mpg that is too high is not a problem

● Thus this is a left-tailed test

Page 16: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Another third type of pair, called a right-tailed test, tests whether the parameter is either equal to, versus greater than, some value H0: parameter = some value H1: parameter > some value

Page 17: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a right-tailed test● A bolt manufacturer claims that the defective

rate of their product is at most 1 part in 1,000 H0: Defect Rate = 0.001

H1: Defect Rate > 0.001

● An alternative hypothesis of “> 0.001” is appropriate since A defect rate that is too low is not a problem A defect rate that is too high is a problem

● Thus this is a right-tailed test

Page 18: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● A comparison of the three types of tests● The null hypothesis

We believe that this is true

● The alternative hypothesis

Page 19: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● A manufacturer claims that there are at least two scoops of cranberries in each box of cereal

● What would be a problem? The parameter to be tested is the number of

scoops of cranberries in each box of cereal If the sample mean is too low, that is a problem If the sample mean is too high, that is not a

problem● This is a left-tailed test

The “bad case” is when there are too few

Page 20: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● A manufacturer claims that there are exactly 500 mg of a medication in each tablet

● What would be a problem? The parameter to be tested is the amount of a

medication in each tablet If the sample mean is too low, that is a problem If the sample mean is too high, that is a problem

too● This is a two-tailed test

A “bad case” is when there are too few A “bad case” is also where there are too many

Page 21: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● A manufacturer claims that there are at most 8 grams of fat per serving

● What would be a problem? The parameter to be tested is the number of

grams of fat in each serving If the sample mean is too low, that is not a

problem If the sample mean is too high, that is a problem

● This is a right-tailed test The “bad case” is when there are too many

Page 22: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● There are two possible results for a hypothesis test

● If we believe that the null hypothesis could be true, this is called not rejecting the null hypothesis Note that this is only “we believe … could be”

● If we are pretty sure that the null hypothesis is not true, so that the alternative hypothesis is true, this is called rejecting the null hypothesis Note that this is “we are pretty sure that … is”

Page 23: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

In comparing our conclusion (not reject or reject the null hypothesis) with reality, we could either be right or we could be wrong When we reject (and state that the null hypothesis

is false) but the null hypothesis is actually true When we not reject (and state that the null

hypothesis could be true) but the null hypothesis is actually false

These would be undesirable errors

Page 24: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

A summary of the errors is

We see that there are four possibilities … in two of which we are correct and in two of which we are incorrect

Page 25: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● When we reject (and state that the null hypothesis is false) but the null hypothesis is actually true … this is called a Type I error

● When we do not reject (and state that the null hypothesis could be true) but the null hypothesis is actually false … this called a Type II error

● In general, Type I errors are considered the more serious of the two

Page 26: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● We can make use of our analogy for Type I and Type II errors in comparing it to a criminal trial

● In the judicial system, the defendant “is innocent until proven guilty” Thus the defendant is presumed to be innocent The null hypothesis is that the defendant is

innocent H0: the defendant is innocent

Page 27: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● If the defendant is not innocent, then The defendant is guilty The alternative hypothesis is that the defendant

is guilty H1: the defendant is guilty

● The summary of the set-up H0: the defendant is innocent

H1: the defendant is guilty

Page 28: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Our possible conclusions● Reject the null hypothesis

Go with the alternative hypothesis H1: the defendant is guilty We vote “guilty”

● Do not reject the null hypothesis Go with the null hypothesis H0: the defendant is innocent We vote “not guilty” (which is not the same as

voting innocent!)

Page 29: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● A Type I error Reject the null hypothesis The null hypothesis was actually true We voted “guilty” for an innocent defendant

● A Type II error Do not reject the null hypothesis The alternative hypothesis was actually true We voted “not guilty” for a guilty defendant

Page 30: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Which error do we try to control?● Type I error (sending an innocent person to jail)

The evidence was “beyond reasonable doubt” We must be pretty sure Very bad! We want to minimize this type of error

● A Type II error (letting a guilty person go) The evidence wasn’t “beyond a reasonable doubt” We weren’t sure enough If this happens … well … it’s not as bad as a Type I

error (according to the law system)

Page 31: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

“Innocent” versus “Not Guilty”This is an important conceptInnocent is not the same as not guilty

Innocent – the person did not commit the crime Not guilty – there is not enough evidence to convict

… that the reality is unclearTo not reject the null hypothesis – doesn’t

mean that the null hypothesis is true – just that there isn’t enough evidence to reject

Page 32: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Summary so far…A hypothesis test tests whether a claim is

believable or not, compared to the alternative

We test the null hypothesis H0 versus the alternative hypothesis H1

If there is sufficient evidence to conclude that H0 is false, we reject the null hypothesis

If there is insufficient evidence to conclude that H0 is false, we do not reject the null hypothesis

Page 33: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

My Plan

Finding the appropriate Hypothesis

to Test

Complete Hypothesis

Testing Procedure

Result of the

Hypothesis Test

Page 34: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

We have the outline of a hypothesis test, just not the detailed implementation

What is the exact procedure to get to a do not reject / reject conclusion?

How do we calculate Type I and Type II errors?

Page 35: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Our aim is to conduct an hypothesis test about a population parameter. Like: A car manufacturer claims that a certain model

of car achieves 29 miles per gallon We test some number of cars We calculate the sample mean … it is 27 Is 27 miles per gallon consistent with the

manufacturer’s claim? How confident are we that the manufacturer has significantly overstated the miles per gallon achievable?

Page 36: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● STEP 1 We have a null hypothesis, that the actual

mean is equal to a value μ0

We have an alternative hypothesis

● STEP 2 A criterion that quantifies “unlikely” That the actual mean is unlikely to be equal to

μ0

A criterion that determines what would be a do not reject and what would be a reject

Page 37: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● STEP 3 We run an experiment We collect the data We calculate the sample mean

● MID-STEP : Our Assumptions That the sample is a simple random sample That the sample mean has a normal distribution

Page 38: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● We compare the sample mean x to the hypothesized population mean μ0

● For two-tailed tests● α= 0.05

Critical Value(1.96)

Shaded regions are called REJECTION REGION

Page 39: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

The least likely 5% is the lowest 2.5% and highest 2.5% (below –1.96 and above +1.96 standard deviations) … –1.96 and +1.96 are the critical values

The region outside this is the rejection region

Page 40: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● For left-tailed tests The least likely 5% is the lowest 5% (below –

1.645 standard deviations) … –1.645 is the critical value

The region less than this is the rejection region

Page 41: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● For right-tailed tests The least likely 5% is the highest 5% (above

1.645 standard deviations) … +1.645 is the critical value

The region greater than this is the rejection region

Page 42: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

The difference is

We standardize

This is called the test statisticIf the test statistic is in the rejection region

– we reject

0x

n/x

z

00

Page 43: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a two-tailed test● A bolt manufacturer claims that the

diameter of the bolts average 10.0 mm H0: Diameter = 10.0

H1: Diameter ≠ 10.0

● We take a sample of size 40 (Somehow) We know that the standard

deviation of the population is 0.3 mm The sample mean is 10.12 mm We’ll use a level of significance α = 0.05

Page 44: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Do we reject the null hypothesis? 10.12 is 0.12 higher than 10.0 The standard error is (0.3 / √ 40) = 0.047 The test statistic is 2.53 The critical normal value, for α/2 = 0.025, is 1.96 2.53 is more than 1.96

● Our conclusion We reject the null hypothesis We have sufficient evidence that the population

mean diameter is not 10.0

Page 45: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a left-tailed test● A car manufacturer claims that the mpg of

a certain model car is at least 29.0 H0: MPG = 29.0

H1: MPG < 29.0

● We take a sample of size 40 (Somehow) We know that the standard

deviation of the population is 0.5 The sample mean mpg is 28.89 We’ll use a level of significance α = 0.05

Page 46: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Do we reject the null hypothesis? 28.89 is 0.11 lower than 29.0 The standard error is (0.5 / √ 40) = 0.079 The test statistic is -1.39 -1.39 is greater than -1.645, the left-tailed

critical value for α = 0.05

● Our conclusion We do not reject the null hypothesis We have insufficient evidence that the

population mean mpg is less than 29.0

Page 47: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a right-tailed test● A bolt manufacturer claims that the defective

rate of their product is at most 1.70 per 1,000 H0: Defect Rate = 1.70

H1: Defect Rate > 1.70

● We take a sample of size 40 (Somehow) We know that the standard deviation of

the population is .06 The sample defect rate is 1.78 We’ll use a level of significance α = 0.05

Page 48: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Do we reject the null hypothesis? 1.78 is 0.08 higher than 1.70 The standard error is (0.06 / √ 40) = 0.009 The test statistic is 8.43 8.43 is more than 1.645, the right-tailed critical

value for α = 0.05

● Our conclusion We reject the null hypothesis We have sufficient evidence that the population

mean rate is more than 1.70

Page 49: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Two-tailed test The critical values are zα/2 and –zα/2

The rejection region is {less than –zα/2} and {greater than z1-α/2}

● Left-tailed test The critical value is –zα

The rejection region is {less than –zα}

● Right-tailed test The critical value is zα

The rejection region is {greater than zα}

Page 50: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

The difference is

We standardize

This is called the test statisticIf the test statistic is in the rejection region

– we reject

0x

n/x

z

00

Page 52: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

The general picture for a level of significance α

Page 53: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

The P-value is the probability of observing a sample mean that is as or more extreme than the observed

The probability is calculated assuming that the null hypothesis is true

We use the P-value to quantify how unlikely the sample mean is

Page 54: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Just like in the classical approach, we calculate the test statistic

● We then calculate the P-value, the probability that the sample mean would be this, or more extreme, if the null hypothesis was true

● The two-tailed, left-tailed, and right-tailed calculations are slightly different

n/x

z

00

Page 55: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● For the two-tailed test, the “unlikely” region are values that are too high and too low

● Small P-values corresponds to situations where it is unlikely to be this far away

Page 56: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● For the left-tailed test, the “unlikely” region are values that are too low

● Small P-values corresponds to situations where it is unlikely to be this low

Page 57: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● For the right-tailed test, the “unlikely” region are values that are too high

● Small P-values corresponds to situations where it is unlikely to be this high

Page 58: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

For all three models (two-tailed, left-tailed, right-tailed) The larger P-values mean that the difference is not

relatively large … that it’s not an unlikely event The smaller P-values mean that the difference is

relatively large … that it’s an unlikely event

Page 59: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Larger P-values A P-value of 0.30, for example, means that this

value, or more extreme, could happen 30% of the time

30% of the time is not unusual

● Smaller P-values A P-value of 0.01, for example, means that this

value, or more extreme, could happen only 1% of the time

1% of the time is unusual

Page 60: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

The decision rule isFor a significance level α

Do not reject the null hypothesis if the P-value is greater than α

Reject the null hypothesis if the P-value is less than α

For example, if α = 0.05 A P-value of 0.30 is likely enough, compared to a

criterion of 0.05 A P-value of 0.01 is unlikely, compared to a criterion

of 0.05

Page 61: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a two-tailed test● A bolt manufacturer claims that the

diameter of the bolts average 10.0 mm H0: Diameter = 10.0

H1: Diameter ≠ 10.0

● We take a sample of size 40 (Somehow) We know that the standard

deviation of the population is 0.3 mm The sample mean is 10.12 mm We’ll use a level of significance α = 0.05

Page 62: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Do we reject the null hypothesis? 10.12 is 0.12 higher than 10.0 The standard error is (0.3 / √ 40) = 0.047 The test statistic is 2.53 The 2-sided P-value of 2.53 is 0.01 < 0.05 = α

● Our conclusion We reject the null hypothesis We have sufficient evidence that the population

mean diameter is not 10.0

Page 63: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a left-tailed test● A car manufacturer claims that the mpg of

a certain model car is at least 29.0 H0: MPG = 29.0

H1: MPG < 29.0

● We take a sample of size 40 (Somehow) We know that the standard

deviation of the population is 0.5 The sample mean mpg is 28.89 We’ll use a level of significance α = 0.05

Page 64: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Do we reject the null hypothesis? 28.89 is 0.11 lower than 29.0 The standard error is (0.5 / √ 40) = 0.079 The test statistic is -1.39 The 1-sided P-value of -1.39 is 0.08 > 0.05 = α

● Our conclusion We do not reject the null hypothesis We have insufficient evidence that the

population mean mpg is less than 29.0

Page 65: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a right-tailed test● A bolt manufacturer claims that the defective

rate of their product is at most 1.70 per 1,000 H0: Defect Rate = 1.70

H1: Defect Rate > 1.70

● We take a sample of size 40 (Somehow) We know that the standard deviation of

the population is .06 The sample defect rate is 1.78 We’ll use a level of significance α = 0.05

Page 66: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Do we reject the null hypothesis? 1.78 is 0.08 higher than 1.70 The standard error is (0.06 / √ 40) = 0.009 The test statistic is 8.43 The 1-sided P-value of 8.43 is extremely small

● Our conclusion We reject the null hypothesis We have sufficient evidence that the population

mean rate is more than 1.70

Page 67: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

The hypothesis test calculation and the confidence interval calculation are very similar

Not rejecting thehypothesis

μ0 is inside theConfidence interval

Rejecting thehypothesis

μ0 is outside theConfidence interval

Page 68: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example of a two-tailed test● A bolt manufacturer claims that the

diameter of the bolts average 10.0 mm H0: Diameter = 10.0

H1: Diameter ≠ 10.0

● We take a sample of size 40 (Somehow) We know that the standard

deviation of this measurement is 0.3 mm The sample mean is 10.12 mm We’ll use a level of significance α = 0.05

Page 69: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Do we reject the null hypothesis? 10.12 is 0.12 higher than 10.0 The standard error is (0.3 / √ 40) = 0.047 The confidence interval is 10.12 ± 1.96 • 0.047,

or 10.03 to 10.21 10.0 is outside (10.03, 10.21)

● Our conclusion We reject the null hypothesis We have sufficient evidence that the population

mean diameter is not 10.0

Page 70: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

In the previous section, we assumed that the population standard deviation, σ, was known

This is not a realistic assumptionσ not being known is a much more

practical assumption

Page 71: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● The parallel between Confidence Intervals and Hypothesis Tests carries over here too

● For Confidence Intervals We estimate the population standard deviation

σ by the sample standard deviation s We use the Student’s t-distribution with n-1

degrees of freedom

● For Hypothesis Tests, we do the same Use σ for s Use the Student’s t for the normal

Page 72: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Thus instead of the test statistic knowing σ

we calculate a test statistic using s

This is the appropriate test statistic to use when σ is unknown

n/x

z

00

n/sx

t 0

Page 73: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

We can perform our hypotheses for tests of a population proportion in the same way as when the sample standard deviation is known

Page 74: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● The process for a hypothesis test of a mean, when σ is unknown is Set up the problem with a null and alternative

hypotheses Collect the data and compute the sample mean Compute the test statistic

n/sx

t 0

Page 75: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Either the Classical and the P-value approach can be applied to determine the significance

P-value approachClassical approach

Page 76: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● A gasoline manufacturer wants to make sure that the octane in their gasoline is at least 87.0 The testing organization takes a sample of size 20 The sample standard deviation is 0.5 The sample mean octane is 86.94

● Our null and alternative hypotheses H0: Mean octane = 87

HA: Mean octane < 87 α = 0.05

Page 77: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Do we reject the null hypothesis? 86.94 is 0.06 lower than 87.0 The standard error is (0.5 / √ 20) = 0.11 0.06 is 0.55 standard error less The critical t value, with 19 degrees of freedom, is

1.729 –1.729 < –0.55, it is not unusual

● Our conclusion We do not reject the null hypothesis We have insufficient evidence that the true

population mean (mean octane) is less than 87.0

Page 78: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

DİĞER SLAYTLARA GEÇ!

● In a sample of size n, with x successes, the best estimate of the population proportion is

● Similar to tests for means, we have Two-tailed tests Left-tailed tests Right-tailed tests

nx

Page 79: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Ifnp≥ 5 , n(1-p) ≥5

then the sample proportion is approximately normally distributed

Just as for confidence intervals, the standard error of the sample mean proportion is

n)p(p 00 1

Page 80: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

For the standard error of the sample proportion, we use

and notn

)p(p 00 1

n)p̂(p̂ 1

Page 81: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Because we assume that the null hypothesis(p = p0) is true, we should use

The test statistic is thusn

)p(p 00 1

n)p(p

pp̂

00

01

Page 82: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

We can perform our hypotheses for tests of a population proportion in the same way as the hypothesis tests of a population mean

Two-tailed Left-tailed Right-tailed

H0: p = p0

H1: p ≠ p0

H0: p = p0

H1: p < p0

H0: p = p0

H1: p > p0

Page 83: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● The process for a hypothesis test of a proportion is Set up the problem with a null and alternative

hypotheses Collect the data and compute the sample

proportion Compute the test statistic

n)p(p

pp̂

00

01

Page 84: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Either the Classical and the P-value approach can be applied to determine the significance

Classical approach P-value approach

Page 85: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● An example● We believe that 60% of students prefer

hamburgers over hot dogs● A random sample of 200 students found

that 102 of them preferred hamburgers● At α = 0.05, does the data support our

belief? The sample size n = 200 The hypothesized proportion p0 = 0.60 The sample proportion

510.p̂

Page 86: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Our hypotheses H0: p = 0.60

H1: p ≠ 0.60

● The standard error is

● The test statistic is

03501 00 .n

)p(p

6021 00

0 .

n)p(p

pp̂

Page 87: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

The critical values for α = 0.05 are ± 1.96The test statistic –2.60 is outside the

critical values, so we reject the null hypothesis

There is significant evidence that the proportion of students who prefer hamburgers is not 60%

Page 88: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

We can perform hypothesis tests of proportions in similar ways as hypothesis tests of means Two-tailed, left-tailed, and right-tailed tests

The normal distribution or the binomial distribution should be used to compute the critical values for this test

Page 89: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

1. Dependent samples2. Independent samples

Inference about two means

Page 90: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Introduction● So far we have covered a variety of models

dealing with one population The mean parameter for one population The proportion parameter for one population The standard deviation parameter for one

population● However, there are many real-world

applications that need techniques to compare two populations

Page 91: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Examples● Examples of situations with two populations

We want to test whether a certain treatment helps or not … the measurements are the “before” measurement and the “after” measurement

We want to test the effectiveness of Drug A versus Drug B … we give 40 patients Drug A and 40 patients Drug B … the measurements are the Drug A and Drug B responses

Two precision manufacturers are bidding for our contract … they each have some precision (standard deviation) … are their precisions significantly different

Page 92: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● In certain cases, the two samples are very closely tied to each other

● A dependent sample is one when each individual in the first sample is directly matched to one individual in the second

● Examples Before and after measurements (a specific

person’s before and the same person’s after) Experiments on identical twins (twins matched

with each other

Page 93: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● On the other extreme, the two samples can be completely independent of each other

● An independent sample is when individuals selected for one sample have no relationship to the individuals selected for the other

● Examples Fifty samples from one factory compared to fifty

samples from another Two hundred patients divided at random into

two groups of one hundred

Page 94: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● The dependent samples are often called matched-pairs

● Matched-pairs is an appropriate term because each observation in sample 1 is matched to exactly one in sample 2 The person before the person after One twin the other twin An experiment done on a person’s left eye

the same experiment done on that person’s right eye

Page 95: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● The method to analyze matched-pairs is to combine the pair into one measurement “Before” and “After” measurements – subtract

the before from the after to get a single “change” measurement

“Twin 1” and “Twin 2” measurements – subtract the 1 from the 2 to get a single “difference between twins” measurement

“Left eye” and “Right eye” measurements – subtract the left from the right to get a single “difference between eyes” measurement

Page 96: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Specifically, for the before and after example, d1 = person 1’s after – person 1’s before d2 = person 2’s after – person 1’s before d3 = person 3’s after – person 1’s before

● This creates a new random variable d● We would like to reformulate our problem

into a problem involving d (just one variable)

Page 97: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● How do our hypotheses translate? The two means are equal … the mean

difference is zero … μd = 0 The two means are unequal … the mean

difference is non-zero … μd ≠ 0● Thus our hypothesis test is

H0: μd = 0 H1: μd ≠ 0 The standard deviation σd is unknown

● We know how to do this!

Page 98: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

To solve H0: μd = 0 H1: μd ≠ 0 The standard deviation σd is unknown

This is exactly the test of one mean with the standard deviation being unknown

This is exactly the subject we have covered previously

Page 99: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

An example … whether our treatment helps or not … helps meaning a higher measurement

The “Before” and “After” results

Before After Difference

7.2 8.6 1.4

6.6 7.7 1.1

6.5 6.2 – 0.3

5.5 5.9 0.4

5.9 7.7 1.8

Page 100: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Hypotheses H0: μd = 0 … no difference H1: μd > 0 … helps (We’re only interested in if our treatment makes

things better or not) α = 0.01

● Calculations n = 5 d = .88 sd = .83

Page 101: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Calculations n = 5 d = 0.88 sd = 0.83

● The test statistic is

● This has a Student’s t-distribution with 4 degrees of freedom

0

0.88 02.36

/ 0.83 / 5d

d

dt

s n

Page 102: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● Use the Student’s t-distribution with 4 degrees of freedom

● The right-tailed α = 0.01 critical value is 3.75● 2.36 is less than 3.75 (the classical method)● Thus we do not reject the null hypothesis● There is insufficient evidence to conclude that our

method significantly improves the situation● We could also have used the P-Value method

Page 103: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Matched-pairs tests have the same various versions of hypothesis tests Two-tailed tests Left-tailed tests (the alternatively hypothesis that

the first mean is less than the second) Right-tailed tests (the alternatively hypothesis that

the first mean is greater than the second) Different values of α

Each can be solved using the Student’s t

Page 104: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● A summary of the method For each matched pair, subtract the first

observation from the second This results in one data item per subject with

the data items independent of each other Test that the mean of these differences is equal

to 0● Conclusions

Do not reject that μd = 0 Reject that μd = 0 ... Reject that the two

populations have the same mean

Page 105: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Independent Samples

● Two samples are independent if the values in one have no relation to the values in the other

● Examples of not independent Data from male students versus data from

business majors (an overlap in populations) The mean amount of rain, per day, reported in

two weather stations in neighboring towns (likely to rain in both places)

Page 106: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● A typical example of an independent samples test is to test whether a new drug, Drug N, lowers cholesterol levels more than the current drug, Drug C

● A group of 100 patients could be chosen The group could be divided into two groups of

50 using a random method If we use a random method (such as a simple

random sample of 50 out of the 100 patients), then the two groups would be independent

Page 107: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

The test of two independent samples is very similar, in process, to the test of a population mean

The only major difference is that a different test statistic is used

We will discuss the new test statistic through an analogy with the hypothesis test of one mean

Page 108: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

For the test of one mean, we have the variables The hypothesized mean (μ) The sample size (n) The sample mean (x) The sample standard deviation (s)

We expect that x would be close to μ

Page 109: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

In the test of two means, we have two values for each variable – one for each of the two samples The two hypothesized means μ1 and μ2

The two sample sizes n1 and n2

The two sample means x1 and x2

The two sample standard deviations s1 and s2

We expect that x1 – x2 would be close to μ1 – μ2

Page 110: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

For the test of one mean, to measure the deviation from the null hypothesis, it is logical to take

x – μwhich has a standard deviation of approximately

n

s2

Page 111: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

For the test of two means, to measure the deviation from the null hypothesis, it is logical to take

(x1 – x2) – (μ1 – μ2)which has a standard deviation of approximately

2

22

1

21

n

s

n

s

Page 112: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

For the test of one mean, under certain appropriate conditions, the difference

x – μis Student’s t with mean 0, and the test statistic

has Student’s t-distribution with n – 1 degrees of freedom

ns

xt

2

Page 113: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Thus for the test of two means, under certain appropriate conditions, the difference

(x1 – x2) – (μ1 – μ2)is approximately Student’s t with mean 0, and the test statistic

has an approximate Student’s t-distribution

2

22

1

21

2121 )()(

ns

ns

xxt

Page 114: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

This is Welch’s approximation, that

has approximately a Student’s t-distribution

The degrees of freedom is the smaller of n1 – 1 and n2 – 1

2

22

1

21

2121 )()(

ns

ns

xxt

Page 115: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● We have two independent samples The first sample of n = 40 items has a sample

mean of 7.8 and a sample standard deviation of 3.3 The second sample of n = 50 items has a sample

mean of 11.6 and a sample standard deviation of 2.6

We believe that the mean of the second population is exactly 4.0 larger than the mean of the first population

We use a level of significance α = .05● We use an example with μ1 ≠ μ2 to better

illustrate the test statistic

Page 116: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● The test statistic is

● This has a Student’s t-distribution with 39 degrees of freedom

● The two-tailed critical value is 2.02, so we do not reject the null hypothesis

● We do not have sufficient evidence to state that the deviation from 4.0 is significant

72.1

506.2

403.3

0.4)9.128.7()()(22

2

22

1

21

2121

ns

ns

xxt

Page 117: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Testing Proportions● We now compare two proportions, testing

whether they are the same or not● Examples

The proportion of women (population one) who have a certain trait versus the proportion of men (population two) who have that same trait

The proportion of white sheep (population one) who have a certain characteristic versus the proportion of black sheep (population two) who have that same characteristic

Page 118: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● The test of two populations proportions is very similar, in process, to the test of one population proportion and the test of two population means

● The only major difference is that a different test statistic is used

● We will discuss the new test statistic through an analogy with the hypothesis test of one proportion

Page 119: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● For the test of one proportion, we had the variables of The hypothesized population proportion (p0) The sample size (n) The number with the certain characteristic (x) The sample proportion ( )

● We expect that should be close to p0

nxp /ˆ p̂

Page 120: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● In the test of two proportions, we have two values for each variable – one for each of the two samples The two hypothesized proportions (p1 and p2) The two sample sizes (n1 and n2) The two numbers with the certain characteristic

(x1 and x2) The two sample proportions ( and

)● We expect that should be close to

p1 – p2

111 /ˆ nxp 222 /ˆ nxp

21 ˆˆ pp

Page 121: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

For the test of one proportion, to measure the deviation from the null hypothesis, we took

which has a standard deviation of

0ˆ pp

n

pp )1( 00

Page 122: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

For the test of two proportions, to measure the deviation from the null hypothesis, it is logical to take

which has a standard deviation of

)()ˆˆ( 2121 pppp

2

22

1

11 )1()1(

n

pp

n

pp

Page 123: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

For the test of one proportion, under certain appropriate conditions, the difference

is approximately normal with mean 0, and the test statistic

has an approximate standard normal distribution

npp

ppz

)1(

ˆ

00

0

0ˆ pp

Page 124: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

Thus for the test of two proportions, under certain appropriate conditions, the difference

is approximately normal with mean 0, and the test statistic

has an approximate standard normal distribution

2

22

1

11

2121

)1()1(

)()ˆˆ(

n

pp

n

pp

ppppz

)()ˆˆ( 2121 pppp

Page 125: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● We have two independent samples 55 out of a random sample of 100 students at

one university are commuters 80 out of a random sample of 200 students at

another university are commuters We wish to know of these two proportions are

equal We use a level of significance α = .05

● When we calculate np & n(1-p) for each of the two samples, results are affirmative

Page 126: Overview This is the other part of inferential statistics, hypothesis testing Hypothesis testing and estimation are two different approaches to two similar.

● The test statistic is

● The critical values for a two-tailed test using the normal distribution are ± 1.96, thus we reject the null hypothesis

● We conclude that the two proportions are significantly different

47.2

20060.040.0

10045.055.0

40.055.0

)1()1(

)()ˆˆ(

2

22

1

11

2121

npp

npp

ppppz