Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Hypothesis Test Lecture 2 2-Sample Tests Goodness of Fit Tests for Independence EGR252 2015 Ch10 Lec2and3 9th Slide 1 Hypothesis Testing Basics Null hypothesis must be accepted (fail to reject) or rejected Test Statistic: A value which functions as the decision maker. The decision to “reject” or “fail to reject” is based on information contained in a sample drawn from the population of interest. Rejection region: If test statistic falls in some interval which support alternative hypothesis, we reject the null hypothesis. Acceptance Region: It test statistic falls in some interval which support null hypothesis, we fail to reject the null hypothesis. Critical Value: The point which divide the rejection region and acceptance EGR252 2015 Ch10 Lec2and3 9th Slide 2 Hypothesis Testing Basics Test statistic; n is large, standard deviation is known Test statistic: n is small, standard deviation is unknown EGR252 2015 Ch10 Lec2and3 9th Slide 3 Hypothesis Testing – Approach 1 Approach 1 - Fixed probability of Type 1 error. 1. State the null and alternative hypotheses. 2. Choose a fixed significance level α. 3. Specify the appropriate test statistic and establish the critical region based on α. Draw a graphic representation. 4. Calculate the value of the test statistic based on the sample data. 5. Make a decision to reject H0 or fail to reject H0, based on the location of the test statistic. 6. Make an engineering or scientific conclusion. EGR252 2015 Ch10 Lec2and3 9th Slide 4 Hypothesis Testing – Approach 2 Approach 2 - Significance testing based on the calculated P-value 1. State the null and alternative hypotheses. 2. Choose an appropriate test statistic. 3. Calculate value of test statistic and determine P-value. Draw a graphic representation. 4. Make a decision to reject H0 or fail to reject H0, based on the P-value. 5. Make an engineering or scientific conclusion. p = 0.05 P-value 0 ↓ 0.25 EGR252 2015 Ch10 Lec2and3 9th 0.50 0.75 1.00 P-value Slide 5 Two Sample Hypothesis Test Test relationships between two means Hypothesis Ho: equals to hypothesis H1: m1-m2 ≠ d0 H1: m1-m2 > d0 H1: m1-m2 < d0 Test statistic Selection Large samples/s1 and s2 known Small samples/ s1 = s2 Small samples/ s1 ≠ s2 Paired (before and after/ pre-post, etc.) EGR252 2015 Ch10 Lec2and3 9th Slide 6 Non-directional - Two-tail Test m1-m2 ≠ d0 Do Not Reject H Reject H a/2 0 0 Reject H 1-a –za/2 -ta/2 Critical/Reject Region z <-za/2 or z >za/2 t <-ta/2 or t >ta/2 EGR252 2015 Ch10 Lec2and3 9th a/2 za/2 ta/2 0 Slide 7 Directional-Right-tail Test m1-m2 > d0 Critical/Reject Region z >za t >ta Do Not Reject H 0 Reject H 1-a EGR252 2015 Ch10 Lec2and3 9th 0 a za ta Slide 8 Directional-Left-tail Test m1-m2 < d0 Critical/Reject Region z <-za t <-ta Reject H 0 Do Not Reject H 1-a a 0 –za -ta EGR252 2015 Ch10 Lec2and3 9th Slide 9 Two-Sample Hypothesis Testing Define the difference in the two means as: μ1 - μ2 = d0 where d0 is the actual value of the hypothesized difference What are the Hypotheses? H0: _______________ H1: _______________ or H1: _______________ or H1: _______________ EGR252 2015 Ch10 Lec2and3 9th Slide 10 Two-Sample Hypothesis Testing A professor has designed an experiment to test the effect of reading the textbook before attempting to complete a homework assignment. Four students who read the textbook before attempting the homework recorded the following times (in hours) to complete the assignment: 3.1, 2.8, 0.5, 1.9 hours Five students who did not read the textbook before attempting the homework recorded the following times to complete the assignment: 0.9, 1.4, 2.1, 5.3, ***Assume equal variances. EGR252 2015 Ch10 Lec2and3 9th 4.6 hours Slide 11 Hypothesis Tests to Conduct Lower-tail test (μ1 - μ2 < 0) “Fixed α” approach (“Approach 1”) at α = 0.05 level. “p-value” approach (“Approach 2”) Upper-tail test (μ2 – μ1 > 0) “Fixed α” approach at α = 0.05 level. “p-value” approach Two-tailed test (μ1 - μ2 ≠ 0) “Fixed α” approach at α = 0.05 level. “p-value” approach Recall t calc ( x1 - x 2 ) - d0 s p 1/ n1 1/ n2 EGR252 2015 Ch10 Lec2and3 9th Slide 12 Our Example – Hand Calculation Reading: n1 = 4 mean x1 = 2.075 s12 = 1.363 n2 = 5 mean x2 = 2.860 s22 = 3.883 No reading: To conduct the test by hand, we must calculate sp2 . 2 2 ( n 1 ) s ( n 1 ) s = 2.803 1 2 2 s p2 1 n1 n2 - 2 and t calc ( x1 - x 2 ) - d0 s p 1/ n1 1/ n2 EGR252 2015 Ch10 Lec2and3 9th sp = 1.674 = ???? Slide 13 Lower-tail test (μ1 - μ2 < 0) Why? Draw the picture: Approach 1: df = 7, t0.05,7 = 1.895 tcrit = -1.895 Calculation: tcalc = ((2.075-2.860)-0)/(1.674*sqrt(1/4 + 1/5)) = -0.70 Graphic: Decision: Conclusion: EGR252 2015 Ch10 Lec2and3 9th Slide 14 Upper-tail test (μ2 – μ1 > 0) Conclusions The data does not support the hypothesis that the mean time to complete homework is less for students who read the textbook. or There is no statistically significant difference in the time required to complete the homework for the people who read the text ahead of time vs those who did not. or The data does not support the hypothesis that the mean completion time is less for readers than for non-readers. EGR252 2015 Ch10 Lec2and3 9th Slide 15 Our Example Using Excel Reading: No reading: s12 = 1.363 s22 = 3.883 n1 = 4 mean x1 = 2.075 n2 = 5 mean x2 = 2.860 If we have reason to believe the population variances are “equal”, we can conduct a t- test assuming equal variances in Minitab or Excel. t-Test: Two-Sample Assuming Equal Variances Read Mean Variance Observations Pooled Variance EGR252 2015 Ch10 Lec2and3 9th DoNotRead 2.075 2.860 1.3625 3.883 4 5 2.8027857 Hypothesized Mean Difference 0 df 7 t Stat -0.698986 P(T<=t) one-tail 0.2535567 t Critical one-tail 1.8945775 P(T<=t) two-tail 0.5071134 t Critical two-tail 2.3646226 Slide 16 Our Example Using Excel Reading: No reading: n1 = 4 n2 = 5 mean x1 = 2.075 mean x2 = 2.860 s12 = 1.363 s22 = 3.883 What if we do not have reason to believe the population variances are “equal”? We can conduct a t- test assuming unequal variances in Minitab or Excel. t-Test: Two-Sample Assuming Equal Variances Read Mean Variance Observations Pooled Variance DoNotRead t-Test: Two-Sample Assuming Unequal Variances 2.075 2.860 1.3625 3.883 4 5 2.8027857 Read Mean DoNotRead 2.075 2.86 1.3625 3.883 Observations 4 5 Variance Hypothesized Mean Difference 0 Hypothesized Mean Difference 0 df 7 df 7 t Stat -0.698986 t Stat P(T<=t) one-tail 0.2535567 P(T<=t) one-tail 0.2409258 t Critical one-tail 1.8945775 t Critical one-tail 1.8945775 P(T<=t) two-tail 0.5071134 P(T<=t) two-tail 0.4818516 t Critical two-tail 2.3646226 t Critical two-tail 2.3646226 EGR252 2015 Ch10 Lec2and3 9th -0.7426759 Slide 17 Examples 10.30 10.34 10.40 (Excel) EGR252 2015 Ch10 Lec2and3 9th Slide 20 Special Case: Paired Sample T-Test Which designs are paired-sample? A. Car Radial Belted 1 ** ** Radial, Belted tires 2 ** ** placed on each car. 3 ** ** 4 ** ** B. Person Pre Post 1 ** ** Pre- and post-test 2 ** ** administered to each 3 ** ** person. 4 ** ** C. Student Test1 Test2 1 ** ** 4 scores from test 1, 2 ** ** 4 scores from test 2. 3 ** ** 4 ** ** EGR252 2015 Ch10 Lec2and3 9th Slide 21 Example (Paired) 10.43 (Excel) EGR252 2015 Ch10 Lec2and3 9th Slide 22 Goodness-of-Fit Tests Procedures for confirming or refuting hypotheses about the distributions of random variables. Hypotheses: H0: The population follows a particular distribution. H1: The population does not follow the distribution. Examples: H0: The data come from a normal distribution. H1: The data do not come from a normal distribution. EGR252 2015 Ch10 Lec2and3 9th Slide 23 Goodness of Fit Tests: Basic Method Test statistic is χ2 Draw the picture Determine the critical value χ2 with parameters α, ν = k – 1 Calculate χ2 from the sample 2 ( O E ) i 2 calc i Ei i 1 k Compare χ2calc to χ2crit Make a decision about H0 State your conclusion EGR252 2015 Ch10 Lec2and3 9th Slide 24 Tests of Independence Example: 500 employees were surveyed with respect to pension plan preferences. Hypotheses H0: Worker Type and Pension Plan are independent. H1: Worker Type and Pension Plan are not independent. Develop a Contingency Table showing the observed values for the 500 people surveyed. Pension Plan Worker Type #1 #2 #3 Salaried Hourly 160 40 140 60 40 60 340 160 Total 200 200 100 500 EGR252 2015 Ch10 Lec2and3 9th Total Slide 25 Calculation of Expected Values Worker Type Salaried Hourly Total Pension Plan #1 #2 160 140 40 200 60 200 #3 40 60 100 Total 340 160 500 2. Calculate expected probabilities P(#1 ∩ S) = P(#1)*P(S) = (200/500)*(340/500)=0.272 E(#1 ∩ S) = 0.272 * 500 = 136 #1 #2 #3 S (exp.) 136 ? 68 H (exp.) ? 32 64 EGR252 2015 Ch10 Lec2and3 9th Slide 26 Calculate the Sample-based Statistic Calculation of the sample-based statistic (Oi - Ei ) 2 calc Ei i 1 k 2 = (160-136)^2/(136) + (140-136)^2/(136) + … (60-32)^2/(32) = 49.63 EGR252 2015 Ch10 Lec2and3 9th Slide 27 The Chi-Squared Test of Independence 5. Compare to the critical statistic, χ2α, v where v = (r – 1)(c – 1) Note: v is the symbol for degrees of freedom For our example, suppose α = 0.01 χ2 0.01,2 = ___________ χ2 calc = ___________ Decision: Conclusion: EGR252 2015 Ch10 Lec2and3 9th Slide 28