hypothesis testing judicial analogy hypothesis testing hypothesis testing null hypothesis purpose ...

52
Hypothesis Testing

Upload: alexis-evans

Post on 13-Jan-2016

322 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Hypothesis Testing

Page 2: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Judicial Analogy

Hypothesis

Collect Evidence Decision Rule

Significance Level

Page 3: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Hypothesis Testing

• Hypothesis testing

Null hypothesis

• Purpose

Test the viability

• Null hypothesis

Population parameter

Reverse of what the experimenter believes

Page 4: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Hypothesis Testing

1. State the null hypothesis, H0

2. State the alternative hypothesis, HA

3. Choose , our significance level

4. Select a statistical test, and find the observed test statistic

5. Find the critical value of the test statistic ( and p value)

6. Compare the observed test statistic with the critical value,

(or compare the p value with ), and decide to accept or

reject H0

Page 5: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Coin Example

H

HH

T T

Page 6: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Coin Analogy

Hypothesis

Collect Evidence Decision Rule

Significance Level

Page 7: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Types of Errors

You used a decision rule to make a decision, but was the decision correct?

ACTUAL

DECISION Fair Coin Not Fair Coin

Fair Coin correct Type II error

Not Fair Coin Type I error correct

Page 8: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population
Page 9: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Modified Coin Experiment

Which coins are fair?

6 3 H e a d s3 7 Ta i ls

4 0 H e a d s6 0 Ta i ls

5 5 H e a d s4 5 Ta i ls

1 5 H e a d s8 5 Ta i ls

p -v a lu e = .2 7

p -v a lu e < .0 1 p - v a lu e < .0 1

p - v a lu e = .0 4

Page 10: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Cases in Hypothesis Testing

Means - variance known - variance unknown

Comparison of means - unpaired, variance known - comparison of variances - unpaired, variances unknown but equal - unpaired, variances unknown and unequal - paired

Proportion

Comparison of Proportion

Page 11: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

One sample t-test

Page 12: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Statistical Hypothesis Test

H : e q u a l i tyH : d i f fe r e n c e

o

1

Decision Rule

Significance Level

Collect Data

p -v a lu e

p - v a lu e

Set Hypothesis

s e t

R is en

S h in e1 5 o z .

Page 13: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Two-Sided Test of Hypothesis

The test of hypothesis is two-sided if the null

is rejected when the actual value of interest is either less than or greater than the hypothesized value.

H0: 15.00

HA: 15.00

Page 14: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Two-Sided Test of Hypothesis

Page 15: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

One-Sided Test of Hypothesis

In many situations, you are only interested in one direction. Perhaps you only want evidence that the mean is significantly lower than fifteen.

For example, instead of testing

H0: = 15 versus H1: 15

you test

H0: 15 versus H1: < 15

Page 16: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

One-Sided Test of Hypothesis

Page 17: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

The Critical Values of Z to memorize

• Two tailed hypothesis– Reject the null (H0) if z z/2, or z - z/2

• One tailed hypothesis– If HA is > Xbar, then reject H0 if z z

– If HA is < Xbar, then reject H0 if z - z

Page 18: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

The Z-test – an example• Suppose that you took a sample of 25 people off

the street in Morgantown and found that their personal income is $24,379

• And you have information that the national average for personal income per capita is $31,632 in 2003.

• Is the Morgantown significantly different from the National Average

• Sources: – (1) Economagic– (2) US Bureau of Economic Analysis

Page 19: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

What to conclude?

• Should you conclude that West Virginia is lower than the national average? – Is it significantly lower?– Could it simple be a randomly “bad” sample”

• Assume that it is not a poor sampling technique

• How do you decide?

Page 20: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Example (cont.)• We will hypothesize that WV income is lower than the national

average.– H0: WVInc = USInc (Null Hypothesis)– HA: WVInc < USInc (Alternate Hypothesis)

• Statistician can write by :– H0: $31,632– HA: < $31,632

• Since we know the national average ($31,632) and standard deviation (15000), we can use the z-test to make decide if WV is indeed significantly lower than the nation

Page 21: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Example (cont.)

• Using the z-test, we get

• For = 5% -z = -z0.05 = -1.645

• THE DECISION IS REJECT H0 SO West Virginia is lower than the national average

42.2

25

150003163224379

n

Xz

Page 22: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

The t test• When we cannot use the population standard deviation, we must

employ a different statistical test

• Think of it this way:

– The sample standard deviation is biased a little low, but we know that as the sample size gets larger, it becomes closer to the true value.

– As a result, we need a sampling distribution that makes small sample estimates conservative, but gets closer to the normal distribution as the sample size gets larger, and the sample standard deviation more closely resembles the population standard deviation.

Page 23: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

The t-test (cont.)

• The t-test is a very similar formula.

• Note the two differences– using s instead of – The resultant is a value that has a t-

distribution instead of a standard normal one.

n

sX

t

Page 24: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

The Critical Values of t

• Two tailed hypothesis– Reject the null (H0) if t t/2(n-1), or t - t/2(n-1)

Reject H0 if |t| ≥ t/2(n-1)

• One tailed hypothesis– If HA is > Xbar, then reject H0 if t t(n-1)

– If HA is < Xbar, then reject H0 if t - t(n-1)

Reject H0 if |t| ≥ t(n-1)

Page 25: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

T-test example• Suppose we decided to look at Oregon, but do not know the

population standard deviation– And we have a small sample anyway (N=25).

• without an a priori reason to hypothesize higher or lower, use the 2-tailed test

• Assume Oregon has a mean of 29,340, and that we collected a sample of 169.

• Using the t-test, we get

• Critical value = t.025(168) = 1.96 Since |-1.9684| > 1.96• REJECT H0

9864.1

169

150003163229340

1

n

sX

tn

Page 26: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Two sample t-test

Two-Sample t-Tests

Page 27: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Cereal Example

R is en

S h in e

Page 28: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Other Examples

• Is the income of blacks lower than whites?

• Are teachers salaries in West Virginia and Mississippi alike?

• Is there any difference between the background well and the monitoring well of a landfill?

Page 29: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

The Difference of means Test

• Frequently we wish to ask questions that compare two groups.– Is the mean of A larger (smaller) than B?– Are As different (or treated differently) than

Bs?– Are A and B from the same population?

• To answer these common types of questions we use the standard two-sample t-test

Page 30: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Assumptions

• independent observations• normally distributed data for each group• equal variances for each group.

C o m pa r in g Tw o P o p u la t io n s

M o r n in g R is e n S h in e

1

2

Page 31: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

The Difference of means Test

• The standard two-sample t-test is:

2

22

1

21

21

ns

ns

XXt

Page 32: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

The equal Variance test

21

2

21

11nn

s

XXt

t

• If the variances from the two samples are the same we may use a more powerful variation

• Where 2

11

21

222

2112

nn

snsnst

Page 33: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

• If the variances from the two samples are the same we may use a more powerful variation

• With degree of freedom:

The unequal Variance test

2

2

22

2

1

21

2

2

22

1

21

11

ns

ns

ns

ns

dbeff

2

22

1

21

21

ns

ns

XXt

Page 34: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Which test to Use?

• In order to choose the appropriate two-sample t-test, we must decide if we think the variances are the same.

• Hence we perform a preliminary statistical test – the equal variance F-test.

Page 35: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

The Equal Variance F-test

• One of the fortunate properties on statistics is that the ratio of two variances will have an F distribution.

• Thus with this knowledge, we can perform a simple test.

smaller

erl

nn s

sF

2

arg2

)1,1( 21

Page 36: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

F Test for Equality of Variances

F =

H : 2

1

2

21H : = 2

1

2

20

1

2

m in (s , s ) 1

2

2

22m a x (s , s )2

=

Page 37: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Interpretation of F-test• If we find that F > F (n1-1,n2-1) , (P(F) > .05), we

conclude that the variances are unequal.

• If we find that F ≤ F (n1-1,n2-1) , (P(F) ≤ .05), we conclude that the variances are unequal.

• We then select the equal– or unequal-variance t-test accordingly.

Page 38: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Test Statistics and p-Values

F Test for equal variances: H0: 12 = 2

2

Variance Test:

F’ = 1.51 DF = (3,3)

t-Tests for equal means: H0: 1 = 2

Unequal Variance t-test:

T = 7.4017 DF = 5.8

Equal Variance t-test:

T = 7.4017 DF = 6.0

What would we conclude?

Page 39: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population
Page 40: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population
Page 41: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

PAIRED T-test

Page 42: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Paired Samples

S a le sS a le s

B E F O R E A F T E RA D V E R T IS IN G

Page 43: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population
Page 44: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population
Page 45: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population
Page 46: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Proportion

Page 47: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Large Sample

• H0 : p = p0

HA : p ≠ p0 or HA: p < p0 or HA: p > p0

• Test statistic :

npp

ppz

)1(

ˆ

00

0

Page 48: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Example

• Do you think it shoul or should not be government implementation the law of pornography and pornoaction?

• Let p denote the population proportion of Indonesia adults who believe it should be

• p < .5 minority• p > .5 majority

Page 49: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Continued example

• This data is not real, just for ilustration• Suppose from 1534 adults, 812 believe it should be• H0 : p = .5

HA : p ≠ .5

The critical value for = 5% z.025 = 1.96

The conclusion - Reject H0 majority adults agree if government implementation the law of pornography and pornoaction

297.2

1534)5.1(5.

5.529.

z

Page 50: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Comparison two proportion

Page 51: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Large sample

• H0 : p1 = p2

HA : p1 ≠ p2

• Test statistic :

= x1/n1, = x2/n2, = (x1 + x2)/(n1 + n2)

21

21

11)ˆ1(ˆ

)ˆˆ(

nnpp

ppz

p̂1p̂ 2p̂

Page 52: Hypothesis Testing Judicial Analogy Hypothesis Testing Hypothesis testing  Null hypothesis Purpose  Test the viability Null hypothesis  Population

Reference• Agresti, A. & Finlay, B. 1997. Statistical Methods for the Social

Sciences 3rd Edition. Prentice Hall.• Mac Gregor. 2006. Lecture 3: Review of Basic Statistics.

McMaster University• PS 601 Notes – Part II

Statistical Tests • SAS Inc• Tang, A. 2004. Lecture 9 Common Statistical Test. Tufts

University