22
Hypotheses Testing

Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Hypotheses Testing

Page 2: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Example 1

We have tossed a coin 50 times and we got

k = 19 heads

Should we accept/reject the hypothesis that

p = 0.5

(the coin is fair)

Page 3: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Null versus Alternative

Null hypothesis (H0): p = 0.5

Alternative hypothesis (H1): p 0.5

Page 4: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

0 5 10 15 20 25 30 35 40 45 500

0.02

0.04

0.06

0.08

0.1

0.12

k

p(k)

95%

EXPERIMENT

Page 5: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Experiment

P[ k < 18 or k > 32 ] < 0.05

If k < 18 or k > 32 then an event

happened with probability < 0.5

Improbable enough to REJECT the hypothesis H0

Page 6: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Test construction

18 32

acceptreject reject

Page 7: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

0 5 10 15 20 25 30 35 40 45 500

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0.025

0.975

k

Cpdf(k)

Page 8: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Conclusion

No premise to reject the hypothesis

Page 9: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Example 2

We have tossed a coin 50 times and we got

k = 10 heads

Should we accept/reject the hypothesis that

p = 0.5

(the coin is fair)

Page 10: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

0 5 10 15 20 25 30 35 40 45 500

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

k

cpdf(k)

Page 11: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Significance level

P[ k 10 or k 40 ] 0.000025

We REJECT the hypothesis H0

at significance level p= 0.000025

Page 12: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Remark

In STATISTICS

To prove something = REJECT the hypothesis that converse is true

Page 13: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Example 3

We know that on average mouse tail is 5 cm long.

We have a group of 10 mice, and give to each of them a dose of vitamin X everyday, from the birth, for the period of 6 months.

Page 14: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

We want to prove that vitamin X makes mouse tail longer

We measure tail lengths of our group and we get sample = 5.5, 5.6, 4.3, 5.1, 5.2, 6.1, 5.0, 5.2, 5.8, 4.1

Hypothesis H0 - sample = sample from normal distribution with = 5cm

Alternative H1 - sample = sample from normal distribution with > 5cm

Page 15: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Construction of the test

tt0.95

reject

Cannot reject

Page 16: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

We do not population variance, and/or we suspect that vitamin treatment may

change the variance – so we use t distribution

N

iiXN

X1

1

N

ii XX

NS

1

21

1

NS

Xt

Page 17: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

2 test (K. Pearson, 1900)

To test the hypothesis that a given data actually come from a population with the proposed distribution

Page 18: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Data 0.4319 0.6874 0.5301 0.8774 0.6698 1.1900 0.4360 0.2192 0.5082 0.3564 1.2521 0.7744 0.1954 0.3075 0.6193 0.4527 0.1843 2.2617 0.4048 2.3923 0.7029 0.9500 0.1074 3.3593 0.2112 0.0237 0.0080 0.1897 0.6592 0.5572 1.2336 0.3527 0.9115 0.0326 0.2555 0.7095 0.2360 1.0536 0.6569 0.0552 0.3046 1.2388 0.1402 0.3712 1.6093 1.2595 0.3991 0.3698 0.7944 0.4425 0.6363 2.5008 2.8841 0.9300 3.4827 0.7658 0.3049 1.9015 2.6742 0.3923 0.3974 3.3202 3.2906 1.3283 0.4263 2.2836 0.8007 0.3678 0.2654 0.2938 1.9808 0.6311 0.6535 0.8325 1.4987 0.3137 0.2862 0.2545 0.5899 0.4713 1.6893 0.6375 0.2674 0.0907 1.0383 1.0939 0.1155 1.1676 0.1737 0.0769 1.1692 1.1440 2.4005 2.0369 0.3560 1.3249 0.1358 1.3994 1.4138 0.0046

Are these data sampled from population with exponential pdf ?

xexf )(

Page 19: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Construction of the 2 test

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 50

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

p1p2 p3 p4

Page 20: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Construction of the test

2

2 0.95

reject

Cannot reject

Page 21: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

How about

Are these data sampled from population with exponential pdf ?

axaexf )(

1. Estimate a2. Use 2 test3. Remember d.f. = K-2

Page 22: Hypotheses Testing. Example 1 We have tossed a coin 50 times and we got k = 19 heads Should we accept/reject the hypothesis that p = 0.5 (the coin is

Power and significance of the test

Actual situation

decision probability

H0 true

H0 false

accept

Reject = error t. I

reject

Accept = error t. II

1-a

a = significance level

b

1-b = power of the test