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
Hypothesis Tests Hypothesis Tests • An Hypothesis is a guess about a situation that can be tested, and the test outcome can be either true or false. –The Null Hypothesis has a symbol H0, and is always the default situation that must be proven unlikely beyond a reasonable doubt. –The Alternative Hypothesis is denoted by the symbol HA and can be thought of as the opposite of the Null Hypothesis - it can also be either true or false, but it is always false when H0 is true and vice-versa. Hypothesis Testing Errors –Type I Errors occur when a test statistic leads us to reject the Null Hypothesis when the Null Hypothesis is true in reality. • The chance of making a Type I Error is estimated by the parameter (or level of significance), which quantifies the reasonable doubt. –Type II Errors occur when a test statistic leads us to fail to reject the Null Hypothesis when the Null Hypothesis is actually false in reality. • The probability of making a Type II Error is estimated by the parameter . Types of Hypothesis Tests Hypothesis Tests & Rejection Criteria H0: MA is not different than M0 H0: MA is not better than M0 HA: MA is different than M0 HA: MA is lower than M0 θA θ0 Dm 2 2 θA -θ0 Dm +θ0 θA H0: MA is not better than M0 HA: MA is higher than M0 Dm θ0 θA One-Sided Test Statistic < Rejection Criterion Two-Sided Test Statistic < -½ Rejection Criterion or Statistic > +½ Rejection Criterion One-Sided Test Statistic > Rejection Criterion H0: θA ≥ θ0 HA: θA < θ0 H0: -θ0 ≤ θA ≤ +θ0 HA: θA< -θ0 or +θ0< θA H0: θA ≤ θ0 HA: θA > θ0 Hypothesis Testing Steps 1. State the null hypothesis (H0) from one of the alternatives: that the test statistic MA = M0 , MA ≥ M0 , or MA ≤ M0 . 2. Choose the alternative hypothesis (HA) from the alternatives: MA M0 , MA < M0 , or MA > M0 . (Respective to above!) 3. Choose a significance level of the test (). 4. Select the appropriate test statistic and establish a critical region. (If the decision is to be based on a P-value, it is not necessary to have a critical region) 5. Compute the value of the test statistic () from the sample data. 6. Decision: Reject H0 if the test statistic has a value in the critical region (or if the computed P-value is less than or equal to the desired significance level ); otherwise, do not reject H0. Situation I: Means Test, Both σ0 and μ0 Known • Used with: –an existing process with good deal of data showing the variation and location are stable • Procedure: –use the the z-statistic to compare sample mean with population mean 0 x 0 z0 = 0 n Sampling Distribution of the Mean from the Normal Distribution • Take a random sample, x1, x2, …, xn, from a normal population with mean μ and standard deviation σ, i.e., x ~ N(μ, σ ) • Compute the sample average x • Then x will be normally distributed with mean μ and standard deviation: σ n that is: σ x ~ N(μ, σ x ) = N μ, n Ex. Sampling Distribution of x • When a process is operating properly, the mean density of a liquid is 10 with standard deviation 5. Five observations are taken and the average density is 15. • What is the distribution of the sample average? – r.v. x = density of liquid 5 x ~ N μ = 10, σ = 5 Ex. Sampling Distribution of x • What is the probability the sample average is greater than 15? x 0 15 10 5 Z= = = = 2.23 0 5 2.24 n 5 { X 15| the = 10process } = P{ Z is2.operating 23} = 0.0129 • Would youPconclude properly? Hypothesis Testing Significance Level of a Hypothesis Test: A hypothesis test with a significance level or size rejects the null hypothesis H0 if a p-value smaller than is obtained, and accepts the null hypothesis H0 if a p-value larger than is obtained. In this case, the probability of a Type I error (the probability of rejecting the null hypothesis when it is true) is equal to . True Situation Test Conclusion • H0 is True H0 is False H0 is True CORRECT Type II Error () H0 is False Type I Error () CORRECT error = 0.0129 1- 0 2.23 P{ X 15 | = 10} = 0.0129 In words: If the true mean is 10, the probably that we would see a sample mean of 15 or higher is only 1.3%. If we say that the mean has shifted to something larger than 10, there is a 1.3% chance we are wrong. error Type II error ( ) can only be calculated if we want to test for a specific shift. Suppose for example that it is important that detect a shift of = 16 in the liquid density level. HO HA 10 c 12 = P{ X c | =10} = P{ X c | = 12} error Viscosity is supposed to be 10. I need to be able to detect if viscosity has shifted to 12. We agree to use 11 as the critical value for the test. HO 10 HA c 12 = P{ X 11| =10} = P{ Z 11 10 } = P{ Z .45} = 0.326 5 5 error Viscosity is supposed to be 10. I need to be able to detect if viscosity has shifted to 12. HO 10 HA c 12 = P{ X 11| =12} = P{ Z 11 12 } = P{ Z .45} = 0.326 5 5 error Viscosity is supposed to be 10. I need to be able to detect if viscosity has shifted to 12. HO 10 HA = = 0.326 c 12 In words: We have a 32.6% chance of buying product when the mean has shifted. The supplier has a 32.6% chance of taking back good product. How do we resolve this ? Situation III: Means Test Unknown σ(s) and Known μ0 • Used when: –have good control over the center of the distribution, but the variation changed from time to time • Procedure: –use the the t-statistic to compare both sample means x 0 t0 = S n v = n – 1 degrees of freedom Testing Example • Single Sample, Two-Sided t-Test: – H0: µ = µ0 versus HA: µ µ0 – Test Statistic: x 0 ) T= s n – Critical Region: reject H0 if |T| > t/2,n-1 – P-Value: 2 • P(X |T|), where the random variable x has a t-distribution with n _ 1 degrees of freedom Hypothesis Testing H0: μ = μ0 versus HA: μ μ0 tn-1 distribution -|T| 0 |T| Statistics and Sampling • Objective of statistical inference: – Draw conclusions/make decisions about a population based on a sample selected from the population • Random sample – a sample, x1, x2, …, xn , selected so that observations are independently and identically distributed (iid). • Statistic – function of the sample data – Quantities computed from observations in sample and used to make statistical inferences – e.g. measures central tendency 1 n x = xi n i =1 Comparison of Means –The first types of comparison are those that compare the location of two distributions. To do this: • Compare the difference in the mean values for the two distributions, and check to see if the magnitude of their difference is sufficiently large relative to the amount of variation in the distributions Definitely Different Probably Different Probably NOT Different Definitely NOT Different • Which type of test statistic we use depends on what is known about the process(es), and how efficient we can be with our collected data Situation II: Means Test σ(s) Known and μ(s) Unknown • Used when: –the means from two existing processes may differ, but the variation of the two processes is stable, so we can estimate the population variances pretty closely. • Procedure: –use the the z-statistic to compare both sample means z0 = x1 x 2 12 n1 22 n2 Situation IV: Means Test Unknown σ(s) and μ(s), Similar s2 • Used when: –logical case for similar variances, but no real "history" with either process distribution (means & variances) • Procedure: –use the the t-statistic to compare using pooled S, v = n1 + n2 – 2 degrees of freedom x1 x 2 t0 = 1 1 Sp n1 n2 (n1 1)S12 (n2 1)S22 Sp = n1 n2 2 Situation V: Means Test Unknown σ(s) and μ(s), Dissimilar s2 • Used when: –worst case data efficiency - no real "history" with either process distribution (means & variances) • Procedure: –use the the t-statistic to compare, degrees of freedom given by: t0 = x1 x2 S12 S22 n1 n2 2 S S n1 n2 v= 2 2 2 2 S1 S2 n1 n2 n1 1 n2 1 2 1 2 2 Situation VI: Means Test Paired but Unknown σ(s) • Used when: –exact same sample work piece could be run through both processes, eliminating material variation • Procedure: –define variable (d) for the difference in test value pairs (di = x1i - x2i) observed on ith sample, v = n - 1 dof d t0 = Sd n d d) n 2 i Sd = i=1 n 1 Ex. Surface Roughness • Surface roughness is normally distributed with mean 125 and std dev of 5. The specification is 125 ± 11.65 and we have calculated that 98% of parts are within specs during usual production. This has been the case for a long time. • My supplier of these parts has sent me a large shipment. I take a random sample of 10 parts. The sample average roughness is 134 which is within specifications. • Test the hypothesis that the lot roughness is higher than specifications at = 0.05. e.g. Surface Roughness Check the hypothesis that the sample of size 10, and with an average of 134 comes from a population with mean 125 and standard deviation of 5. One-Sided Test H0: ≤ 0 HA: > 0 Test Statistic: y 0 z0 = n Critical Value: Z = 1.645 Should I reject H0? z0 = 134 125 9 = = 5.69 5 1.58 = 10 Alpha One-sided Two-sided Level (α) z z 0.1 1.28155 1.64485 0.05 1.64485 1.95996 Yes! Since 5.69 > 1.645, it is likely that it exceeds the roughness. e.g. Surface Roughness • Find the probability that the sample of size 10, and with an average of 134 does not come from a population with mean 125 and standard deviation of 5. z0 = y 0 n = 134 125 9 z0 = = = 5.69 5 1.58 10 P value = 1 ( z0 ) = 1 (5.69) 1 1 = 0 • Should I accept this shipment?