Finansiell Statistik, GN, 15 hp, VT2008 Lecture 10-11: Statistical Inference: Hypothesis Testing

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "Finansiell Statistik, GN, 15 hp, VT2008 Lecture 10-11: Statistical Inference: Hypothesis Testing"

Transcription

1 Finansiell Statistik, GN, 15 hp, VT008 Lecture 10-11: Statistical Inference: Hypothesis Testing Gebrenegus Ghilagaber, PhD, Associate Professor April 1, 008 1

2 1 Statistical Inferences: Introduction Recall: Statistics may be grossly devided into: Descriptive Statistics Data Collection Data Presentation Data Analysis and

3 Inferential Statistics - deals with ways/methods of drawing sound generalizations about a populations based on information contained in a sample. This may be done in two ways: 1. Estimation (complete ignorance) Point Estimation Interval Estimation (Con dence Interval). Hypothesis Testing (partial ignorance)

4 Basic Concepts in Hypothsis Testing A statistical hypothesis is a temporary statement (an assertion) about a population probability distribution or its parameter The aim in hypothesis-testing is to test the extent of truth of this temporary statement using information contained in a sample The primary hypothesis to be tested is called Null-hypotheis and is denoted by H 0. The hypothesis to be kept (maintained) if the Null-hypothesis is to be rejected (Nulli ed) is called the Alternative-hypothesis and is denoted by H 1 or H A. 4

5 The signi cance level of a test, denoted by, is a measure of the probability of rejecting a true hypothesis (see details below). It is also called size of the test or level of the test. A test statistic is a function of the sample upon which the statistical decision will be based. 5

6 .1 One Tailed and Two Tailed Alternatives Two-tailed (two-sided) test: H 0 : = 0 H 1 : 6= 0 One-tailed (one-sided) test: H 0 : = 0 H A : > 0 or H 0 : = 0 H A : < 0 6

7 . Type I Error and the Probability of Type I Error In any hypothesis testing procedure, one of the following can happen: Decision Null hypotheis (H 0 ) is Reject H 0 Do not reject H 0 True Type I error Correct decision False Correct decision Type II error Thus, We commit Type I error when we reject a true hypothesis. The probability of such error is denoted by and is known as the signifcance level (size of a test, or level of a test) 7

8 The probability of Not commiting Type I error - the probability of "accepting" a true hypotheis - is given by 1 and is known as the con dence level. P (Re ject H 0 jh 0 is true) = P(Type I error) = (signi cance level) P (Do not Re ject H 0 jh 0 is true) = 1 (con dence level) 8

9 . Type II Error and the Probability of Type II Error We commit Type II error when we fail to reject a False hypothesis. The probability of such error is denoted by. P (Do not Re ject H 0 jh 0 is False) = P (Re ject H 0 jh 0 is False) = 1 (power of a test) 9

10 .4 Power of a test The probability of Not commiting type II error - rejecting a false hypotheis - is given by 1 and is known as the Power of the Test. In other words, the Power of the Test is its capacity to detect a False hypothesis. Power of a test = P (Re jct H 0 jh 0 is False) = 1 10

11 .5 Some Remarks A statistical hypothesis can never be accepted (unless n = N) - the poorman example and are inversely related - show graphically Thus, we cannot minimize them simultaneously as one of them will increase when we decrease the other. Thus, we often x the type I error and then look for the most powerful tests (tests with smallest possible values of ) for a given value of : Which error is more "serious"? 11

12 .6 Large sample Tests on the mean (one-tailed and twotailed) Case 1: Two-tailed test: H 0 : = 0 H A : 6= 0 Test statistic when sample size (n) is large (when we can make use of CLT) is given by 1

13 Z = X 0 = p n = X 0 s= p n and we reject H 0 if Z > Z or Z Z 1

14 Case : One-tailed test (to the right): H 0 : = 0 H A : > 0 Test statistic when sample size (n) is large (when we can make use of CLT) is given by Z = X 0 = p n = X 0 s= p n and we reject H 0 if Z > Z 14

15 Case : One-tailed test (to the left): H 0 : = 0 H A : < 0 Test statistic when sample size (n) is large (when we can make use of CLT) is given by Z = X 0 = p n = X 0 s= p n and we reject H 0 if Z Z 15

16 .7 Small sample Tests on the mean with unknown standard devation (one-tailed and two-tailed) Case 1: Two-tailed test: H 0 : = 0 H A : 6= 0 Test statistic when sample size (n) is small (when we can t make use of CLT) is given by t = X 0 s= p n 16

17 and we reject H 0 if t > t n 1; or t t n 1; 17

18 Case : One-tailed test (to the right): H 0 : = 0 H A : > 0 Test statistic when sample size (n) is small (when we can t make use of CLT) is given by t = X 0 s= p n and we reject H 0 if t > t (n 1;) 18

19 Case : One-tailed test (to the left): H 0 : = 0 H A : < 0 Test statistic when sample size (n) is small (when we can t make use of CLT) is given by and we reject H 0 if t t (n 1;) t = X 0 s= p n 19

20 .8 Tests of di erences between two means (one-tailed and two-tailed).8.1 Large sample cases The above procedures may be extended to the case of comparing means from two populations. Thus, we have Case 1: Two-tailed test: H 0 : 1 = =) 1 = 0 H A : 1 6= =) 1 6= 0 0

21 Test statistic when sample sizes (n 1 and n ) are large (when we can make use of CLT) is given by where z = = X1 X1 X ( 1 ) 0 SE(X 1 X ) X SE(X 1 X ) q SE(X 1 X ) = V ar(x 1 ) + V ar(x ) s V ar(x1 ) = + V ar(x ) n 1 n if the two samples are independent, or (in the case of paired samples), 1

22 where SE(X 1 X ) = v u t Sp 1 n n! is the pooled variance. S p = (n 1 1) S 1 + (n 1) S n 1 + n In any case, we reject H 0 if Z > Z or Z Z :

23 Case : One-tailed test (to the right): H 0 : 1 = =) 1 = 0 H A : 1 > =) 1 > 0 Test statistic when sample sizes (n 1 and n ) are large (when we can make use of CLT) is given by Z = X1 X SE(X 1 X ) and we reject H 0 if Z > Z

24 Case : One-tailed test (to the left): H 0 : 1 = =) 1 = 0 H A : 1 < =) 1 < 0 Test statistic when sample sizes (n 1 and n ) are large (when we can make use of CLT) is given by Z = and we reject H 0 if Z Z. X1 X SE(X 1 X ) 4

25 .8. Small sample cases The appropriate test statistic when sample sizes (n 1 or n or both) are small (when we can t make use of CLT) is given by t = X1 X SE(X 1 X ) and it is compared with t (n1+n tests for a single mean. ) in the same way as we did for the case in 5

26 .9 Determining the sample size based on Z, Z, 0, and A. Recall, = P (Reject H 0 jh 0 is true) = P (X > kj = 0 ) so that = P X 0 s= p n > k 0 s= p n j = 0 = P (Z > Z )! 6

27 Z = k 0 s= p n s =) k = 0 + Z p n (1) 7

28 Similarly, = P ("Accept H 0 jh 0 is False) = P (X < kj = A ) = P X A s= p n < k A s= p n j = A = P Z < Z! so that Z = k A s= p n s =) k = A Z p n () 8

29 Equating (1) and (), we get, so that 0 + Z s p n = A Z s p n n = S Z + Z ( A 0 ) In other words, the minimum sample size required to test a hypothesis on the population mean is a function of four factors: 1. The variance, S (the larger the variance the larger the value of n). The di erence between the values of under the null and alternative hypotheses, A 0 ; (the larger the di erence the smaller the value of n) 9

30 . The size of type I error, (the smaller the value of the larger the value of n) 4. The size of type II error, (the smaller the value of the larger the value of n) 0

31 .10 Tests on Proportions (one-tailed and two-tailed) The procedures used for tests on population means and di erences between two population means may also be applied to make tests on proportions or di erences between proportions of two populations: H 0 : P = P 0 H A : P 6= P 0 The test statistic is given by z = bp P b 0 SE( P b ) = P P 0 r P 0 (1 P 0 ) n 1

32 or t = bp P b 0 SE( P b ) = P P 0 r P 0 (1 P 0 ) n depending on whether our sample size is large or small.

33 Similar procedure applies in testing H 0 : P 1 = P H A : P 1 6= P The test statistic is given by z = bp 1 b P SE( b P 1 b P ) = b P 1 r bp1 (1 b P1 ) bp n 1 + b P (1 b P ) n

34 in the case of independent samples, or z = bp b 1 P b SE( P b b 1 P ) = P 1 bp r bp (1 P b ) 1 n1 + n 1 in the case of paired samples, where bp = X 1 + X n 1 + n is the proportion of "successes" in the mixed sample. 4

35 .11 Chi-square tests on the variance of normal population Suppose, x 1 ; x ; :::; x n is a random sample from a normal population with unknown variance ; and we want to test H 0 : = 0 We recall that, H A : > 0 (n 1)S s (n 1) Thus, an appropriate test statistic to test the above hypothesis would be: = (n 1)S 0 5

36 and reject H 0 if > (n 1;) 6

37 .1 Tests on the equality of variances of two normal populations Suppose, x 1 ; x ; :::; x n is a random sample from a normal population with unknown variance 1 ; and y 1; y ; :::; y n is a random sample from a normal population with unknown variance : Our goal is to test the hypothesis We recall that, H 0 : 1 = H A : 1 > (n 1 1)S 1 1 s (n 1 1) 7

38 and that (n1 1)S1 1 (n 1)S (n 1)S = (n 1 1) = (n 1) s (n 1) s F (n1 1; n 1) Thus, an appropriate test statistic to test the above hypothesis would be: F = (n1 1)S1 1 (n 1)S and reject H 0 if F > F (n1 1; n 1;) = (n 1 1) = (n 1) = S 1 S Remark: Formulate the hypothesis in such a way that the larger variance appears as a numerator - in order to get a value of F that is at least 1 (and not 8

39 a fraction) ready to be compared with table values. 9

40 Relatioship between con dence interval and hypothesis testing Recall that a two-sided 100(1 mean is given by the interval )% con dence interval for the population! s s X Z p ; X + Z p n n () Similarly, a two-tailed test on is formulated as H 0 : = 0 H 1 : 6= 0 40

41 and we reject H 0 if Z > Z or Z < Z ; where Z = X 0 s= p n : 41

42 In other words, we don t reject H 0 if Z < Z < Z =) Z < X 0 s= p n < Z =) Z s p n < X 0 < Z s p n =) X Z s p n < 0 < X + Z s p n =) X + Z s p n > 0 > X Z s p n =) X Z s p n < 0 < X + Z s p n 4

43 To sum up, in testing H 0 : = 0 H 1 : 6= 0 the null hypothesis will not be rejected if 0 lies within the interval! s s X Z p ; X + Z p n n which is just the Recall that a two-sided 100(1 )% con dence interval for the population mean is given by the interval given in (). Similar argument applies for other parameters such as di erence between means, 1 or population variances P: 4

44 4 Computing and plotting the power of a test Consider testing the hypothesis: H 0 : = 0 H 1 : 6= 0 at = 5%: Then, the Null hypothesis will be rejected if the calculated test statistic, Z cal is greater than 1:96 or less than 1:96; that is if Z cal = X 0 s= p n > 1:96 or Z cal = X 0 s= p n < 1:96 which, in turn, means we reject H 0 if! s X > 0 + 1:96 p or X < 0 n 1:96! s p n 44

45 In other words, we don t reject H 0 if 0 1:96 s p n! < X < 0 + 1:96! s p n Thus, the probability of type II error, ; may be computed as = P (we don0t reject H 0 jh 0 is false) ; and the corresponding power, ; may be obtained as = 1 : Suppose now that 0 = 15 and that a sample of 6 observations gave X = 17 and S = 9: Then, H 0 is false means that 6= 15 which, in turn, means that the true value of can be any value except

46 Consider one possible value, say 16. Then, = P (we don0t reject H 0 jh 0 is false) "! s = P 1:96 p < X < 0 + 1:96 n 0! # s p = 16 n = P 15 1:96 < X < :96 = = P h 14:0 < X < 15:98 = 16 i 14:0 16 = P 4 < X < 15:98 16 = P [ :96 < Z < 0:04] = ( 0:04) ( :96) = 0: :00004 = 0:4840 so the power at = 16 is given by (16) = P (Reject H 0 : = 15j = 16) = 1 = 1 0:48401 = 0:

47 Similarly, at = 17; we have = P h 14:0 < X < 15:98 = 17 i = P 4 14: < X 17 6 < 15:98 17 = P [ 5:96 < Z < :04] = ( :04) ( 5:96) = 0:0068 0:0000 = 0:0068 and the corresponding power is given by (17) = P (Reject H 0 : = 15j = 17) = 1 = 1 0:0068 = 0:

48 At = 15:5; we have so that = P h 14:0 < X < 15:98 = 15:5 i = P 4 14:0 15:5 6 < X 15:5 6 < 15:98 15:5 = P [ :96 < Z < 0:96] = (0:96) ( :96) = 0:8147 0:00158 = 0:899 (15:5) = P (Reject H 0 : = 15j = 15:5) = 1 = 1 0:899 = 0:

49 while at = 15 (when H 0 is true) we have = P h 14:0 < X < 15:98 = 15 i so that = P 4 14: < X 15 6 < 15:98 15 = P [ 1:96 < Z < 1:96] = (1:96) ( 1:96) = 0:9750 0:04998 = 0:95 (15) = P (Reject H 0 : = 15j = 15) = 1 = 1 0:95 = 0:05 Note: This is the value of which is the probability of type I error (probability of rejecting H 0 is true) and that was chosen to be 0:05 at the begining

50 We also get similar values on the left of = 15. For instance, at = 14:5; we have = P h 14:0 < X < 15:98 = 14:5 i so that = P 4 14:0 14:5 6 < X 14:5 6 < 15:98 14:5 = P [ 0:96 < Z < :96] = (:96) ( 0:96) = 0:899 (14:5) = P (Reject H 0 : = 15j = 14:5) = 1 = 1 0:899 = 0:17007 = (15:5)

51 while at at = 1; we have so that = P h 14:0 < X < 15:98 = 1 i = P 4 14:0 1 6 < X 14:5 6 < 15:98 1 = P [:04 < Z < 5:96] = (5:96) (:04) = 0:0068 (1) = P (Reject H 0 : = 15j = 1) = 1 = 1 0:0068 = 0:979 = (17)

52 If we plot these values of power, we get the power curve below: 1 Plot of the power function 0.9 Probability of rejecting the Null hypothesis Values under the alternative hypothesis (H1) 5