Anda di halaman 1dari 24

Ch7 Hypothesis testing

• It is like placing a bet on unknowns

• Unknowns => population’s statistics

• Who is the judge?

• Samples are the judge


Null hypothesis H0 and alternative hypothesis H1

• For example, a null hypothesis: the population mean of


cockroaches in HKUST is 12 mm
H0: μ = 12

• Three alternative hypotheses are:


H0: μ ≠12 (two-tail test)
H0: μ >12 (right-tail test)
H0: μ <12 (left-tail test)
Rejection region
• Take two-tail test for example:
H0: μ = 12 and H1: μ ≠ 12

0.4
Z ~ N(0, 1)
PDF

Pr (Rejection region)
= level of significance = α
0.3

0.2

0.1
Rejection Acceptance Rejection
region region region

0.0

α = 10%, -1.64 1.64


Decision rule

• When Z in the rejection region, reject H 0, accept H1

0.4
Z ~ N(0, 1)
PDF

0.3

0.2

Rejection Acceptance Rejection


0.1 region region region

0.0
Type I and Type II errors in hypothesis testing
• What kinds of error could happen in a court room?
1. Sending an innocent person to jail
2. Not sending bad guys to jail

• Hypothesis testing is associated with a given error (similar to interval estimation associated with a
confidence interval)
• Type I error: reject H0 given H0 is true
• Type II error: accept H0 given H0 is false
Ex7.1
Jerry claims the population mean is 168 cm for HKUST
students. Should this hypothesis be accepted given α
= 5% with sample mean = 168.2 and sample SD = 5
from 10 samples

i) H0: μ = 168
t-dist with DOF = 9
ii) H1: μ ≠168 (two-tail)
0.4

PDF
iii) Statistics: 0.3

0.2

= 0.12
X  0.1

t
S / nrejection region
iv) Determine 0.0

v) H0 not rejected, so Jerry is right -2.26 2.26


Ex7.2
The population SD of students’ height is 3 cm in
HKUST. Should this hypothesis be accepted given
α = 5% and with 3 random samples:
165, 170, 180
i) H0: σ = 3
2
 with DOF = 92
ii) H1: σ ≠ 3 (two-tail)
0.4

PDF
iii)Statistics:
0.3

0.2

( n  1 ) S 2
2   12 0.1

 2

iv)Rejection region 0.0

v) Reject H0 0.05 7.38


Notes on level of significance α

0.4
Pr (Rejection region)

PDF
= level of significance = α
0.3

0.2

• The larger the α, the larger the rejection zone, the more easily H 0 got rejected
• Given H0 not rejected with
0.1
both 1%-α and 10%-α tests, the latter one is more critical for H0 not
being rejected; so it should be the reason why α is referred to as “level of significance.”

0.0
• With level of significance = 5%, it means there
is 5% chance that H0 will be rejected

• Then when H0 is true, there is 95% chance


that H0 is not rejected, which is good

• But in other words, there is 5% the true H 0 will


be rejected, which is an error

• As a result, Type I error = level of significance


Decision rule of hypothesis testing:

• When the value calculated with H0 is in the rejection region


in a small probability, H0 is rejected

• If Jerry is winning the lottery, it is most likely that he should be


happy (big probability event); therefore if you see jerry not
happy (small probability event), you consider he did not win

• Therefore, when H0 is good, the value should be in the


acceptance region with large probability;
• If the value calculated with H0 is still in the rejection region
with a small probability, H0 is not good and should be rejected
Ex7.3
The steel company claims that its steel can sustain more
than 2650 pounds. Randomly select 6 samples and
their strengths are:
2680, 2780, 2450, 2620, 2480, 2500
Should we trust the statement of the company given level
of sig. = 5%?

=> H0: μ = 2650 0.4


t-dist with DOF = 5
PDF
H1: μ ≠ 2650 0.3

H1: μ > 2650 0.2

H1: μ < 2650


0.1

5%
=> Small size => t 0.0

2.01
Ex7.3
The steel company claims that its steel can sustain more than 2650 pounds. Randomly select 6 samples and their
strengths are: 2680, 2780, 2450, 2620, 2480, 2500
Should we trust the statement of the company given level of sig. = 5%?

=> Sample SD = 130.2


sample mean = 2585
0.4
t-dist with DOF = 5
X 

PDF
Since t 
S/ n 0.3

2585  2650 0.2

t  1.22
130.2 / 6
0.1

=> Accept H0
0.0

2.01
=> Reject the company’s statement
• In Ex7.3, why not set
H0: μ > 2650
H1: μ < 2650
In this case, when H0 is accepted, the company’s
statement is trustworthy?

=> the statistics calculated becomes a range; in this


example:
X 
t
S/ n and μ > 2650, so that => t < -1.22
• Let’s see what happen in Ex7.3:
H0: μ > 2650
H1: μ < 2650 => left tail test
In this case, when H0 is accepted, the company is
right?

0.4
t-dist with DOF = 5
PDF

t < -1.22 is inside and outside


0.3 the rejection region

0.2 This is a shortcoming of this


kind of H0 in some cases
0.1

0.0

-2.01
How to set a solid H0 and H1

• Always set H0 as “=” to avoid the situation that the


calculated statistics are in a range

• From three options, select the one that is most “fair”


to the statement you want to test

• For example, the statement claims A is less than10,


use the left-tail test => H1: A < 10 with H0: A = 10
Ex7.4
The car company claims “MPG” > 12 km/liter. The
government selected 49 cars of the company and
found sample mean and SD = 13.5 and 4. Is the
company is right given level of sig. = 5%

=> H0: μ = 12 Z(0, 1)


0.4

PDF
H1: μ ≠ 12
H1: μ > 12 0.3

H1: μ < 12 0.2

=> Large size => Z 0.1

X  5%
Z  2.6
S/ n 0.0

1.64

=> Reject H0; the company is right, given 5% level of sig.


Ex7.5
Below is the final scores of six male and females
students in CIVL2160. Is there any difference in the
performance between boys and girls? Given level of
sig. = 5%

=> Let d = boy’s score – girl’s score


Ex7.5
Below is the final scores of six male and females students in CIVL2160. Is any difference in the performance between
boys and girls? Given level of sig. = 5%

=> H0: μd = 0 0.4


t-dist with DOF = 5

PDF
H1: μd ≠ 0 0.3

H1: μd > 0
0.2

H1: μd < 0
0.1

=> Small size => t 0.0

X  d -2.57 2.57
t  0.4
Sd / n
=> accept H0 => no difference in
Ex7.6
Selecting 21 samples for each production line:

Is Line 2 more stable than Line 1? Given level of sig.=1%


=> H0: Var1 = Var2
H1: Var1 ≠ Var2
H1: Var1 > Var2
H1: Var1 < Var2
S12 / S 22 S12 / S 22 1.02
F 2 2 F   1.5
=> 1 /  2 1 0.69
Ex7.6
Selecting 21 samples for each production line:
Is Line 2 more stable than Line 1? Given level of sig.=1%

S12 / S 22 S12 / S 22 1.02


F 2 2 F   1.5
1 /  2 1 0.69

0.4
f-dist with DOF1 = 20 and DOF2 = 20
PDF

0.3 => Accept H0


=> Line 2 is not more
0.2 stable than Line 1

0.1

1%
0.0

2.94
P-value
• When level of significance is not given, we calculate
p-value for decision making

• take Ex7.4 for example, Z-value is equal to 2.6, so


that p-value = Pr(Z > 2.6) = 0.004

Z(0, 1)
=> when p-value is small
0.4
PDF

0.3
(< 0.05), reject H0
0.2

0.1
0.4% = p-value = Pr(A > calculation)

0.0

2.6
• P-value
right-tail test left-tail test

0.4
PDF

0.4

PDF
0.3
P-value 0.3

P-value
= Pr (A > a*)
0.2
0.2 = Pr (A < a*)
0.1
0.1

0.0
0.0

• P-value is small (say < 5%), reject H0


Summary of hypothesis testing

•Betting on population’s mean, SD, etc. based on


samples

•There is little chance that the results are wrong:


Type I and Type II errors

•When P-value is small, say < 0.05, H0 is rejected


JP’s assignment 3 due on next Friday,
24 Nov, 2017

Anda mungkin juga menyukai