55
Chapter 9 Test of Hypotheses for a Single Sample

Chapter 9 Test of Hypotheses for a Single Sample

Embed Size (px)

Citation preview

Page 1: Chapter 9 Test of Hypotheses for a Single Sample

Chapter 9

Test of Hypotheses for a

Single Sample

Page 2: Chapter 9 Test of Hypotheses for a Single Sample

Learning Objectives

• Structure hypothesis tests

• Test hypotheses on the mean of a normal distribution using either a Z-test or a t-test procedure

• Test hypotheses on the variance or standard deviation of a normal distribution

• Test hypotheses on a population proportion

• Use the P-value approach for making decisions in hypotheses tests

Page 3: Chapter 9 Test of Hypotheses for a Single Sample

Learning Objectives

• Compute power, type II error probability, and make sample size selection decisions for tests on means, variances, and proportions

• Explain and use the relationship between confidence intervals and hypothesis tests

• Use the chi-square goodness of fit test to check distributional assumptions

• Use contingency table tests

Page 4: Chapter 9 Test of Hypotheses for a Single Sample

Statistical Hypotheses

• Construct a confidence interval estimate of a parameter from sample data

• Many problems require that we decide whether to accept or reject a statement about some parameter– Called a hypothesis

• Decision-making procedure about the hypothesis is called hypothesis testing

Page 5: Chapter 9 Test of Hypotheses for a Single Sample

Statistical Hypotheses

• Useful aspects of statistical inference • Relationship between hypothesis testing and

confidence intervals• Focus is on testing hypotheses concerning the

parameters of one or more populations

Page 6: Chapter 9 Test of Hypotheses for a Single Sample

Sources of Null Hypothesis

• Three ways to specify the null hypothesis– May result from past experience or knowledge– May be determined from some theory or model

regarding the process under study– May be determined from external

considerations

Page 7: Chapter 9 Test of Hypotheses for a Single Sample

Sample, Population and Statistical Inference

• Statements about the population, not statements about the sample

• If this information is consistent with the hypothesis– Conclude that the hypothesis is true

• If this information is inconsistent with the hypothesis– Conclude that the hypothesis is false

• Truth or falsity of a particular hypothesis can never be known with certainty

• Unless we can examine the entire population

Page 8: Chapter 9 Test of Hypotheses for a Single Sample

Structure of Hypothesis-testing

• Identical in all the applications• The null hypothesis

– Hypothesis we wish to test– Rejection of the null hypothesis always leads to

accepting the alternative hypothesis

• The alternate hypothesis – Takes on several values– Involves taking a random sample– Computing a test statistic from the sample data– Make a decision about the null hypothesis

Page 9: Chapter 9 Test of Hypotheses for a Single Sample

Structure of Hypothesis-testing

• Suppose a manufacturer is interested in the output voltage of a power supply– Null hypothesis :H0: =50 v– Alt. hypothesis: H1: 50 v– A sample of n=10 specimens is tested

• If the sample mean is close to 50 v– Such evidence supports the null hypothesis H0

• If the sample mean is different from 50 v– Such evidence is in support of the alternative

hypothesis

Page 10: Chapter 9 Test of Hypotheses for a Single Sample

Critical Regions• The sample mean can take on many different

values– Suppose 48.5 x 51.5– Constitutes the critical region for the test– Acceptance region– The boundaries between the critical regions and the

acceptance region are called the critical values– Critical values are 48.5 and 51.5

Reject H0

50 Volts

Fail to reject H0

=50 Volts

Reject H0

50 Volts

48.5 50 51.5

Page 11: Chapter 9 Test of Hypotheses for a Single Sample

Two Types of Error• Type I Error

– Occurs when a true null hypothesis is rejected– Value of represents the probability of committing this

type of error = P (Ho is rejected / Ho is true)

is called the significance level of the test

• Type II Error – Occurs when a false null hypothesis is not rejected – Value of represents the probability of committing a type

II error = P(fail to reject Ho / Ho is false)

Page 12: Chapter 9 Test of Hypotheses for a Single Sample

Two Types of Error• In testing any statistical hypothesis, four different

situations determine whether the final decision is correct or in error

• Probabilities can be associated with the type I and type II errors

H0 is True H0 is False

Do not reject H0 Correct Decision

Type II or error

Reject H0 Type or

error Correct Decision

Page 13: Chapter 9 Test of Hypotheses for a Single Sample

Probability of Making a Type I Error

• Probability of making a type I error is denoted– = P (type I error) =P (reject H0 when H0 is

true)

• Sometimes the type I error probability is called the significance level or the -error

• Previous example, a type I error will occur when either sample mean > 51.5 or <48.5 or when the true voltage is =50 v

Page 14: Chapter 9 Test of Hypotheses for a Single Sample

Probability of Type I Error• Probability of type I error can be shown by the

tails of normal distribution

= P(X<48.5 when =50) +P(X>51.5 when =50)• Using the corresponding z-values, =0.0574• 5.74% of all random samples would lead to rejection of

the hypothesis when the true mean is really 50 v

Page 15: Chapter 9 Test of Hypotheses for a Single Sample

Probability of Type II Error• Examine the probability of a Type II error = P(type II error) = P(fail to reject H0 when H0 is

false)• Have a specific alternative hypothesis• Alterative hypothesis: H1: =52 v• A type II error will be committed if the sample mean

falls between 48.5 and 51.5 when =52 v • Probability that 48.5x-bar 51.5 when H0 is false

(because =52) • Using the z-values, the =0.2643• Corresponds to testing H0: =50 against H1: 50

with n =10, when the true value of the mean=52

Page 16: Chapter 9 Test of Hypotheses for a Single Sample

Power of a Statistical Test • Power = 1-

• Power=1-0.2643=0.7357

• Power can be interpreted as the probability of correctly rejecting a false null hypothesis

• If it is too low, the analyst can increase either or the sample size n

Page 17: Chapter 9 Test of Hypotheses for a Single Sample

Example-1• A textile fiber manufacturer is investigating

a new drapery yarn, which the company claims has a mean thread elongation of 12 kg with a standard deviation of 0.5 kg.

• The company wishes to test the hypothesis H0: =12 against H1<12, using a random sample of four specimens.

1. What is the type I error probability if the critical region is defined as sample mean <11.5 kg?

2. Find for the case where the true mean elongation is 11.25 kg.

Page 18: Chapter 9 Test of Hypotheses for a Single Sample

Solution-Part 1 = P(reject H0 when H0 is true)

= P( 11.5 when = 12)

= P(Z 2)= 1 P(Z 2)

= 1 0.97725 = 0.02275

• The probability of rejecting the null hypothesis when it is true is 0.02275

4/5.0125.11

/ nX

P

X

Page 19: Chapter 9 Test of Hypotheses for a Single Sample

Solution-Part 2 = P(accept H0 when = 11.25)

=

=P(Z > 1.0) = 1 P(Z 1.0)

=1 0.84134 = 0.15866

• The probability of accepting the null hypothesis when it is false is 0.15866.

P X when 115 1125. .

4/5.025.115.11

/ nX

P

Page 20: Chapter 9 Test of Hypotheses for a Single Sample

Tests on The Mean of a Normal Distribution, Variance Known

• Consider hypothesis testing about the mean of a single, normal population where the variance of the population 2 is known

• Random sample X1, X2, … , Xn has been taken from the population

x is an unbiased point estimator of with variance 2/n• Test the hypotheses

• H0: =0

• H1: 0

• Test procedure for H0:=0 uses the test statistic

Page 21: Chapter 9 Test of Hypotheses for a Single Sample

Cont.• If is the significance level, the probability that

the test statistic Z0 falls between -Z/2 and Z/2

will be 1-

• Regions associated with -Z/2 and Z/2

• Reject H0 if the observed value of the test statistic z0 is either > Z/2 or <-Z/2

Page 22: Chapter 9 Test of Hypotheses for a Single Sample

Location of Critical Region for One-sided Tests

The distribution of Z0 when H0: =0 is true, for the one-sided alternative H1: >0

The distribution of Z0 when H0: =0 is true, for the one-sided alternative H1: <0

Page 23: Chapter 9 Test of Hypotheses for a Single Sample

Relationship between the Signs in Ho And H1

Two-sided Test

Left-sided Test

Right-sided Test

Sign in the H0 = = or = or

Sign in the H1 < >

Rejection Region

On both sides

On the left side

On the right side

Page 24: Chapter 9 Test of Hypotheses for a Single Sample

General Procedure for Hypothesis Tests

• Following steps will be used1. From the problem, identify the parameter

of interest

2. State the null hypothesis, H0

3. Specify an appropriate alternative hypothesis, H1

4. Choose a significance level 5. Determine an appropriate test statistic

Page 25: Chapter 9 Test of Hypotheses for a Single Sample

General Procedure for Hypothesis Tests

6. State the rejection region for the statistic

7. Compute any necessary sample quantities, substitute these into the equation for the test statistic, and compute that value

8. Decide whether or not H0 should be rejected

Page 26: Chapter 9 Test of Hypotheses for a Single Sample

Example-2• A manufacturer produces crankshafts for an

automobile engine• The wear of the crankshaft after 100,000 miles

(0.0001 inch) is of interest because it is likely to have an impact on warranty claims

• A random sample of n=15 shafts is tested and sample mean is 2.78

• It is known that =0.9 and that wear is normally distributed– Test H0: =3 versus H1: 3 using =0.05

Page 27: Chapter 9 Test of Hypotheses for a Single Sample

Solution• Using the general procedure for hypothesis

testing1. The parameter of interest is the true mean crankshaft wear, 2. H0 : = 3

3. H1 : 34. = 0.055. Test statistic is

6. Reject H0 if z0 < z /2 where z0.005 = 1.96 or z0 > z/2 where z0.005 = 1.96

7. and = 0.9

8. Since –0.95 > -1.96, do not reject the null hypothesis and conclude there is not sufficient evidence to support the claim the mean crankshaft wear is not equal to 3 at = 0.05

zx

n0

/

78.2x95.0

15/9.0378.2

0z

Page 28: Chapter 9 Test of Hypotheses for a Single Sample

P-Values in Hypothesis Tests• P-value is the smallest level of significance that

would lead to rejection of the null hypothesis H0

• Conveys much information about the weight of evidence against H0

• Adopted widely in practice• P-value is

Page 29: Chapter 9 Test of Hypotheses for a Single Sample

Example-3• What is the P-value in Example-2?

• SolutionP-value = 2[1 (|-0.95|)]

=2[1-0.8289]

=0.34

Page 30: Chapter 9 Test of Hypotheses for a Single Sample

Probability of Type II Error

• Analyst directly selects the type I error probability• Probability of type II error depends on the choice of

sample size• Considering a two-sided test, the probability of the

type II error is the probability that Z0 falls between -Z/2 and Z/2 given that H1 is true

• Expressed mathematically, this probability is

Page 31: Chapter 9 Test of Hypotheses for a Single Sample

Example-4• What is the power of the test in Example-2 if

=3.25?• Solution

= (1.96 + 1.075) (1.96 + 1.075)

= (0.884) (3.035)

= 0.81057—0.001223

=0.8098

• Power=1-0.8098

=0.1902

15/9.025.33

15/9.025.33

025.0025.0zz

Page 32: Chapter 9 Test of Hypotheses for a Single Sample

Choice of Sample Size• Suppose that the null hypothesis is false and that the true

value of the mean is = +0, where >0

• Formulas that determine the appropriate sample size to obtain a particular value of for a given and are

• Two sided-test alternative hypotheses

• For either of the one-sided alternative hypotheses

• Where =-0

Page 33: Chapter 9 Test of Hypotheses for a Single Sample

Example-5• Considering the problem in Example-2, what

sample size would be required to detect a true mean of 3.75 if we wanted the power to be at least 0.9?

• Solution

,218.20

)75.0(

)9.0()29.196.1(

)375.3( 2

22

2

2210.0025.0

2

222/

zzzz

n

Page 34: Chapter 9 Test of Hypotheses for a Single Sample

Using Operating Characteristic Curves

• Convenient to use the operating characteristic curves in Appendix Charts VIa and VIb to find

• Curves plot against a parameter d for various sample sizes n

• d is defined as

Page 35: Chapter 9 Test of Hypotheses for a Single Sample

Using Operating Characteristic Curves

• Curves are provided for both =0.05 and =0.01

• When d=0.5, n =25, and =0.05, Then =0.3 • 30% chance that the true will not be detected by the test

with n =25

Page 36: Chapter 9 Test of Hypotheses for a Single Sample

Large-Sample Test

• In most practical situations 2 will be unknown• May not be certain that the population is well

modeled by a normal distribution• If n is large (say n>40)• Sample standard deviation s can be substituted

for • Valid regardless of the form of the distribution of

the population• Relies on the central limit theorem just as we did

for the large sample confidence interval

Page 37: Chapter 9 Test of Hypotheses for a Single Sample

Tests On The Mean Of A Normal Distribution, Variance Unknown

• Situation is analogous to Ch.8, where we constructed a C.I.

• S2 replaces 2

• Use the test statistic

• Use the critical values -tα/2,n-1 and tα/2,n-1 as the boundaries of the critical region

• Reject H0: μ=μ0 if t0> tα/2,n-1 or if t0<-tα/2,n-1

Page 38: Chapter 9 Test of Hypotheses for a Single Sample

Location of the Critical Region• H1: μ > μ0

• H1: μ μ0

• H1: μ < μ0

Page 39: Chapter 9 Test of Hypotheses for a Single Sample

Choice of Sample Size• Situation is analogous to the case, where

variance was known

• Use the sample variance s2 to estimate 2

• Charts VIe, VIf, VIg, and VIh plot β for the t-test against a parameter d for various sample sizes n

Page 40: Chapter 9 Test of Hypotheses for a Single Sample

Hypothesis Tests on the Standard Deviation of a Normal Population

• Wish to test the hypotheses on the population variance

• Suppose– H0: 2=2

0

– H1: 2#20

• Use the test statistic

• X2 follows the chi-square distribution with n-1 degrees of freedom

• Reject H0: 2=20 if X2

0> X2α/2,n-1 or if X2

0 <X21-α/2,n-1

Page 41: Chapter 9 Test of Hypotheses for a Single Sample

Location of the Critical Region• Reference distribution for the test of H0: 2=2

0 with critical region values• H1: 2 2

0

• H1: 2 <20

• H1: 2 >20

Page 42: Chapter 9 Test of Hypotheses for a Single Sample

Tests on a Population Proportion• Test hypotheses on a population proportion• Recall Pˆ =X/n is a point estimator of the

proportion of the population p• Sampling distribution of Pˆ is approximately

normal with mean p and variance p(1-p)/n• Now consider testing the hypotheses

– H0: p=p0

– H1: p#p0

• Use

• Reject H0: p=p0 if z0>zα/2 or z0<-zα/2

Page 43: Chapter 9 Test of Hypotheses for a Single Sample

Type II Error and Choice of Sample Size

• Obtain closed-form equations for the approximate β-error for the tests

• For the two-sided alternative, sample size equation

• For the one-sided alternative, sample size equation

Page 44: Chapter 9 Test of Hypotheses for a Single Sample

Example-6• An article in Fortune (September 21, 1992)

claimed that nearly one-half of all engineers continue academic studies beyond the B.S. degree, ultimately receiving either an M.S. or a Ph.D. degree

• Data from an article in Engineering Horizons (Spring 1990) indicated that 117 of 484 new engineering graduates were planning graduate study– Are the data from Engineering Horizons consistent

with the claim reported by Fortune? Use =0.05 in reaching your conclusions

– Find the P-value for this test

Page 45: Chapter 9 Test of Hypotheses for a Single Sample

Solution• Part 1

1. True proportion of engineers, p

2. H0 : p = 0.50

3. H1 : p 0.504. = 0.055. Test statistic

6. Reject H0 if z0 < z/2 where z/2 = z0.025 = 1.96 or z0 > z/2 where z/2 = z0.025 = 1.96

7. x = 117 n = 484

8. Since 11.352 < 1.96, reject the null hypothesis

• Part 21. P-value = 2(1 (11.352)) = 2(1 1) = 0

z

p p

p p

n

00

0 01

.p 117

4840 242

z

p p

p p

n

00

0 01

0 242 0 50

0 5 1 0 5

484

11352

. .

. ( . ).

Page 46: Chapter 9 Test of Hypotheses for a Single Sample

Testing for Goodness of Fit

• Not know the underlying distribution of the population

• Wish to test the hypothesis that a particular distribution will be satisfactory as a population model– For example, test the hypothesis that the population is

normal

• Used a very useful graphical technique called probability plotting

• A formal goodness-of-fit test procedure based on the chi-square distribution

Page 47: Chapter 9 Test of Hypotheses for a Single Sample

Test Procedure• Requires a random sample of size n from the population

whose probability distribution is unknown• Arranged the n observations in a frequency histogram

– k bins or class intervals

• Let Oi be the observed frequency in the ith class interval• Compute the expected frequency, Ei, in the ith class interval• Test statistic

• If the population follows the hypothesized distribution, X2 has a chi-square distribution with k-p-1 d.o.f.– p represents the number of parameters of the hypothesized

distribution• Reject the hypothesis that the distribution if the calculated

value of the test statistic

Page 48: Chapter 9 Test of Hypotheses for a Single Sample

Magnitude of Expected Frequencies

• Application of this test procedure concerns the magnitude of the expected frequencies

• There is no general agreement regarding the minimum value of expected frequencies

• But values of 3, 4, and 5 are widely used as minimal

• Use 3 as minimal

Page 49: Chapter 9 Test of Hypotheses for a Single Sample

Example-7• Consider the following frequency table of

observations on the random variable X

• Based on these 100 observations, is a Poisson distribution with a mean of 1.2 an appropriate model? Perform a goodness-of-fit procedure with α=0.05

Values 0 1 2 3 4

Observed Frequencies 24 30 31 11 4

Page 50: Chapter 9 Test of Hypotheses for a Single Sample

Solution

• Mean=1.2• Degrees of freedom=k-p-1=4-0-1=3

• Compute pi

• P1=P(X=0)=[e-01.2 (0.75)0]/0! =0.3012

• Similarly, p2, p3, p4, and p5 are 0.3614, 0.2169, 0.0867, 0.0260, respectively

• Expected frequency Ei=npi

• Expected frequency for class 1 =0.3012*100=30.12

• Similarly, the E2,E3, E4, and E5 are 36.14, 21.69, 8.67, and 2.60, respectively

Page 51: Chapter 9 Test of Hypotheses for a Single Sample

Solution-Cont.• Summarize the expected and observed frequencies are

Value Observed frequency Expected frequency

0 24 30.12

1 30 36.14

2 31 21.69

3 11 8.67

4 4 2.69

• Expected frequency in the last interval is < 3, we combine the last two rowsValue Observed frequency Expected frequency

0 24 30.12

1 30 36.14

2 31 21.69

3-4 15 11.67

Page 52: Chapter 9 Test of Hypotheses for a Single Sample

Solution-Cont.1. Variable of interest

2. H0: Form of the distribution is Poisson

3. H1: Form of the distribution is not Poisson4. = 0.055. Test statistic is

6. Reject H0 if 7. Computations

8. Since 7.23 < 7.81 do not reject H0

0

22

1

O E

Ei i

ii

k

o2

0 05 32 7 81 . , .

0

22 2

24 3012

3012

15 1167

11677 23

.

.

.

..

Page 53: Chapter 9 Test of Hypotheses for a Single Sample

Contingency Table Tests• Classify n elements of a sample to two different criteria• Know whether the two methods of classification are

statistically independent• Example

– Consider the population of graduating engineers– May wish to determine whether starting salary is independent of

academic disciplines

• First method of classification has r levels• Second method has c levels

• Let Oij be the observed frequency for level i of the first classification and level j on the second classification

• Construct an r x c table • Called an r x c contingency table

Page 54: Chapter 9 Test of Hypotheses for a Single Sample

Testing the Hypothesis• Interested in testing the hypothesis that the methods of

classification are independent• By rejecting the hypothesis

– There is some interaction between the two criteria of classification

• The statistic• Has an chi-square distribution with (r-1)(c-1) d.o.f. • Reject the hypothesis of independence if

Page 55: Chapter 9 Test of Hypotheses for a Single Sample

Example• Patients in a hospital are classified as surgical or medical• A record is kept of the number of times patients require• nursing service during the night and whether or not these• patients are on Medicare. The data are presented here:

• Test the hypothesis (using =0.01) that calls by surgical medical patients are independent of whether the patients are receiving Medicare. Find the P-value for this test

• Solution