29
STA286 week 10 1 Hypothesis Testing – Introduction Hypothesis: A conjecture about the distribution of some random variables. A hypothesis can be simple or composite. A simple hypothesis completely specifies the distribution. A composite does not. There are two types of hypotheses: ¾ The null hypothesis, H 0 , is the current belief. ¾ The alternative hypothesis, H a , is your belief; it is what you want to show.

Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

  • Upload
    others

  • View
    19

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 1

Hypothesis Testing – Introduction

• Hypothesis: A conjecture about the distribution of some random variables.

• A hypothesis can be simple or composite.

• A simple hypothesis completely specifies the distribution. A composite does not.

• There are two types of hypotheses:

The null hypothesis, H0, is the current belief.The alternative hypothesis, Ha, is your belief; it is what you want to show.

Page 2: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 2

ExamplesEach of the following situations requires a significance test about a population mean μ. State the appropriate null hypothesis H0 and alternative hypothesis Ha in each case.

(a) The mean area of the several thousand apartments in a new development is advertised to be 1250 square feet. A tenant group thinks that the apartments are smaller than advertised. They hire an engineer to measure a sample of apartments to test their suspicion.

(b) Larry's car consume on average 32 miles per gallon on the highway. He now switches to a new motor oil that is advertised as increasing gas mileage. After driving 3000 highway miles with the new oil, he wants to determine if his gas mileage actually has increased.

(c) The diameter of a spindle in a small motor is supposed to be 5 millimeters. If the spindle is either too small or too large, the motor will not perform properly. The manufacturer measures the diameter in a sample of motors to determine whether the mean diameter has moved away from the target.

Page 3: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 3

Test Statistic• The test is based on a statistic that estimate the parameter that

appears in the hypotheses. Usually this is the same estimate we would use in a confidence interval for the parameter. When H0 is true, we expect the estimate to take a value near the parameter value specified in H0.

• Values of the estimate far from the parameter value specified by H0give evidence against H0. The alternative hypothesis determines which directions count against H0.

• A test statistic measures compatibility between the null hypothesis and the data.

• We use it for the probability calculation that we need for our test of significance

• It is a random variable with a distribution that we know.

Page 4: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 4

Example• An air freight company wishes to test whether or not the mean weight

of parcels shipped on a particular root exceeds 10 pounds. A random sample of 49 shipping orders was examined and found to have average weight of 11 pounds. Assume that the stdev. of the weights (σ) is 2.8 pounds.

• The null and alternative hypotheses in this problem are:H0: μ = 10 ; Ha: μ > 10 .

• The test statistic for this problem is the standardized version of

• Decision: ?

X

/XZ n

μσ−=

Page 5: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 5

Testing Process• Hypothesis testing is a proof by contradiction.• The testing process has four steps:• Step 1: Assume H0 is true. • Step 2: Use statistical theory to make a statistic (function of the

data) that includes H0. This statistic is called the test statistic. • Step 3: Find the probability that the test statistic would take a value

as extreme or more extreme than that actually observed. Think of this as: probability of getting our sample assuming H0 is true.

• Step 4: If the probability we calculated in step 3 is high it means that the sample is likely under H0 and so we have no evidence against H0. If the probability is low it means that the sample is unlikely under H0. This in turn means one of two things; either H0 is false or we are unlucky and H0 is true.

Page 6: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 6

Example

Page 7: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 7

Graphical Representation

• Let Sn be the set of all possible samples of size n from the population we are sampling from.

• Let C be the set of all samples for which we reject H0. It is called the critical region.

• is the set of all samples for which we fail to reject H0. It is called the acceptance region.C

Page 8: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 8

Decision Errors

• When we perform a statistical test we hope that our decision will be correct, but sometimes it will be wrong. There are two possible errors that can be made in hypothesis test.

• The error made by rejecting the null hypothesis H0 when in fact H0is true is called a type I error.

• The error made by failing to reject the null hypothesis H0 when in fact H0 is false is called a type II error.

Page 9: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 9

Size of a Test

• The probability that defines the critical region is called the size of the test and is denoted by α.

• The size of the test is also the probability of type I error.

• Example...

Page 10: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 10

Power

• The probability that a fixed size α test will reject H0 when H0 is false is called the power of the test. Power is not about an error. We want high power.

• Example…

Page 11: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 11

Decision Rules

• A hypothesis test is a decision made where we attach a probability of type I error and fix it to be α.

• However, for any set up there are lots of decision rules with the same size.

• Example:

Page 12: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 12

Simple versus Composite Hypothesis

• Recall, a simple hypothesis completely specifies the distribution. A composite does not.

• When testing a simple null hypothesis versus a composite alternative, the power of the test is a function of the parameter of interest.

• In addition, the power is also affected by the sample size.

Page 13: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 13

Example

Page 14: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 14

Test for Mean of Normal Population σ2 is known

• Suppose X1, …, Xn is a random sample from a N(μ, σ2) distribution where σ2 is known. We are interested in testing hypotheses about μ.

• The test statistics is the standardized version of the sample mean .

• We could test three sets of hypotheses…

X

Page 15: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 15

Example• The Pfft Light Bulb Company claims that the mean life of its 2 watt

bulbs is 1300 hours. Suspecting that the claim is too high, Nalph Rader gathered a random sample of 64 bulbs and tested each. He found the average life to be 1295 hours. Test the company's claim using α = 0.01. Assume σ = 20 hours.

Page 16: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 16

Exercise• A standard intelligence examination has been given for several years

with an average score of 80 and a standard deviation of 7. If 25 students taught with special emphasis on reading skill, obtain a mean grade of 83 on the examination, is there reason to believe that the special emphasis changes the result on the test? Use α = 0.05.

Page 17: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 17

Minitab Example• Data on the Degree of Reading Power (DRP) scores for 44 students are

recorded after they took a reading course. We wish to test whether the mean DRP of these students is greater than the mean DRP in the population which is known to be 32. The MINITAB output for the test is given below.

Z-TestTest of mu = 32.00 vs mu > 32.00The assumed sigma = 11.0Variable N Mean StDev SE Mean Z PDRP Scor 44 35.09 11.19 1.66 1.86 0.031

• MINITAB CommandStat > Basic Statistics > 1 Sample Z and select ‘Test mean’

Page 18: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 18

Test for Mean of Normal Population σ2 is unknown

• Suppose X1, …, Xn is a random sample from a N(μ, σ2) distribution where σ2 is unknown, n is small and we are interested in testing hypotheses about μ.

• The test statistics is...

Page 19: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 19

Example

• In a metropolitan area, the concentration of cadmium (Cd) in leaf lettuce was measured in 6 representative gardens where sewage sludge was used as fertilizer. The following measurements (in mg/kg of dry weight) were obtained. Cd: 21 38 12 15 14 8

• Is there evidence that the mean concentration of Cd is higher than 12?

Page 20: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 20

• MINITAB commands: Stat > Basic Statistics > 1-Sample t• MINITAB outputs for the above problem:

T-Test of the Mean

Test of mu = 12.00 vs mu > 12.00Variable N Mean StDev SE Mean T PCd 6 18.00 10.68 4.36 1.38 0.11

T Confidence Intervals

Variable N Mean StDev SE Mean 95.0 % CICd 6 18.00 10.68 4.36 (6.79, 29.21)

Page 21: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 21

Test for Mean of a Non-Normal Population

• Suppose X1, …, Xn are iid from some distribution with E(Xi)=μ and Var(Xi)= σ2. Further suppose that n is large and we are interested in testing hypotheses about μ.

• Since n is large the CLT applies to the sample mean and the test statistics is again the standardized version of the sample mean , that is we use the z-test.

• If the variance of the population is unknown the result of the test is approximately correct.

X

Page 22: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 22

Example –Binomial Distribution

• Suppose X1,…,Xn are random sample from Bernoulli(θ) distribution.

• We are interested in testing hypotheses about θ…

Page 23: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 23

Test on Pairs of Means – Case I

• Suppose are iid independent of that are iid .

• Further, suppose that n1 and n2 are large or that are known.

• We are interested in testing H0: μx = μy versus a one sided or a two sided alternative…

• Then,…

1...,,1 nXX ( )2, xxN σμ

2...,,1 nYY

( )2, yyN σμ

2y

2 and σσ x

Page 24: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 24

Test on Pairs of Means – Case II

• Suppose are iid independent of that are iid .

• Further, suppose that are unknown but we assume they are equal to σ2.

• We are interested in testing H0: μx - μy = δ versus a one sided or a two sided alternative…

• Then,…

1...,,1 nXX ( )2, xxN σμ

2...,,1 nYY

( )2, yyN σμ

2y

2 and σσ x

Page 25: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 25

Test on Pairs of Means – Case III

• Suppose are iid independent of that are iid .

• Further, suppose that are unknown but we can not assume that they are equal to.

• We are interested in testing H0: μx - μy = δ versus a one sided or a two sided alternative…

• Then,…

1...,,1 nXX ( )2, xxN σμ

2...,,1 nYY

( )2, yyN σμ

2y

2 and σσ x

Page 26: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 26

Example• The strength of concrete depends, to some extent, on the method

used for drying it. Two drying methods were tested on independently specimens yielding the following results…

• We can assume that the strength of concrete using each of these methods follows a normal distribution with the same variance.

• Do the methods appear to produce concrete with different mean strength? Use α = 0.05.

Page 27: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 27

Test for a Single Variance

• Suppose X1, …, Xn is a random sample from a N(μ, σ2) distribution.

• We are interested in testing versus a one sided or a two sided alternative…

• Then…

20

20 : σσ =H

Page 28: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 28

Test on Pairs of Variances

• Suppose are iid independent of that are iid .

• We are interested in testing versus a one sided or a two sided alternative…

• Then…

1...,,1 nXX ( )2, xxN σμ 2

...,,1 nYY( )2, yyN σμ

220 : yxH σσ =

Page 29: Hypothesis Testing – Introductionfisher.utstat.toronto.edu/~hadas/STA286/Lecture notes... · 2010-03-23 · Hypothesis Testing – Introduction • Hypothesis: A conjecture about

STA286 week 10 29

Example