bio-statistics- tests of hypotheses · one-tailed (one-sided): a test of a statistical hypothesis,...

21
10/13/2019 1 SBE 304: Bio-Statistics Test of Hypotheses Dr. Ayman Eldeib Systems & Biomedical Engineering Department Fall 2019 SBE 304: Tests of Hypotheses Statistics Descriptive Inferential Correlational Relationships Organising, summarising & describing data Estimation Hypothesis

Upload: others

Post on 29-Jul-2020

3 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

1

SBE 304: Bio-Statistics

Test of Hypotheses

Dr. Ayman Eldeib

Systems & Biomedical Engineering Department

Fall 2019

SBE 304: Tests of Hypotheses

Statistics

Descriptive Inferential

Correlational

Relationships

Organising, summarising & describing data

Estimation Hypothesis

Page 2: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

2

SBE 304: Tests of Hypotheses

Statistical Hypotheses

A statistical hypothesis is an assumption about a population parameter. This assumption may or may not be

true.

Hypothesis testing is the use of statistics to determine the probability that a given hypothesis is true.

Most often in real life, decisions are required to be made concerning populations on the basis of sample information. Statistical tests are used in arriving at

these decisions.

SBE 304: Tests of Hypotheses

Null Hypothesis: The null hypothesis, denoted by H0, is usually the hypothesis that sample observations result purely from chance.

Alternative Hypothesis: The alternative hypothesis, denoted by H1 or Ha, is the hypothesis that sample observations are influenced by some non-random cause.

Types

Statistical Hypotheses

Page 3: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

3

SBE 304: Tests of Hypotheses

At a pharmaceutical company, a new drug has been developed which should reduce cholesterol much more than their current drug on the market. Is this true? Hypotheses:

H0: New drug has the same effect on cholesterol as the current drug.

HA: New drug reduces cholesterol more than the current drug.

Example

Statistical Hypotheses

SBE 304: Tests of Hypotheses

A new method for teaching statistics utilizing technology has been developed. Is it more successful than the usual lecture approach? Hypotheses:

H0: The teaching methods are equally as effective.

HA: The new teaching method is more successful than the usual approach.

Statistical Hypotheses

Example

Page 4: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

4

SBE 304: Tests of Hypotheses

Test Type

One-Tailed (One-Sided): A test of a statistical hypothesis, where the

region of rejection is on only one side of the sampling distribution.

H0: µ = 10 H1: µ > 10

Two-Tailed (Two-Sided): A test of a statistical hypothesis, where the

region of rejection is on both sides of the sampling distribution.

H0: µ = 10 H1: µ ≠ 10

Statistical Hypotheses

SBE 304: Tests of Hypotheses

Null hypothesis Alternative hypothesis Number of tails

μ = M μ ≠ M 2

μ > M μ < M 1

μ < M μ > M 1

Statistical Hypotheses

Test Type

Page 5: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

5

SBE 304: Tests of Hypotheses

Type I error: A Type I error occurs when rejecting a null hypothesis

when it is true. The probability of committing a Type I error is called the

significance level. This probability is also called alpha, and is often

denoted by α.

α = P(type I error) = P(reject H0 when H0 is true)

Type II error. A Type II error occurs when failing to reject a null

hypothesis that is false. The probability of committing a Type II error is

called Beta, and is often denoted by β. The probability of not

committing a Type II error is called the Power of the test.

β = P(type II error) = P(accept H0 when H0 is false)

The power of the test = 1 - β

Types of Decision Errors

Statistical Hypotheses

SBE 304: Tests of Hypotheses

Decision H0 Is True H0 Is False

Accept H0no error

type II error (β)

the Power of the test (1-β)

[false negative]

Reject H0

type I error

significance level (α)

[false positive]

no error

Cont’d

Statistical Hypotheses

Types of Decision Errors

Page 6: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

6

SBE 304: Tests of Hypotheses

Decision Errors

Suppose that a political candidate, Jones, claims that he will gain more than 50% of the votes in a city election and thereby emerge as the winner.

Example I

We selected 15 voters. We wish to test H0: p = 0.5 against the alternative, Ha: p < 0.5. The test statistics in Y, the number of sampled voters favoring Jones. Calculate α if we select RR = {y ≤ 2} as the rejection region. α = P(type I error) = P(reject H0 when H0 is true)

= P(value of test statistic is in RR when H0 is true)

= P(Y ≤ 2 when p = 0.5)

Observe that Y is a binomial random variable with n = 15. If H0 is true,

p = 0.5 and we obtain

α = ( )( ) ( ) 004.05.05.015

2

0

15 =−

=

yy

y

y

SBE 304: Tests of Hypotheses

Suppose p = 30%, calculate β

( )( ) ( ) 873.07.03.015

15

3

15 =−

=

yy

y

y

β = P(type II error) = P(accept H0 when H0 is false)

= P(values of the test statistic is not in RR when Ha is true)= P(Y > 2 when p = 0.3)

=

RR

Probabilities of Error y≤2 y≤5

α 0.004 0.151

β when p =0.3 0.873 0.278

Cont’d

Decision ErrorsExample I

Page 7: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

7

SBE 304: Tests of Hypotheses

Statistical Hypotheses

Procedure of Hypothesis Testing

1. State the hypotheses. This involves stating the null and alternative

hypotheses. The hypotheses are stated in such a way that they are

mutually exclusive. That is, if one is true, the other must be false.

2. Formulate an analysis plan. The analysis plan describes how to use

sample data to evaluate the null hypothesis. The evaluation often

focuses around a single test statistic.

3. Analyze sample data. Find the value of the test statistic (proportion, t-

score, z-score, etc.) described in the analysis plan.

4. Interpret results. Apply the decision rule described in the analysis

plan. If the value of the test statistic is unlikely, based on the null

hypothesis, reject the null hypothesis

SBE 304: Tests of Hypotheses

Hypothesis Tests on the mean

H0: µ = µ0

H1: µ ≠ µ0

n

YZ

σµ 0

0

−=

Critical Region (CR) or Rejection Region (RR)

Two-tailed RR Upper-tailed RR Lower-tailed RR

Page 8: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

8

SBE 304: Tests of Hypotheses

P-Value

The P-value is the probability of observing a sample statistic as extreme as the test statistic, assuming the null hypothesis

is true.

The P-value is the smallest level of significance that

would lead to rejection of the null hypothesis H0 with the

given data.

The smaller the p-value, the stronger the evidence against H0.

For an upper-tailed test, the p-value is P(Z > zobs).For a lower-tailed test, the p-value is P(Z < zobs).For a two-tailed test, the p-value is

P(Z > | zobs |) + P(Z < −| zobs |) = 2 P(Z > | zobs |).

SBE 304: Tests of Hypotheses

P-value for One-Tailed Tests

P-value for Two-Tailed Tests

P-Value

Page 9: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

9

SBE 304: Tests of Hypotheses

P-value Approach

1. Pick an appropriate significance level, α, and then

2. Calculate (or look up from a table) the p-value of your

observed statistic

3. If the p-value is less than α, then reject the null hypothesis

P-Value

SBE 304: Tests of Hypotheses

Attained Significance Levels or P-Values

Page 10: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

10

SBE 304: Tests of Hypotheses

Attained Significance Levels or P-Values

SBE 304: Tests of Hypotheses

Attained Significance Levels or P-Values

Page 11: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

11

SBE 304: Tests of Hypotheses

Attained Significance Levels or P-Values

SBE 304: Tests of Hypotheses

Statistical Hypotheses

The analysis plan includes decision rules for rejecting the null hypothesis with reference to a P-value or with reference to a region of acceptance.

If the P-value is less than the significance level, we reject the null hypothesis.

The region of acceptance is a range of values. If the test statistic falls within the region of acceptance, the null hypothesis is not rejected. The region of acceptance is defined so that the chance of making a Type I error is equal to the significance level.

The set of values outside the region of acceptance is called the region of rejection. If the test statistic falls within the region of rejection, the null hypothesis is rejected. In such cases, we say that the hypothesis has been rejected at the α level of significance.

These approaches are equivalent.

Decision Rules

Page 12: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

12

SBE 304: Tests of Hypotheses

Hypothesis Tests on the mean

Example II

A vice president in charge of sales for a large corporation claims that salespeople are averaging no more than 15 sales contacts per week.

As a check on his claim, n=36 salespeople are selected at random, and the number of contacts made by each is recorded for a single randomly selected week.

The mean and variance of the 36 measurements were 17 and 9, respectively. Does the evidence contradict the vice president’s claim? Use a test with level α = 0.05.

SBE 304: Tests of Hypotheses

H0: µ = 15H1: µ > 15

436/3

15170

0 =−

=−

=

n

YZ

σµ

The RR, with α = 0.05, is given by z > z.05 = 1.645

Because the observed value of Z lies in the RR ( z = 4 exceeds z.05 = 1.645), we reject H0: µ = 15. Thus, at the α = 0.05 level of significance, the evidence is sufficient to indicate that the vice president’s claim is incorrect and that the average number of sales contacts per week exceeds 15.

Example II

Cont’d

Hypothesis Tests on the mean

Page 13: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

13

SBE 304: Tests of Hypotheses

Hypothesis Tests on the mean

t-Distribution

SBE 304: Tests of Hypotheses

Hypothesis Tests on the Population

Proportion

( ) npp

pp

pnp

npYZ

/1)1( 00

0

00

0

0

−=

−=

)

Page 14: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

14

SBE 304: Tests of Hypotheses

Hypothesis Tests

An inventor has developed a new, energy-efficient engine. He claims that the engine will run continuously for 5 hours (300 minutes) on a single gallon of regular gasoline. Suppose a simple random sample of 50 engines is tested. The engines run for an average of 295 minutes, with a standard deviation of 20 minutes. Test the null hypothesis that the mean run time is 300 minutes against the alternative hypothesis that the mean run time is not 300 minutes. Use a 0.05 level of significance.

Example III

SBE 304: Tests of Hypotheses

State the hypothesesNull hypothesis: μ = 300

Alternative hypothesis: μ ≠ 300

Note that these hypotheses constitute a two-tailed test. The null

hypothesis will be rejected if the sample mean is too big or if it is too

small.

Formulate an analysis plan For this analysis, the significance level is

0.05. The test method is a t-test.

Analyze sample dataUsing sample data, we compute the standard error

(SE), degrees of freedom (DF), and the t-score test

statistic (t).

Cont’d

Hypothesis Tests

Example III

Page 15: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

15

SBE 304: Tests of Hypotheses

Analyze sample dataUsing sample data, we compute the standard error

(SE), degrees of freedom (DF), and the t-score test

statistic (t).

Since we have a two-tailed test, the P-value is the probability that the t-

score having 49 degrees of freedom is less than -1.77 or greater than 1.77.

We use the t Distribution Table to find P(t < -1.77) = 0.04, and P(t > 1.77) =

0.04. Thus, the P-value = 0.04 + 0.04 = 0.08.

Interpret resultsSince the P-value (0.08) is greater than the

significance level (0.05), we cannot reject the null

hypothesis.

SE = s / sqrt(n) = 20 / sqrt(50) = 20/7.07 = 2.83

DF = n - 1 = 50 - 1 = 49

t = (μ - x) / SE = (300 - 295)/2.83 = 1.77_

Cont’d

Hypothesis Tests

Example III

SBE 304: Tests of Hypotheses

An elementary School has 300 students. The principal of the school thinks that the average IQ of students is at least 110. To prove her point, she administers an IQ test to 20 randomly selected students. Among the sampled students, the average IQ is 108 with a standard deviation of 10. Based on these results, should the principal accept or reject her original hypothesis? Assume a significance level of 0.01.

Hypothesis Tests

Example IV

Page 16: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

16

SBE 304: Tests of Hypotheses

State the hypothesesNull hypothesis: μ >= 110

Alternative hypothesis: μ < 110

Note that these hypotheses constitute a one-tailed test. The null

hypothesis will be rejected if the sample mean is too small.

Formulate an analysis planFor this analysis, the significance level is

0.01. The test method is a t-test.

Analyze sample dataUsing sample data, we compute the standard error

(SE), degrees of freedom (DF), and the t-score test

statistic (t).

Cont’d

Hypothesis Tests

Example IV

SBE 304: Tests of Hypotheses

Analyze sample dataUsing sample data, we compute the standard error

(SE), degrees of freedom (DF), and the t-score test

statistic (t).

Since we have a one-tailed test, the P-value is the probability that the

t-score having 19 degrees of freedom is less than -0.894.

We use the t Distribution table to find P(t < -0.894) = 0.19. Thus, the

P-value is 0.19.

Interpret resultsSince the P-value (0.19) is greater than the

significance level (0.01), we cannot reject the null

hypothesis.

SE = s / sqrt(n) = 10 / sqrt(20) = 10/4.472 = 2.236

DF = n - 1 = 20 - 1 = 19

t = (x - μ) / SE = (108 - 110)/2.236 = -0.894_

Cont’d

Hypothesis Tests

Example IV

Page 17: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

17

SBE 304: Tests of Hypotheses

A machine in a factory must be repaired if it producesmore than 10% defectives among the large lot of items itproduces in a day. A random sample of 100 items from theday's production contains 15 defectives, and the supervisor

says

that the machine must be repaired.

Does the sample evidence support his decision?

Use a test level 0.01.

Hypothesis Tests

Example V

SBE 304: Tests of Hypotheses

State the hypothesesNull hypothesis: p = 0.10

Alternative hypothesis: p > 0.10

Note that these hypotheses constitute a one-tailed test. The null

hypothesis will be rejected if the sample mean is too big.

Formulate an analysis plan For this analysis, the significance level is

0.01. The test method is a z-test.

Analyze sample dataUsing sample data, we compute the standard error

(SE) and the z-score test statistic (z).

Cont’d

Hypothesis Tests

Example V

Page 18: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

18

SBE 304: Tests of Hypotheses

Analyze sample dataUsing sample data, we compute the standard error

(SE) and the z-score test statistic (z).

Interpret results

( )667.1

3

5

100/)9.0)(1.0(

10.015.0

/1)1( 00

0

00

00 ==

−=

−=

−=

npp

pp

pnp

npYZ

)

We use the z Distribution table to find P(z > 2.33) = 0.01. Hence,

we take {z > 2.33} as the rejection region.

Because the observed value of Z is not in the rejection

region, we can not reject H0. We conclude that, at the α

= 0.01 level of significance, the evidence does not

support the supervisor’s decision.

Cont’d

Hypothesis Tests

Example V

SBE 304: Tests of Hypotheses

Sample Size for an Upper-Tail α-Level Test

Suppose that we want to test H0: µ = µ0 versus Ha : µ > µ0

If we specify the desired values α and β where β is evaluated when µ = µa and µa > µ0

µ0

µak

k

α

β

Reject H0

Accept H0

Page 19: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

19

SBE 304: Tests of Hypotheses

α = P(type I error) = P(reject H0 when H0 is true)

=

)(0

00

αµµσ

µ

σ

µα zZPwhen

n

k

n

YP >=

=−

>−

=

Suppose that we want to test H0: µ = µ0 versus Ha : µ > µ0

If we specify the desired values α and β where β is evaluated when µ = µa and µa > µ0

( )0µµ => whenkYP

Cont’d

Sample Size for an Upper-Tail α-Level Test

SBE 304: Tests of Hypotheses

β = P(type II error) = P(accept H0 when H0 is false)

=

)( βµµσ

µ

σ

µβ zZPwhen

n

k

n

YP a

aa−≤=

=−

≤−

=

Suppose that we want to test H0: µ = µ0 versus Ha : µ > µ0

If we specify the desired values α and β where β is evaluated when µ = µa and µa > µ0

( )awhenkYP µµ =≤

Cont’d

Sample Size for an Upper-Tail α-Level Test

Page 20: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

20

SBE 304: Tests of Hypotheses

βσ

µz

n

k a−=

Suppose that we want to test H0: µ = µ0 versus Ha : µ > µ0

If we specify the desired values α and β where β is evaluated when µ = µa and µa > µ0

ασ

µz

n

k=

− 0

20

22

)(

)(

µµ

σβα

+=

a

zzn

Cont’d

Sample Size for an Upper-Tail α-Level Test

SBE 304: Tests of Hypotheses

Suppose that the vice president in the previous example wants to test

H0: µ = 15 versus Ha : µ = 16. Find β for this test.

ασ

µz

n

k=

− 0

From the previous example n= 36, y = 17, s2 = 9, α = 0.05_

8225.1536

3645.115 =

+=k

Sample Size for an Upper-Tail α-Level Test

Example VI

Page 21: Bio-Statistics- Tests of Hypotheses · One-Tailed (One-Sided): A test of a statistical hypothesis, where the region of rejection is on only one side of the sampling distribution

10/13/2019

21

SBE 304: Tests of Hypotheses

359.0)36.0()( =−≤=−≤= ZPzZP ββ

βσµ

z

n

k a−=

−36.0

363

168225.15−=

−=− βz

Cont’d

Sample Size for an Upper-Tail α-Level Test

Example VI

SBE 304: Tests of Hypotheses

Suppose that the vice president in the previous example wants to test

H0: µ = 15 versus Ha : µ = 16 with α=β=0.05. Find the sample size that

will ensure this accuracy assuming that σ2 is 9.

984.97)1516(

)9()645.1645.1(

)(

)(2

2

20

22

≅=−

+=

+=

− µµ

σβα

a

zzn

Because α=β=0.05, it follows that zα = zβ = z0.05 = 1.645. Then,

Cont’d

Sample Size for an Upper-Tail α-Level Test

Example VII