Chapter 4 Inference About Process Quality • Motivation • Estimation – point estimation – interval estimation • Hypothesis Testing – Definition – Testing on means • known and Unknown variance – Testing on Variance The need of “Statistical Inference” • In statistical quality control, the probability distribution is used to model some quality characteristic (which is related to process parameters). • The parameters of a probability distribution are 2 unknown. N (, ) ?? – Estimation of Process Parameters – Point Estimation / Interval Estimation • The parameters of a process can be time varying, how do we identify a process change? – Hypothesis Testing Observations in a sample are used to draw conclusions about the population 3 Random Samples • Random Sample: – Sampling from an infinite population or finite population with replacement: A sample is selected so that the observations are independently and identically distributed. – Sampling n samples from a finite population of N N items without replacement if each of the n possible samples has an equal probability of being chosen Random Sample = Independently and Identically Distributed (i.i.d) 4 Terminology and Definition • Statistic: – Any function of the sample data that does not contain unknown parameters. • Estimate: a particular numerical value of an estimator, computed from sample data. (An estimate is a particular statistic) – Point estimate: a statistic that produces a single numerical value as the estimate of the unknown parameter – Interval estimate: a random interval (or called confidence interval) in which the true value of the parameter falls with some level of probability. • Sampling distribution: – The probability distribution of a statistic. 5 Point Estimation Methods: [1] • Method of Moment (MOM) • Maximum Likelihood Estimation (MLE) Distribution Normal Parameters Estimator ˆ x 2 ˆ 2 S 2 ˆ S / c4 (n>10) or ˆ R / d 2 (n≤10); c4 Binomial p Poisson and d2 are given in Appendix Table VI 1 n pˆ xi x , {xi} are either 1 or 0, n i 1 corresponding to “success” and “failure” of the ith Bernoulli trial, respectively. 1 n ˆ xi x n i 1 [1] “Statistical Inference”, George Casella and Roger L. Berger, 2nd edition 6 Interval Estimation • Estimate the interval between two statistics that include the true value of the parameter with some probability Real mean of – Example: Pr{ L U}=1- (0 1) the population – The interval L U is called a 100(1- )% confidence interval (C.I.) for the unknown mean – Two side C.I. (L is lower confidence limit, U is upper confidence limit) – Single side C.I.: • lower 100(1- )% C. I.: L , Pr{ L }=1- • upper 100(1- )% C. I.: U, Pr{ U}=1- • Analysis procedures: – – – – – /2 /2 get the samples L U compute the statistic determine the statistic reference distribution select confidence level find the lower and/or upper confidence limits based on the reference distribution 7 x x1 x2 Q: how to determine the width? U L Interval Estimation If x is a random variable with unknown mean and known variance 2, what is the estimation interval for mean ? n – Select a statistic x ( xi ) / n i 1 2 – The approximate distribution of x is N (, / n) regardless of the distribution of x due to the central limit theorem. – Given confidence level , then • 100(1-)% two-side confidence interval on is: x Z / 2 x Z / 2 n n where Pr{z Z / 2 } / 2 • 100(1-)% upper confidence interval on is: x Z n • 100(1-)% lower confidence interval on is: x Z n 9 Example: The strength of a disposable plastic beverage container is being investigated. The strengths are normally distributed, with a known standard deviation of 15 psi. A sample of 20 plastic containers has a mean strength of 246 psi. Compute a 95% confidence interval for the process mean. 10 ( z) 1 / 2 two size C.I. (90%) ( z) 1 one side C.I. (95%) 11 Example: A chemical process converts lead to gold. However, the production varies due to the powers of the alchemist. It is known that the process is normally distributed, with a standard deviation of 2.5 g. How many samples must be taken to be 90% certain that an estimate of the mean process is within 1.5 g of the true but unknown mean yield? 12 Interval Estimation of the Binomial Distribution Parameter with A Larger Sample Size • From the central limit theorem: p^ =x/n~ Normal (p, p(1-p) /n ) Example 5-1: A random sample of 200 printed circuit boards contains 18 defective or nonconforming units. Estimate the process fraction nonconforming. Construct a 90% two-sided confidence interval on the true fraction nonconforming in the production process. 13 Hypothesis Testing • • • • Statistical hypothesis: – a statement about the values of the parameters of a probability distribution Hypothesis testing: – Making a hypothesis concerning what we believe to be true and then use sampled data to test it. Two Hypotheses (Two Competing Propositions) – Null Hypothesis H0: will be rejected if the sample data do not support it. – Alternative Hypothesis H1: a hypothesis different from the null hypothesis H 0 : 1.5 H 0 : 1.5 H 0 : 1.5 H1 : 1.5 H1 : 1.5 H1 : 1.5 Conclusion – By Comparing the Test Statistic with Critical Value, determine whether reject or NOT reject the null hypothesis. 14 Hypothesis Testing Procedures 1) State the null and alternative hypothesis, and define the test statistic. 2) Specify the significance level . 3) Find the distribution of the test statistic and the rejection region of H0. 4) Collect data and calculate the test statistic. 5) Compare the test statistic with the rejection region. 6) Assess the risk. 15 Inference on the MEAN of a Normal Population – Variance Known Assuming Known Population Variance x– ~ N(0,1) / n x Z / 2 x Z / 2 n n x – 0 Reject H0: 0 if > Z(/2) / n x– 0 Reject H0: < 0 if < -Z() / n x – 0 Reject H0: > 0 if > Z() / n Critical value Test Statistic: function of data and hypothetic value 16 Example: The response time of a distributed computer system is an important quality characteristic. The system manager wants to know whether the mean response time to a specific type of command exceeds 75 millisec. From past experience, he knows that the standard deviation of response time is 8 millisec. If the command is executed 25 times and the response time for each trial is recorded. The sample average response time is 79.25 millisec. • Formulate an appropriate hypothesis and test the hypothesis. • Find out the (lower/upper?) bound of the 95% C.I. 17 Inference on the MEAN of a Normal Population – Variance Unknown Assuming Unknown Population Variance x– ~ t (n-1) s/ n x t / 2 s s x t / 2 n n x – 0 Reject H : if > t(/2, n-1) 0 0 s/ n x– 0 Reject H0: < 0 if <- t(n-1) s/ n x – 0 Reject H0: > 0 if > t(n-1) s/ n H0 : 0 H1 18 19 20 Example: The mean time it takes a crew to restart an aluminum rolling mill after a failure is of interest. The crew was observed over 25 occasions, and the results were mean = 26.42 minutes and variance S2 =12.28 minutes. If repair time is normally distributed, • Find a 95% confidence interval on the true but unknown mean repair time. • Test the hypothesis that the true mean repair time is 30 minutes. 21 Example 6-1: The life of a battery used in a cardiac pacemaker is assumed to be normally distributed. A random sample of 10 batteries is subjected to an accelerated life test by running them continuously at an elevated temperature until failure, and the following lives are obtained. 25.5 h 26.1 h 26.8 23.2 24.2 28.4 25.0 27.8 27.3 25.7 • Construct a 90% two-sided confidence interval on mean life in the accelerated test. • Test the hypothesis, with =0.1 that the mean battery life is 26.5 h. 22 23 The Use of P-Values in Hypothesis Testing 1. Traditional hypothesis testing: – Given to determine whether the null hypothesis was rejected – Disadvantage: • No information on how close to/far away from the rejection region in a probability sense • predefined may not reflect different decision maker’s risk assessments 2. P-Value approach – P-Value: the smallest level of significance that would lead to rejection of the null hypothesis – if the predefined >P= min, reject the null hypothesis p _ value P(observingtest statisticsor extremevalue| H0 is true) Underlying idea: “if H0 is really true, is it possible for test statistic to be such big/small?” 0 x1 x2 Z0 x 0 n H0 : 0 Two-sided p_value Z / 2 Z / 2 Use of P-Value for the Normal Distribution H0: =0, standard normal statistic Z0~N(0,1) – P=2[1-(|Z0|)] with two-sided H1, i.e., H1: 0 – P=1-(Z0) for one-sided H1, H1: >0 Z0 – P=(Z0) for one-sided H1, H1: <0 x 0 / n A small p-value is evidence against the null hypothesis while a large p-value means little or no evidence against the null f(x) hypothesis (Z0) 1(Z0) Z0<0 =0 x Z0>0 If p-value is small, it is less likely that the test statistic is small. So, H0 is NOT true. Inference on the MEAN of a Normal Population – Variance Known Assuming Known Population Variance x– ~ N(0,1) / n x Z / 2 x Z / 2 n n x – 0 Reject H0: 0 if > Z(/2) / n x– 0 Reject H0: < 0 if < -Z() / n x– 0 Reject H : > if > Z() 0 0 / n H0 : 0 H1 p_value x 0 2 1 ( / n ( ) x 0 ) / n 1 ( x 0 ) / n 27 Example: The response time of a distributed computer system is an important quality characteristic. The system manager wants to know whether the mean response time to a specific type of command exceeds 75 millisec. From past experience, he knows that the standard deviation of response time is 8 millisec. If the command is executed 25 times and the response time for each trial is recorded. The sample average response time is 79.25 millisec. Formulate an appropriate hypothesis and test the hypothesis. • Calculate the p-value of the true mean response time is as low as 75 millisec. 28 Inference on the MEAN of a Normal Population – Variance Unknown Assuming Unknown Population Variance x– ~ t (n-1) s/ n x t / 2 s s x t / 2 n n p_value CDF x – 0 Reject H0: 0 if > t(/2, n-1) s/ n x– 0 Reject H0: < 0 if <- t(n-1) s/ n x – 0 Reject H : > if > t(n-1) 0 0 s/ n H0 : 0 H1 x 0 2 1 t( n 1) ( s/ n t n 1 ( ) x 0 ) s/ n 1 tn1 ( x 0 ) s/ n 29 Example: The mean time it takes a crew to restart an aluminum rolling mill after a failure is of interest. The crew was observed over 25 occasions, and the results were mean = 26.42 minutes and variance S2 =12.28 minutes. If repair time is normally distributed, find a 95% confidence interval on the true but unknown mean repair time. • Test the H0: μ = 30 v.s. μ ≠ 30. • Calculate the p-value of the hypothesis that μ = 30. 30 Example: The life of a battery used in a cardiac pacemaker is assumed to be normally distributed. A random sample of 10 batteries is subjected to an accelerated life test by running them continuously at an elevated temperature until failure, and the following lives are obtained. 25.5 h 26.1 h 26.8 23.2 24.2 28.4 25.0 27.8 27.3 25.7 Construct a 90% two-sided confidence interval on mean life in the accelerated test. Test the H0: μ = 26.5 v.s. μ ≠ 26.5. • Calculate the p-value of the hypothesis that μ = 26.5. 31 Confidence Interval v.s. Hypothesis Testing • If the value of the parameter specified by the null hypothesis is contained in the 100(1- )% interval, then the null hypothesis cannot be rejected at the level. • If the value specified by the null hypothesis is not in the interval, then the null hypothesis will be rejected at the level 32 Understanding the result of Hypothesis Test • When we reject the null hypothesis, it is a strong conclusion: there is a strong evidence that the null hypothesis is false. • When we fail to reject the null hypothesis, it is a weak conclusion: It does not mean that the null hypothesis is correct. It only means we do not have strong evidence to reject it. 33 Court System and Hypothesis Testing Hypothesis testing in science is a lot like the criminal court system in the United States. How do we decide guilt? • Assume innocence until “proven” guilty. • Evidence is presented at a trial. • Proof has to be “beyond a reasonable doubt.” A jury's possible decision: • guilty • not guilty Note that a jury cannot declare somebody ``innocent,'' just ``not guilty.'' This is an important point. 34 Interrelationships between statistical inferences Confidence Interval Statistical Distribution Hypothesis Testing p_Value Interrelationships between statistical inferences x Z / 2 Assuming Known Population n Variance n x Z / 2 Assuming Known Population Variance x – ~ N(0,1) / n x – ~ N(0,1) / n x – 0|)] with P=2[1-(|Z two-sided 0 H1, i.e., Reject H0: 0 if H1: 0 > Z(/2) / n x – x – 0 Reject H0: 0 if > Z(/2) / n x – 0 Reject H0: < 0 if < -Z() / n x – 0 Inference on the Difference in Means of Two Populations – Variance Known Assume Known Population Variances Observations in TWO samples are all i.i.d. _ _ x -x 1 2 1 n 1 2 2 n H 0 : 1 2 2 ~ N ( 0,1) _ _ x -x 1 2 Z / 2 1 2 n 1 2 n 2 _ _ 1 2 x1 - x 2 Z / 2 2 1 2 n 1 2 n p_value 2 H1 Reject H0 : 1 2 if _ x1 - x 2 Z /2 12 22 n1 _ Reject H 0 : 1 2 if _ _ n2 1 2 n1 n2 2 1 2 2 x -x 1 2 2 1 Z n1 Reject H 0 : 1 2 if _ x1 - x 2 n1 n2 2 1 2 2 Z 2 2 )] n2 ( x1 x 2 ) 12 22 _ _ n _ 1 _ _ x -x 2[1 ( _ n2 _ 1 ( x1 x 2 ) 12 n1 22 n2 37 2 2 Example: A bakery has a line making Binkies, a big-selling junk food. Another line has just been installed, and the plant manager wants to know if the output of the new line is greater than that of the old line, as promised by the bakery equipment firm. 12 days of data are selected at random from line 1 and 10 days of data are selected at random from line – – 2, with x = 1124.3 cases and x = 1138.7. It is known that 2= 52 1 2 1 and 2 = 60. Test the appropriate hypotheses at = 0.05, given that 2 the outputs are normally distributed. 38 Inference on the Difference in Means of Two Populations – Variance Unknown a) Assume Homogeneity ( _ 12 22 ) i.i.d. _ x -x 1 Sp 2 2 1 1 n1 n2 _ _ ~ t (n1 n2 2) ; x1 - x 2 t / 2,n n 2 S p 1 2 _ 1 n n 1 _ 1 2 x1 - x 2 t / 2,n1 n2 2 S p 2 1 H1 Reject H0 : 1 2 if _ 1 x1 - x 2 1 1 n1 n2 Sp _ Reject H 0 : 1 2 if 1 2 1 1 n1 n2 _ x -x Sp t (, n1 n2 2) _ 1 Reject H 0 : 1 2 if t ( / 2, n1 n2 2) 2[1 t( n1 n2 2) ( _ x -x Sp p_value _ 2 1 1 n1 n2 t (, n1 n2 2) t( n1 n2 2) ( x1 x2 )] 1 1 Sp n1 n2 x1 x2 ) 1 1 Sp n1 n2 1 t( n1 n2 2) ( x1 x2 ) 1 1 Sp n1 n2 39 1 n n Equal variance (n 1)s 2 (n 1)s 2 1 2 2 1 2 S p where n1 n2 2 H 0 : 1 2 1 2 Inference on the Difference in Means of Two Populations – Variance Unknown b) Assume Heterogeneity ( 1 2 _ _ x1 - x 2 2 1 2 2 s s n1 n2 H 0 : 1 2 22 ) 2 ~ t (v ) (s / n s / n ) v where (s / n ) (s / n ) 2 1 1 2 1 n1 1 H1 Reject H0 : 1 2 if _ x -x 1 Reject H 0 : 1 2 if 2 2 1 s s22 n1 n2 2 2 n2 1 t ( / 2, v) _ x -x 1 2 2 1 s s2 2 n1 n2 _ 2 2 _ _ Reject H 0 : 1 2 if 2 2 1 2 2 2 t ( , v ) _ x1 - x 2 s12 s22 n1 n2 t (, v ) 40 Example: Two quality-control technicians measured the surface finish of a metal part, obtaining the data shown below. Assume that the measurements are normally distributed. Technician 1 Technician 2 1.45 1.54 1.37 1.41 1.21 1.56 1.54 1.37 1.48 1.20 1.29 1.31 1.34 1.27 1.35 Assuming that the variances are equal, construct a 95% confidence interval on the mean difference in surface-finish measurements. Also, test H0: μ1= μ2 v.s. H1: μ1≠ μ2 and compute the p-value. 41 42 t , Text Book Page P696 43 Review • P-value: a probability value p _ value P(observingtest statisticsor extremevalue| H0 is true) • With the same α value, C.I., Hypothesis testing and p-value give the same inferential conclusion. • Inferences on mean of two populations: what are the statistics used? What are the reference distributions? How to define the reject region? Inference on the Variance of a Normal Distribution (n 1)s 2 ~ 2(n – 1) 2 2 1 / 2, n 1 H0 : 0 H1 (n - 1) s2 2 Reject H : if > (/2,n - 1) 0 o 2 o (n - 1) s2 Reject H : < if < 2 0 o o (n - 1) s2 Reject H : > if > 2 0 o o C.I. (n 1) s 2 2 2 / 2, n 1 (n - 1) s2 2 < or (1 - /2,n - 1) 2 o 2(1-,n - 1) 2(,n - 1) (n 1)S 2 (n 1)S 2 2 2 , 2 / 2,n1 1 / 2,n1 Pr{2n1 2 / 2,n1} / 2 45 Example Construct a 90% two-sided confidence interval on the variance of battery life. Convert this into a corresponding confidence interval on the standard deviation of battery life. 25.5 h 26.1 h 26.8 23.2 24.2 28.4 25.0 27.8 27.3 25.7 46 Text P695 47 Inference on the Variances of Two Normal Distributions S12 / 12 ~ Fn1 1, n2 1 With H : 2 = 2 2 2 0 1 2 S2 / 2 for H : 2 2 1 1 2 Reject H if 0 s 2 1 2 s 2 >F (/2,n –1,n –1) or 1 2 s 2 1 2 s 2 < F (1–/2,n –1,n –1) 1 2 for H : 2 < 2 1 1 2 Reject H 0 s 2 2 if 2 s 1 > F (,n –1,n –1) 2 1 s 2 1 if s 2 2 > F (,n –1,n –1) 1 2 2 2 for H1: 1 > 2 Reject H C.I. 0 S12 12 S12 F1 / 2,n2 1,n1 1 2 2 F / 2,n2 1,n1 1 , S22 2 S 2 F1 / 2,, 1 / F / 2,, The two d.f. are exchanged 48 Example:Two quality-control technicians measured the surface finish of a metal part, obtaining the data shown below. Assume that the measurements are normally distributed. b. Construct a 95% confidence interval estimate of the ratio of the variances of technician measurement error. c. Construct a 95% confidence interval on the variance of measurement error for Technician 2. Technician 1 1.45 1.37 1.21 1.54 1.48 1.29 1.34 Technician 2 1.54 1.41 1.56 1.37 1.20 1.31 1.27 1.35 49 50 Text P700 51 Testing on Binomial Parameters • • To test whether the parameter p of a binomial distribution equals a standard value p0 The test is based on the normal approximation to the binomial distribution H 0 : p p0 H1 : p p0 ( x 0.5) np0 np (1 p ) 0 0 Z0 ( x 0.5) np0 np0 (1 p0 ) if if x np0 x np0 Or using the central limit theorem H 0 : p1 p2 H1 : p1 p2 Z0 pˆ1 pˆ 2 ; 1 1 pˆ (1 pˆ )( ) n1 n2 pˆ H0 is rejected if | Z0 | Z / 2 Z0 x p0 p0 (1 p0 ) / n n1 pˆ1 n2 pˆ 2 if n1 n2 p1 p2 Example 4.5,4.6 on p122 52 Test on Poisson Distribution • A random sample of n observation is taken, say x1, x2, ..,xn. Each {xi} is Poisson distributed with parameter . Then the sum x= x1+ x2 +...+xn is Poisson distributed with parameter n. • If n is large, x =x/n is approximately normal with mean and variance /n Test hypothesis x 0 H0: =0 Z0 0 / n H1: 0 The null hypothesis would be rejected if |Z0|>Z/2. • • 53 Two Types of Hypothesis Test Errors • Type I error ( producer’s risk): – = P{type I error} = P{reject H0 |H0 is true} =P{conclude bad | although actually good} • Type II error (consumer’s risk): – = P{type II error} = P{fail to reject H0 |H0 is false} =P{conclude good | although actually bad} • Power of the test: – Power = 1- = P{reject H0 |H0 is false} H0: = 0 H1: = 1 0 with known 2 f(x) 1 /2 /2 LCL x 0 UCL 54 Summary of Type I and Type II Errors You Conclude : Reality "H is True" 0 "H is True" 1 "H0 is True" "H1 is True" Co nfidence 1– Co nsumer Erro r, P r o duc er Erro r, P o w er 1– 55 Properties of Type I & Type II Errors Both types of errors can be reduced by increasing the sample size at the price of increased inspection costs. For a given sample size, one risk can only be reduced at the expense of increasing the other risk. 56 The Probability of Type II Error — Detection of a mean shift with a known • Type II error= =Pr{H0 |H1 |}=Pr{within the control limits| mean shift} H0: = 0 1 0 , if 0 H1: = 1 0 with known 2 Pr{H 0 | H1} Pr{ 0 Z / 2 / n x 0 Z / 2 / n | H1} ( Z / 2 n n ) ( Z / 2 ) 57 OC curve with =0.05 • • The larger the mean shift, the smaller the type II error The larger the sample size, the smaller the type II error d | | / 58 OC Curves OC curve see Fig. 4.7 P126 • The larger the mean shift, the smaller the type II error • The larger the sample size, the smaller the type II error n 1 n2 n3 n4 =0.05 59 OC Curves OC curve see Fig. 4.7 P126 • The larger the mean shift, the smaller the type II error • The larger the sample size, the smaller the type II error n 1 n2 n3 n4 =0.05 60 Example: Suppose we wish to test the hypotheses H0: =15 H1: 15 where we know that 2=9.0. If the true mean is really 20, what sample size must be used to ensure that the probability of type II error is no greater than 0.10? Assume that =0.05. 61 Use OC Curve n=4 62 Example 7-4: The mean contents of coffee cans filled on a particular production line are being studied. Standards specify that the mean contents must be 16.0 oz, and from past experience it is known that the standard deviation of the can contents is 0.1 oz. The hypotheses are H0: =16.0 H1: 16.0 A random sample of nine cans is to be used, and the type I error probability is specified as =0.05. What is the type II error if the true mean contents are 1=16.1 oz? 63