Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Institute of Technology of Cambodia 2013-2014 Chapter II : HYPOTHESIS TESTING 1. General 1.1. Introduction Statistics develop techniques and methods for analyzing data from observation, to identify the characteristics of the population and identify a model capable of generating these data. In this context, it is necessary to make assumptions, that is to say to make assertions about these features or this model. Definition : - A hypothesis is called parametric if it relates to the parameters of the distribution. It is called non-parametric in other cases. - A parametric assumption is called simple if it is associated with a unique value. It is said in other cases multiple. Statistics for Engineering Page 1 Institute of Technology of Cambodia 2013-2014 Most often, the situation is summed up in two alternative hypothesis made H0 and H1 , mutually exclusive and are respectively called the null hypothesis, or fundamental, and the alternative hypothesis, or otherwise. In general, the hypothesis H0 and H1 do not play symmetric roles, and is chosen for the null hypothesis H0 Assuming that we believe or we take, or one that allows you to make calculations or one whose rejection has serious consequences. 1.2. Test Hypothesis to confront, H0 and H1 , are identified, their validity is put to the test using a hypothesis test. Definition : Hypothesis testing is a decision rule that allows, on the basis of observed data and the risks of error determined to accept or reject a statistical hypothesis. The decision rule is a test based on the observation of a sample and not on the basis of full information, Statistics for Engineering Page 2 Institute of Technology of Cambodia 2013-2014 one is never sure of the accuracy of the conclusion: there is always a risk error. Definition : The first kind of error is to reject H0 wrongly: the risk of type I error is denoted , is the risk of error is taken into rejecting H0 while it is true. It is also called the significance level of the test or, more simply, the level of test. P type I error Definition : The second kind of error is to reject H1 wrongly : the risk of type II error is noted , is the risk of error is taken into rejecting H1 while it is true. P type II error 1– is called the power of the test. It tries to build tests that reduce risks to acceptable levels. In general, we impose a threshold not to exceed (eg 1%, 5%, 10% by default), and given this constraint, we seek to build the tests with the highest possible power. Statistics for Engineering Page 3 Institute of Technology of Cambodia 2013-2014 Two types of decision error in a hypothesis test Reject H0 Accept H0 H0 true Type I error good decision H1 true good decision Type II error 1.3. Test Statistics Definition: A test based on a sample size n is determined by region R of n called critical region, or region of rejection of the hypothesis H0 . The complementary A of R is called the acceptance region of H0 . The decision rule is to test the following : if X X 1 ,..., X n is the vector of observed values, it was decided to refuse H0 (and accept H1 ) if X R , and decides to accept H0 if X R . In practice, we try to define a random variable D , called decision variable or test statistics, and the distribution is known, at least under hypothesis H0 . Statistics for Engineering Page 4 Institute of Technology of Cambodia 2013-2014 The critical region will be the region where the probability values of the test statistics tends to increase when H0 is not true. This region is defined using the risk the first kind of test. 1.4. Critical Probability Definition : Critical probability or critical level or Pvalue of hypothesis H0 , *, is the level of test at which one rejects H0 given the results of observations. The critical level * depends on the results of observations and test that uses. Knowing the critical level *, we can say what decision we will take whatever level chosen, in this case, Reject H0 if and only if * The critical level is widely used in practice, because it gives more information than a simple decision with a pre-set level. For example, if there is the test statistic, a value of the test statistics T , the critical probability * the hypothesis is given by : Statistics for Engineering Page 5 Institute of Technology of Cambodia - * P T | H0 - * P T | H0 2013-2014 (right tail test) ; (left tail test) ; - * P T | H0 (two tailed test). The critical probability provides a measure of credibility to the hypothesis H0 : - a very low value of the critical probability means that H0 is not valid, - too high a value can doubt the randomness of the experience and reliability of the data and calculations. 2. Parametric Tests Let X1 ,..., X n be an iid sample drawn from X , one random variable depending on a parameter , and ˆn T X 1 ,..., X n an estimator (a statistical test) of , and 0 . We consider the following simple hypothesis testing : (a) Statistics for Engineering H0 : 0 H1 : 0 right tail test Page 6 Institute of Technology of Cambodia (b) (c) H0 : 0 H1 : 0 H0 : 0 H1 : 0 2013-2014 left tail test two tail test Example 1 : The manufacturer of a certain brand of cigarettes says that nicotine does not exceed an average 2.5 milligrams. Propose null and alternative hypothesis to be used in testing this claim. Example 2: Suppose that we are interested in the mean compressive strength of a particular type of concrete. Specifically, we are interested in deciding whether or not that the mean compressive strength is 2500 psi. Built the hypothesis for this problem. Summary procedure for testing the hypothesis: 1. Propose the null hypothesis H0 where 0 . 2. Choose a suitable alternative hypothesis of one of 0 , 0 , 0 . 3. Choose the level of test . Statistics for Engineering Page 7 Institute of Technology of Cambodia 2013-2014 4. Select the appropriate statistical test and establish the critical region. (If the decision is based on the critical probability or P-value, it is not necessary to provide the critical region.) 5. Calculate the value of the test statistic of the sample data. 6. Decision: Reject H0 if the test statistic has a value in the critical region (or if the P-value is smaller than or equal to the desired level of the test ); otherwise do not reject H0 . 2.1. Tests comparing a mean value of a reference. Theorem 1 : Let X1 ,..., X n be an iid sample drawn from X , a normal random variable with expectation and variance 2 . We propose to test the hypothesis : H0 : 0 (a) (b) (c) Statistics for Engineering H1 : 0 right-tailed test H1 : 0 left-tailed test H1 : 0 two-tailed test Page 8 Institute of Technology of Cambodia 2013-2014 1. If the variance 2 is known, then X - The test statistics Z n n - Under the Hypothesis X n 0 H0 : Z ~ N 0,1 n (1-1-a). Case (a) – right-tailed test: The acceptance region of the null hypothesis H0 is an interval of the form: , z where z 0 and P Z z (1-1-b). Case (b) – left-tailed test: The acceptance region of the null hypothesis H0 is an interval of the form: z , where z 0 and P Z z (1-1-c). Case (c) – two-tailed test: The acceptance region of the null hypothesis H0 is an interval of the form: z /2 , z /2 where z /2 0 and P Z z /2 Statistics for Engineering Page 9 Institute of Technology of Cambodia 2013-2014 2. If the variance 2 is unknown, then Xn - The test statistics T Sn n - Under the Hypothesis H0 : X 0 T n ~ Student n 1 Sn n (1-2-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form: , t where t 0 and P T t (1-2-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form: t , where t 0 and P T t (1-2-c). Case (c) – two-tailed test: The acceptance region of the null hypothesis H0 is an interval of the form: t /2 , t /2 where t /2 0 and P T t /2 Statistics for Engineering Page 10 Institute of Technology of Cambodia 2013-2014 Example 3: The burning rate of a rocket propellant is being studied. Specifications require that the mean rate must be 40 cm/s. Furthermore, suppose that we know that the standard deviation of the burning rate is approximately 2 cm/s. The experimenter decides to specify a type I error probability 0.05, and he will base the test on a random sample of size n 25 . Is the burning rate equal to 40 cm/s if the sample mean burning rate obtained is 41.25 cm/s. Calculate the P-Value. Example 4: The Edison Electric Institute has published figures on the annual number of kilowatthours spent by various appliances. It is claimed that a vacuum spends an average of 46 kilowatt-hours per year. If a random sample of 12 houses including a planned study indicates that the cleaners spend an average of 42 kilowatt-hours per year with a standard deviation of 11.9 kilowatt-hours at the test level of 5%, this suggests that the vacuum spend an average of less than 46 kilowatt-hours per year? Assume that the population of kilowatt-hours to be normal. Statistics for Engineering Page 11 Institute of Technology of Cambodia 2013-2014 Theorem 2 : Let X1 ,..., X n (with n 30 ) be an iid sample drawn from X , a real random variable with expectation and variance 2 0. We propose to test the hypothesis: H0 : 0 (a) (b) (c) H1 : 0 right-tailed test H1 : 0 left-tailed test H1 : 0 two-tailed test 1.If the variance 2 is known, then Xn - The test statistics Z n - Under the Hypothesis X n 0 H0 : Z Î N 0,1 n (2-1-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : , z where z 0 and P Z z Statistics for Engineering Page 12 Institute of Technology of Cambodia 2013-2014 (2-1-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : z , where z 0 and P Z z (2-1-c). Case (c) – two-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : z /2 , z/2 where z /2 0 and P Z z /2 2. If the variance 2 is unknown, then Xn - The test statistics Z Sn n - Under the Hypothesis X n 0 H0 : Z Î N 0,1 Sn n (2-2-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : , z where z 0 and P Z z Statistics for Engineering Page 13 Institute of Technology of Cambodia 2013-2014 (2-2-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : z , where z 0 and P Z z (2-2-c). Case (c) – two-tailed test : The acceptance region of the null hypothesis is an interval of the form : z /2 , z/2 where z /2 0 and P Z z /2 Example 4 : A researcher claims that the average wind speed in a certain city is 8 miles per hour. A sample of 32 days has average wind speed of 8.2 miles per hour. The standard deviation of the sample is 0.6 mile per hour. Test level of 0.05, is there enough evidence to reject the claim? Use the P-value method. 2.2. Test medium: the case of two samples Theorem 3 : Let X 1 and X 2 be two random variables independent normal expectancy Statistics for Engineering Page 14 Institute of Technology of Cambodia 2013-2014 respectively 1 and 2 and variance respectively 12 and 22 , and X 1, 1 ,..., X 1, n1 be an iid sample drawn from X 1, X 2,1 ,..., X2, n2 be an iid sample drawn from X 2 . We propose to test the hypothesis : H0 : 1 2 d0 (a) (b) (c) H1 : 1 2 d0 H1 : 1 2 d0 H1 : 1 2 d0 right-tailed test left-tailed test two-tailed test 1. If the variance 12 and 22 are known, then - The test statistics X 1 X 2 1 2 Z 12 22 n1 n2 - Under the Hypothesis H0 : X1 X 2 d0 Z ~ N 0,1 2 2 1 2 n1 n2 (3-1-a). Case (a) – right-tailed test : Statistics for Engineering Page 15 Institute of Technology of Cambodia 2013-2014 The acceptance region of the null hypothesis H0 is an interval of the form : , z where z 0 and P Z z (3-1-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : z , where z 0 and P Z z (3-1-c). Case (c) – two-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : z /2 , z/2 where z /2 0 and P Z z /2 2. If 12 22 2 where 2 is unknown, then - The test statistics X 1 X 2 1 2 T 1 1 Sp n1 n2 where S p n1 1 S12 n2 1 S22 n1 n2 2 - Under the Hypothesis H0 : Statistics for Engineering Page 16 Institute of Technology of Cambodia X T 1 X 2 d0 2013-2014 ~ Student n1 n2 2 1 1 Sp n1 n2 (3-2-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : , t where t 0 and P T t (3-2-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : t , where t 0 and P T t (3-2-c). Case (c) – two-tailed test: The acceptance region of the null hypothesis H0 is an interval of the form : t /2 , t/2 where t /2 0 and P T t /2 3. If 12 22 and both are unknown, then - The test statistics Statistics for Engineering Page 17 Institute of Technology of Cambodia 2013-2014 X T 1 X 2 1 2 S12 S 22 n1 n2 - Under the Hypothesis H0 : X1 X 2 d0 T ~ Student S12 S22 n1 n2 where S 2 1 S 2 1 / n1 S / n2 / n1 2 2 S 2 2 2 2 / n2 2 n1 1 n2 1 (3-3-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : , t where t 0 and P T t (3-3-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : t , where t 0 and P T t (3-3-c). Case (c) – two-tailed test : Statistics for Engineering Page 18 Institute of Technology of Cambodia 2013-2014 The acceptance region of the null hypothesis H0 is an interval of the form : t /2 , t/2 where t /2 0 and P T t /2 Example 5 : A random sample of size n1 25 taken from a normal population with a standard deviation 1 5.2 has an average X1 81. A second random sample of size n1 36 taken from a different population normal with a standard deviation 2 3.4 has an average X 2 76. Test the hypothesis that 1 2 against the alternative 1 2 . Quote of the P-value in your conclusion. Example 6: A large automobile manufacturing company is trying to decide whether to buy brand A or brand B tires for its new models. To help reach a decision, an experiment is conducted using 12 of each brand. The tires are run until they wear out. The results are X A 37900 Kilometres, Brand A: S A 5100 Kilometres X B 39800 Kilometres, Brand B: Statistics for Engineering Page 19 Institute of Technology of Cambodia 2013-2014 S B 5900 Kilometres. Test of the hypothesis test level of 0.05 there is no difference in the two tire brands. Assume that the populations are approximately normally distributed. Theorem 4 : Let X A and X P be two normal random variables dependent expectancy respectively A and P ( X A and X P may be the same variable in a population of processing and a reference population) and X A, 1 ,..., X A, n is an iid sample drawn from X A , X P ,1 ,..., X P, n is an iid sample drawn from X P . We 1 n put and D X A XP, D Di n i 1 2 1 n SD Di D . n 1 i1 We propose to test the hypothesis: H0 : D : A P d0 (a) (b) (c) H1 : D d0 H1 : D d0 H1 : D d0 Statistics for Engineering right-tailed test left-tailed test two-tailed test Page 20 Institute of Technology of Cambodia 2013-2014 Then, D D - The test statistics T SD n - Under Hypothesis H0 : D d0 T ~ Student n 1 SD n (4-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form: , t where t 0 and P T t (4-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form: t , where t 0 and P T t (4-c). Case (c) – two-tailed test: The acceptance region of the null hypothesis H0 is an interval of the form: t /2 , t /2 where t /2 0 and P T t /2 Statistics for Engineering Page 21 Institute of Technology of Cambodia 2013-2014 Example 7: A physical education director says that taking a particular vitamin haltéro one pill can increase the strength. Eight athletes are selected and tested for strength data by using the standard bench press. After two weeks of regular training, supplemented by vitamins, they are tested again. Test the effectiveness of the dosage of the vitamin 0.05. Each value of these data is the maximum number of pounds the athlete can bench press. Assume the variable is approximately normally distributed. Athlete 1 2 3 4 5 6 7 8 Before 210 230 182 205 262 253 219 216 After 219 236 179 204 270 250 222 216 2.3. Testing the value of a proportion Theoreme 5 : Let X ~ B p and X 1 ,..., X n (with n very large) an iid sample drawn from X . We propose to test the hypothesis : H0 : p p0 Statistics for Engineering Page 22 Institute of Technology of Cambodia (a) H1 : p p0 (b) H1 : p p0 (c) H1 : p p0 Then, 2013-2014 right-tailed test left-tailed test two-tailed test - The test statistics Z Xn p p 1 p n - Under Hypothesis H0 : X n p0 Z Î N 0,1 p0 1 p0 n (5-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : , z where z 0 and P Z z (5-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : z , where z 0 and P Z z (5-c). Case (c) – two-tailed test: Statistics for Engineering Page 23 Institute of Technology of Cambodia 2013-2014 The acceptance region of the null hypothesis H0 is an interval of the form : z /2 , z/2 where z /2 0 and P Z z /2 Example 8 : An oil company claims that a fifth of homes in a certain city are heated by oil. We have reason to doubt this statement though, in a random sample of 1000 houses in this city, it is found that 236 are heated by oil? Use a significance level of 0.01. 2.4. Tests of proportions: if two samples Theorem 6 : Let X 1 ~ B p1 and X 2 ~ B p2 be two independent random variables ; X 1,1 ,..., X 1, n1 is an iid sample drawn from X 1 and X 2, 1 ,..., X 2, n 2 is an iid sample drawn from X 2 . We propose to test the hypothesis: H0 : p1 p2 (a) (b) H1 : p1 p2 H1 : p p0 Statistics for Engineering right-tailed test left-tailed test Page 24 Institute of Technology of Cambodia 2013-2014 (c) H1 : p1 p2 two-tailed test Then, - The test statistics X 1 X 2 p1 p2 Z p1 1 p1 p2 1 p2 n1 n2 - Under Hypothesis H0 : X1 X 2 Z Î N 0,1 1 1 ˆ ˆ X 1 X n1 n2 n1 X 1 n2 X 2 ˆ where X . n1 n2 (6-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form: , z where z 0 and P Z z (6-b). Case (b) – left-tailed test: Statistics for Engineering Page 25 Institute of Technology of Cambodia 2013-2014 The acceptance region of the null hypothesis H0 is an interval of the form: z , where z 0 and P Z z (6-c). Case (c) – two-tailed test: The acceptance region of the null hypothesis H0 is an interval of the form: z /2 , z /2 where z /2 0 and P Z z /2 Example 9: A cigarette manufacturing company distributes two brands of cigarettes. It is found that 56 of 200 smokers prefer brand A and 29 of 150 smokers prefer brand B, can we conclude at the 0.06 test that brand A is sold more that brand B? 2.5. Tests comparing reference value a variance to a Theorem 7 : Let X ~ N , 2 and X 1 ,..., X n is an iid sample drawn from X . We propose to test the hypothesis : Statistics for Engineering Page 26 Institute of Technology of Cambodia 2013-2014 H0 : 2 02 (a) H1 : 2 02 (b) H1 : 2 02 (c) H1 : 2 02 Then, right-tailed test left-tailed test two-tailed test - The test statistics 2 n 1 S n 2 2 - Under Hypothesis H0 : 2 n 1 S n 2 2 ~ n 1 . 2 0 (7-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : 0, 2 where 2 0 and P 2 2 (7-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : 12 , where 12 0 and P 2 12 1 (7-c). Case (c) – two-tailed test: Statistics for Engineering Page 27 Institute of Technology of Cambodia 2013-2014 The acceptance region of the null hypothesis H0 is an interval of the form : 12 /2 , 2 /2 where 12 /2 , 2 /2 0, P 2 2 /2 / 2 and P 2 12 /2 1 / 2 . Example 10 : Manufacture of car batteries claims that its battery life is approximately normally distributed with a standard deviation equal to 0.9 years. If a random sample of size ten of these batteries has a standard deviation of 1.2 years, do you think 0.9 ? Use a level test 0.05. 2.6. Tests of variances: if two samples Theorem 8 : Let X 1 ~ N 1 , 12 and X 1, 1 ,..., X 1, n1 is an iid sample drawn from X 1 ; X 2 ~ N 2 , 2 2 and X 2, 1 ,..., X 2, n 2 is an iid sample drawn from X 2 . We propose to test the hypothesis: H0 : 12 22 Statistics for Engineering Page 28 Institute of Technology of Cambodia (a) H1 : 12 22 (b) H1 : 12 22 (c) H1 : 12 22 Then, 2013-2014 right-tailed test left-tailed test two-tailed test S12 / 12 - The test statistics F 2 2 S2 / 2 - Under Hypothesis H0 : S12 F 2 ~ F n1 1, n2 1 . S2 (8-a). Case (a) – right-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : 0, f where f 0 and P F f (8-b). Case (b) – left-tailed test : The acceptance region of the null hypothesis H0 is an interval of the form : f1 , where f1 0 and P F f1 1 (8-c). Case (c) – two-tailed test: The acceptance region of the null hypothesis H0 is an interval of the form : f1 /2 , f /2 Statistics for Engineering Page 29 Institute of Technology of Cambodia 2013-2014 where f1 /2 , f /2 0, P F f /2 / 2 and P F f1 /2 1 / 2 . Example 11 : A medical researcher wants to see if the variance of the heart rate (beats per minute) of smokers is different from the variance in heart people who do not smoke. Two samples are selected, and the data are shown. Use 0.05, Is there enough evidence to support the claim? Smoking NonSmoking n1 = 26 n2 = 18 S12 36 S 22 10 To be continued … Statistics for Engineering Page 30