Test of Hypotheses: Single Sample. Outlines: Hypothesis testing Test on the mean of a normal distribution, variance known Test on the mean of a normal distribution, variance unknown Test on the variance and standard deviation of a normal distribution Test on a population proportion Hypothesis testing Many problems in engineering require the decision to accept or reject the hypothesis. A statistical hypothesis : a statement about the parameters of one or more populations. Ex. Suppose we are interested in burning rate of a solid propellant used to power aircrew escape systems. Burning rate is a random variable that can be described by a probability distribution. We are interested in the mean burning rate, specifically in deciding whether or not the mean burning rate is 50 cm/s. H0: µ=50 cm/s H1: µ≠50 cm/s Hypothesis testing Suppose that a sample of n= 10 is tested and the sample mean x is observed. x is an estimate of the true value of . If x is close to the hypothesized value of =50, we can not reject H0 If x is far from the hypothesized value of =50, we can reject H0 Hypothesis testing Suppose if 48.5 x 51.5 , we cannot reject H0 If x 48.5, x 51.5, we will reject H0 and in favor of H1 Reject H0 Fail to reject H0 (acceptance region) 48.5 Critical value 50 Reject H0 51.5 Critical value Test of Statistical Hypotheses Critical region: the interval of the parameter that we will reject the null hypothesis H0 Acceptance region: the interval of the parameter that we will fail to reject the null hypothesis H0 Critical value: the boundary between critical and acceptance regions. Hypothesis testing Type I Error: Rejecting the null hypothesis H0 When it is true P(type I error) Called significance level Ex. The true mean equal to 50, but from the randomly selected samples, the test statistic x falls in the critical region. Type II Error: Failing to reject the null hypothesis when it is false P(type II error) Ex. The true mean not equal to 50, but from the randomly selected samples, the test statistic x falls in the acceptance region. Hypothesis testing How to calculate the P(type I error)? Suppose 2.5 A type I error will occur when x 48.5 or x 51.5 and 50 P( X 48.5 | 50) P( X 51.5 | 50) P( Z 48.5 50 51.5 50 ) P( Z ) 0.0574 2.5 / 10 2.5 / 10 How to calculate the P(type II error)? Suppose 2.5 A type II error will occur when 48.5 x 51.5 and 50 Suppose 52 P(48.5 X 51.5 | 52) P( Z 51.5 52 48.5 52 ) P( Z ) 0.2643 2.5 / 10 2.5 / 10 Hypothesis testing Discussion about type I and type II error 1. 2. 3. 4. The size of critical region (consequently to , ) can be reduced by appropriate selection of the critical value. A decreasing of type I error always results in an increasing of type II error, when n does not change. An increasing in sample size n reduces type II error, when given type I constant. The value of type II error decreased as the difference between the true mean and the hypothesized value increases. Hypothesis testing Power is computed as 1 Power can be interpreted as the probability of correctly rejecting a false null hypothesis. Power is the descriptive and concise measurement of the sensitivity of the statistical test. Hypothesis testing Two-sided alternative hypothesis H0: µ=50 cm/s H1: µ≠50 cm/s One-sided alternative hypothesis H0: µ=50 cm/s H1: µ>50 cm/s or H1: µ<50 cm/s Hypothesis testing P-Value : the smallest level of significance that would lead to reject the null hypothesis with the given data. Consider the two-sided hypothesis test H0: µ=50 cm/s H1: µ≠50 cm/s With n=16 and sd = 2.5. Suppose that the observed sample mean is 51.3. The P-value is the that make 51.3 (and 48.7) => critical value P value 1 P(48.7 X 51.3) 48.7 50 51.3 50 Z ) 2.5 / 10 2.5 / 10 1 P(2.08 Z 2.08) 1 P( 1 0.962 0.038 Hypothesis testing Process of hypothesis testing Identify the parameter of interest State H0 and H1 Choose a significance level Determine an appropriate test statistic State the rejection region for the statistic Compute the statistic value Decide whether or not H0 should be rejected. Test on the mean of a normal distribution variance know H 0 : 0 Hypothesis Test Statistic We should reject H0 if H1 : 0 Z0 X 0 / n Z0 Z / 2 or Z0 Z / 2 Test on the mean of a normal distribution variance know Ex. Aircrew escape system are powered by a solid propellant. The burning rate of this propellant is an important product characteristic. The specifications require that the mean burning rate must be 50 cm/s. We know that the sd for burning rate is 2 cm/s. The experimenter decides to specify a significance level of =0.05 and selects a random sample of n=25 and obtain average burning rate of x =51.3 cm/s. What conclusion should be drawn? 1. Parameter of interest if mean of the burning rate 2. H0: µ=50 cm/s, H1: µ≠50 cm/s 3. =0.05 4. Test statistic Z 0 5. X 0 / n reject H0 if Z0 Z / 2 or Z0 Z / 2 Test on the mean of a normal distribution variance know z0 z / 2 51.3 50 3.25 2 / 25 z0.025 1.96, z / 2 z0.025 1.96 Since Z0=3.25 >1.96, we reject H0 at the 0.05 level of significance. We conclude that the mean burning rate differs from 50 cm/s based on a sample of 25 measurements. There is a strong evidence that the mean burning rate exceeds 50 cm/s Test on the mean of a normal distribution variance know Probability of a type II error for 2 sided-test δ = µ-µ0 Sample size can be calculated by Formulas Operating Y-axis Characteristic Curves (OC curve) => ß | 0 | | | d X-axis => Test on the mean of a normal distribution variance know Ex From previous example. Suppose that the true burning rate is 49 cm/s. What is ß for the 2-sided test with =0.05, =2, and n=25 Form previous example µ0 =50, | 50 49 | 1 (1.96 25 25 ) (1.96 ) (0.54) (4.46) 0.295 2 2 Conclusion: the probability of 0.295 that the test will fail to reject the null hypothesis when the true burning rate is 49 cm/s Suppose that the analyst wish to design the test that: if the mean burning rate differs from 50 cm/s by as much as 1 cm/s, the test will detect this with high probability of 0.90. What is the sample size required? Now 2, 1, 0.05, 1 0.90 0.10 2 2 2 2 By formula, n ( z / 2 z ) (1.96 1.28) 2 42 2 12 Test on the mean of a normal distribution variance know By using OC curve: n 40 ß=0.10 d | 0 | 1 / 2 0.5 Test on the mean of a normal distribution variance know Large Sample Test: We may not be certain that the population is well modeled by a normal distribution. In this case if n is large (n>40) the sample sd. s can be substituted for in the test procedures. Test on the mean of a normal distribution, variance unknown H 0 : 0 Hypothesis Test Statistic We should reject H0 if H1 : 0 T0 X 0 S/ n t0 t / 2,n1 or t0 t / 2,n1 Test on the mean of a normal distribution, variance unknown Ex. It is of interest to determine if there is evidence (with =0.05) to support a claim that the mean coefficient of restitution exceeds 0.82. The observations follow: 1. Parameter of interest is the mean coefficient of restitution, µ 2. H0 : 0.82; H1 : 0.82 3. =0.05 t0 x 0 s/ n 4. The test statistic is 5. Reject H0 if t0>t0.05,14=1.761 6. Calculate t0 7. t0 0.83725 0.82 2.72 0.02456/ 15 Conclusion: Since t0=2.72>1.761, we reject H0 and conclude that at the 0.05 level of significance the mean coefficient of restitution exceeds 0.82 Test on the mean of a normal distribution, variance unknown P value for a t-test Ex From data in the previous example, Find P-value. - - - From table of t-test based on 14 degrees of freedom Notice that t0=2.72 is between 2.624 and 2.977, therefore the P-value must be between 0.01 and 0.005. By comparing critical value and tail area we found that P-value = 0.008 If the test is two-tailed test, the P-value would be 0.01<P<0.02 Test on the mean of a normal distribution, variance unknown Sample size can be approximated by using OC curve for tdistribution Ex. From previous example, if the mean coefficient of restitution exceeds 0.82 by as much as 0.02, is the sample size n=15 adequate to ensure that H0: µ=0.82 will be rejected with probability at least 0.8. s 0.02456, 0.02, 0.05, n 15 | | d 0.02 / 0.02456 0.81 0.15 0.2 n=15 is adequate to make ß<0.2 0.15 Test on the variance and standard deviation of a normal distribution H0 : 0 Hypothesis Test Statistic We should reject H0 if H1 : 0 2 0 (n 1)S 2 02 02 2 / 2,n1 or 02 12 / 2,n1 Test on the variance and standard deviation of a normal distribution Ex. An automatic filling machine is used to fill bottles with liquid drtergent. A random sampling of 20 bottles results in a sample variance of fill volume of S2 =0.0153 oz2 . If the variance of fill volume exceeds 0.01 oz2 , an unaccepatble proportion of bottles will be underfilled or overfilled. Is there evidence in the sample data to suggest that the manufacturer has a problem with underfilled or overfilled bottles? Use =0.05, and assume that fill volume has a normal distribution. 1. The parameter of interest is the population variance 2 2. H0 : 2 0.01; H1 : 2 0.01 3. =0.05 (n 1)S 2 5. Test statistic is 2 0 2 2 0 0.05,19 30.14 Reject H0 if 6. Compute 02 4. 7. 2 0 19 (0.0153 ) 29 .07 0.01 Conclusion: since 02 29.07 02.05,19 30.14 , we conclude that there is no strong evidence that the variance of fill volume exceeds 0.01 oz2 Test on the variance and standard deviation of a normal distribution Sample size: using OC curves for chi square with X-axis = =/0 Ex. Form previous ex, H0: 0 =0.10, suppose that if the true sd of the filling process exceeds this value by 25%, we would like to detect this with probability at least 0.8. Is the sample size of n=20 adequate? 0.125 1.25 0 0.10 0.68 power 1 0.22 0.8 n=20 is not adequate! We must increase n to decrease ß, n 70 Test on a population proportion Hypothesis H 0 : p p0 H1 : p p0 X np0 Z0 np0 (1 p0 ) Test Statistic We should reject H0 if z0 z / 2 or z0 z / 2 Test on a population proportion 1. 2. 3. 4. Ex. A semiconductor manufacturer produces controllers used un automobile engine applications. The customer requires that the process fallout or fraction defective at a critical manufacturing step not exceed 0.05 and that the manufacturer demonstrate process capability at this level of quality using =0.05. The semiconductor manufacturer takes a random sample of 200 devices and finds that four of them are defective. Can the manufacturer demonstrate process capability for the customer. The parameter of interest is the process fraction defective p. H 0 : p 0.05; H1 : p 0.05 =0.05 X np Test statistic Z np (1 p ) , x=4, n=200, p0=0.05 Reject H0: p=0.05 if z0<-z0.05=-1.645 4 200(0.05) Computations: Z 200* 0.05* 0.95 1.95 Conclusion: Since z0<-z0.05 , we reject H0 and conclude that the process fraction defective p is less than 0.05. P-value=0.0256, which is less than =0.05. 0 0 0 5. 6. 7. 0 0 Test on a population proportion Sample size: Homework 1. The sodium content of thirty 300-gram boxes of organic corn flakes was determined. The data (in mg.) are as follows: 131.15 128.77 130.14 130.42 131.15 128.77 130.69 130.72 129.29 129.53 130.69 130.72 130.91 128.33 128.71 130.12 130.91 128.33 129.54 128.24 129 129.78 129.54 128.24 129.64 129.65 129.39 130.92 129.64 129.65 a) Can you support a claim that mean sodium content of this brand of corn flakes differs from 130 mg? use =0.05. Find the P-value. b) Check the sodium content is normally distributed. c) Compute the power of the test if the true mean sodium content is 130.5 mg. d) What sample size would be required to detect a true mean sodium content of 130.1 mg. if we waned the power of the test to be at least 0.75? e) From question in a), construct a two-sided confidence interval on the mean sodium content.