Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 2 2-Sample Tests Goodness of Fit Tests for Independence

Similar presentations


Presentation on theme: "Lecture 2 2-Sample Tests Goodness of Fit Tests for Independence"— Presentation transcript:

1 Lecture 2 2-Sample Tests Goodness of Fit Tests for Independence
Hypothesis Test Lecture 2 2-Sample Tests Goodness of Fit Tests for Independence EGR Ch10 Lec2and3 9th

2 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 EGR Ch10 Lec2and3 9th

3 Hypothesis Testing Basics
Test statistic; n is large, standard deviation is known Test statistic: n is small, standard deviation is unknown EGR Ch10 Lec2and3 9th

4 Hypothesis Testing – Approach 1
Approach 1 - Fixed probability of Type 1 error. State the null and alternative hypotheses. Choose a fixed significance level α. Specify the appropriate test statistic and establish the critical region based on α. Draw a graphic representation. Calculate the value of the test statistic based on the sample data. Make a decision to reject H0 or fail to reject H0, based on the location of the test statistic. Make an engineering or scientific conclusion. recall our question about the amount of coffee in the cup … 1. H0 : μ = 8 oz. H1 : μ < 8 oz. 2. α = 0.05 3. zα = 5. if zcalc < , reject H0 if zcalc > , fail to reject H0 6. e.g., coffee in the cup is significantly less than 8 oz. or coffee in the cup is not significantly less than 8 oz. EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

5 Hypothesis Testing – Approach 2
Approach 2 - Significance testing based on the calculated P-value State the null and alternative hypotheses. Choose an appropriate test statistic. Calculate value of test statistic and determine P-value. Draw a graphic representation. Make a decision to reject H0 or fail to reject H0, based on the P-value. Make an engineering or scientific conclusion. recall our question about the amount of coffee in the cup … 1. H0 : μ = 8 oz. H1 : μ < 8 oz. 2. if variance known or n large, z-test (assume z in this case) 3. from zcalc, determine p-value from table A.3 or as given by statistical software packages. 4. P = 0, H0 rejected / not plausible (e.g., coffee in the cup is significantly less than 8 oz.) P = 1, H0 is not rejected (coffee in the cup is not significantly less than 8 oz.) Note: Approach 1 is the classical method. Approach 2 is gaining acceptance, partly because of the increasing availability of statistical software packages. The conclusion based on a P-value requires judgment. The smaller the P-value, the less plausible is the null hypothesis. p = ↓ P-value 0.25 0.50 0.75 1.00 P-value EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

6 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.) EGR Ch10 Lec2and3 9th

7 Non-directional - Two-tail Test
m1-m2 ≠ d0 Critical/Reject Region z <-za/2 or z >za/2 t <-ta/2 or t >ta/2 -ta/2 ta/2 EGR Ch10 Lec2and3 9th

8 Directional-Right-tail Test
m1-m2 > d0 Critical/Reject Region z >za t >ta ta EGR Ch10 Lec2and3 9th

9 Directional-Left-tail Test
m1-m2 < d0 Critical/Reject Region z <-za t <-ta -ta EGR Ch10 Lec2and3 9th

10 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 NOTE: d0 is often 0 (there is, statistically speaking, no difference in the means) H0: μ1 - μ2 = 0 H1: μ1 - μ2 < 0 (note: compare lower to higher for lower-tail test) H1: μ1 - μ2 ≠ 0 H1: μ1 – μ2 > 0 (note: compare higher to lower for upper-tail test) EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

11 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, 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, , hours ***Assume equal variances. EGR Ch10 Lec2and3 9th

12 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) Recall  Note that we have to compare higher – lower mean to conduct an upper-tail test EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

13 Our Example – Hand Calculation
Reading: n1 = 4 mean x1 = s12 = 1.363 No reading: n2 = 5 mean x2 = s22 = 3.883 To conduct the test by hand, we must calculate sp2 . = sp = 1.674 and = ???? t-test sp2 = (3(1.363)+4(3.883))/(4+5-2) = , s = 1.674 EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

14 Lower-tail test (μ1 - μ2 < 0) Why?
Draw the picture: Approach 1: df = 7, t0.05,7 =  tcrit = Calculation: tcalc = (( )-0)/(1.674*sqrt(1/4 + 1/5)) = -0.70 Graphic: Decision: Conclusion: tcalc = (( )-0)/(1.674*sqrt(1/4 + 1/5)) = -0.70 Approach 1: df = 7, t0.05,7 =  tcrit = Approach 2: =TDIST(0.7,7,1) = Decision: fail to reject H0 EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

15 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. The data does not support the hypothesis that the mean completion time is less for readers than for non-readers. tcalc = (( )-0)/(1.674*sqrt(1/4 – 1/5)) = 0.70 Approach 1: df = 7, t0.5,7 =  tcrit = 1.895 Approach 2: =TDIST(0.7,7,1) = Decision: fail to reject H0 Conclusion: the data do not support the hypothesis that the mean time to complete homework is more for students who do not read the textbook EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

16 Our Example Using Excel
Reading: n1 = 4 mean x1 = s12 = 1.363 No reading: n2 = 5 mean x2 = s22 = 3.883 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 DoNotRead Mean 2.075 2.860 Variance 1.3625 3.883 Observations 4 5 Pooled Variance Hypothesized Mean Difference df 7 t Stat P(T<=t) one-tail t Critical one-tail P(T<=t) two-tail t Critical two-tail t-test sp2 = (3(1.363)+4(3.883))/(4+5-2) = , s = 1.674 EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

17 Our Example Using Excel
Reading: n1 = 4 mean x1 = s12 = 1.363 No reading: n2 = 5 mean x2 = 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 DoNotRead Mean 2.075 2.860 Variance 1.3625 3.883 Observations 4 5 Pooled Variance Hypothesized Mean Difference df 7 t Stat P(T<=t) one-tail t Critical one-tail P(T<=t) two-tail t Critical two-tail t-Test: Two-Sample Assuming Unequal Variances Read DoNotRead Mean 2.075 2.86 Variance 1.3625 3.883 Observations 4 5 Hypothesized Mean Difference df 7 t Stat P(T<=t) one-tail t Critical one-tail P(T<=t) two-tail t Critical two-tail t-test sp2 = (3(1.363)+4(3.883))/(4+5-2) = , s = 1.674 EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

18 Examples 10.30 10.34 10.40 (Excel) EGR Ch10 Lec2and3 9th

19 Special Case: Paired Sample T-Test
Which designs are paired-sample? Car Radial Belted 1 ** ** Radial, Belted tires 2 ** ** placed on each car. 3 ** ** 4 ** ** Person Pre Post 1 ** ** Pre- and post-test 2 ** ** administered to each 3 ** ** person. Student Test1 Test2 1 ** ** 4 scores from test 1, 2 ** ** 4 scores from test 2. paired-sample paired sample maybe – if we have information that the test1 and test2 scores can be matched to a particular individual for every subject in the study, it is a paired-sample experiment; otherwise it is a 2-sample experiment. EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

20 Example (Paired) 10.43 (Excel) EGR Ch10 Lec2and3 9th

21 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. EGR Ch10 Lec2and3 9th

22 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 Compare χ2calc to χ2crit Make a decision about H0 State your conclusion draw χ2 graph k = number of “cells” (note: some texts use k-1-h where h is the number of parameters in the distribution being tested – e.g., 1 for Poisson, 2 for normal) Table A.5, pg show calc and crit on the drawing EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

23 Tests of Independence Salaried 160 140 40 340 Hourly 60 200 100 500
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. Worker Type Pension Plan Total #1 #2 #3 Salaried 160 140 40 340 Hourly 60 200 100 500 EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

24 Calculation of Expected Values
Worker Type Pension Plan Total #1 #2 #3 Salaried 160 140 40 340 Hourly 60 200 100 500 2. Calculate expected probabilities P(#1 ∩ S) = P(#1)*P(S) = (200/500)*(340/500)=0.272 E(#1 ∩ S) = * 500 = 136 P(#1 ∩ S) =P(#1)*P(S) = (200/500)*(340/500)= E(#1 ∩ S) = 0.272*500 = 136 P(#1 ∩ H) = P(#1)*P(H) = (200/500)*(160/500)= E(#1 ∩ H) = 64 #1 #2 #3 S (exp) H(exp) #1 #2 #3 S (exp.) 136 ? 68 H (exp.) 64 32 EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

25 Calculate the Sample-based Statistic
Calculation of the sample-based statistic = ( )^2/(136) + ( )^2/(136) + … (60-32)^2/(32) = 49.63 ( )^2/136 + ( )^2/136 + (40-68)^2/68 + (40-64)^2/64 + (60-64)^2/64 + (60-32)^2/32 = 49.63 EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition

26 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: 2013 χ20.01,2__ = (from Table A.5, pp 740) χ2calc> χ2crit so reject the null hypothesis and conclude that worker and plan are not independent EGR Ch10 Lec2and3 9th EGR 252 F06 Ch. 10 8th edition


Download ppt "Lecture 2 2-Sample Tests Goodness of Fit Tests for Independence"

Similar presentations


Ads by Google