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
ENGG2430A-Homework 7 Due on April 2, 2014 via the assignment box. 1. modified Ex 10.20 from textbook A random sample of 64 bags of white cheddar popcorn weighed, on average, 5.23 ounces with a standard deviation of 0.24 ounce. Test the hypothesis that µ = 5.5 ounces against the alternative hypothesis, µ < 5.5 ounces, at the 0.05 level of significance. Give the critical region and P-value as well. Solution: From the question, the null and alternative hypotheses are: H0 :µ = 5.5 H1 :µ < 5.5 The sample size n = 64, the sample mean and standard deviation observed from data are x̄ = 5.23 and s = 0.24 respectively, and the level of significance is α = 0.05. Since n > 30, we can apply the central limit theorem, and use also use s to estimate the population variance. i.e. assuming H0 is true, then the sample mean X̄ (as a random variable) is approximately normal distributed with mean µ0 = 5.5 and variance s2 . Since this is a one-tailed hypothesis testing, and the alternative hypothesis is “µ < µ0 ”, we consider X̄ − µ0 √ < −zα µ = µ0 ≈ α. Pr s/ n where zα = −Φ−1 (α) ≈ 1.6449 is the z-value for the significance level of α. The z-value for the √ 0 ≈ −9. The critical region is “z < −zα ”, which is satisfied by observed sample mean is z := x̄−µ s/ n the observed z-value and so we should reject H0 for the one-tailed hypothesis testing, because the chance of observing a z-value no larger than −9 given H0 is true is much smaller than 0.05. It can also express the critical region in terms of X̄. Rewrite the above probability as s Pr X̄ < µ0 − zα √ µ = µ0 ≈ α. n The critical value is s 0.24 µ0 − zα √ = 5.5 − z0.05 √ ≈ 5.5493 n 64 and so the critical region for rejecting H0 is “x̄ < 5.45”, which is satisfied by the observed x̄ = 5.23. Again, we reach the same conclusion of rejecting H0 as expected. Finally, the P -value for the observed sample mean is X̄ − µ0 x̄ − µ0 √ √ µ = µ0 Pr X̄ < x̄ µ = µ0 = Pr < s/ n s/ n x̄ − µ0 =Φ − √ s/ n = Φ(−9) ≈ 10−19 Once again, we reach the same conclusion of rejecting H0 since the P-value is smaller than α = 0.05. Indeed, since the P-value is approximately 0, the evidence for rejecting H0 is very strong. 1 2. modified Ex 10.23 from textbook Test the hypothesis that the average content of containers of a particular lubricant is 10 liters if the contents of a random sample of 10 containers are 10.2, 9.7, 10.1, 10.3, 10.1, 9.8, 9.9, 10.4, 10.3, and 9.8 liters. Use a 0.05 level of significance and assume that the distribution of contents is normal. Give the critical region and quote a P-value in your conclusion. Solution: Since the samples are drawn from the normal population, we can use the t-distribution for the sample mean. We may use Octave to carry out the computation as follows. mu0=10; % hypotheses H0 : µ = µ0 and H1 : µ 6= µ0 . x = [ 1 0 . 2 , 9 . 7 , 1 0 . 1 , 1 0 . 3 , 1 0 . 1 , 9 . 8 , 9 . 9 , 1 0 . 4 , 1 0 . 3 , 9 . 8 ] ; % sample {x1 , x2 , . . . } n=length ( x ) % sample size n 1 Pn xi xbar=mean( x ) % sample mean x̄ = n i=1q 1 Pn 2 s=std ( x ) % sample standard deviation s = i=1 (xi − x̄) n−1 a l p h a =0.05 % 95% confidence level t a 2=−t i n v ( a l p h a / 2 , n−1) % t-value tα/2 with n-1 degrees of freedom √0 t =(xbar−mu0 ) / ( s / sqrt ( n ) ) % t-statistics x̄−µ s/ n i f xbar>mu0 P=2∗ t c d f ( −( xbar−mu0 ) / ( s / sqrt ( n ) ) , n−1) else P=2∗ t c d f ( ( xbar−mu0 ) / ( s / sqrt ( n ) ) , n−1) end [ P , T,DF]= t t e s t ( x , mu0 , " <>" ) The critical region is “|t| > tα/2 ≈ 2.2622”. We should not reject H0 because the t-statistics computed is 0.77174, which lies outside the critical region. n.b. we do not write the critical region as “|x̄| > c” because we need to know s in addition to x̄ for the test using t-distribution. The P-value is 0.46005, which is much larger than the the significance level of 0.05. This not only tells us not to reject H0 , but also tells us that the evidence for rejection is far from significant. The hypothesis testing using t-statistics can be performed also by the octave command [P,t,df]=t_test(x,mu0,"<>") which returns the P-value, t-statistics and the degrees of freedom for a two-tailed test. Page 2