Week 9 October 27-31
description
Transcript of Week 9 October 27-31
![Page 1: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/1.jpg)
Week 9 October 27-31
Four Mini-Lectures QMM 510Fall 2014
![Page 2: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/2.jpg)
10-2
Two-Sample Hypothesis Tests
Chapter Contents10.1 Two-Sample Tests
10.2 Comparing Two Means: Independent Samples
10.3 Confidence Interval for the Difference of Two Means, 1 2
10.4 Comparing Two Means: Paired Samples
10.5 Comparing Two Proportions
10.6 Confidence Interval for the Difference of Two Proportions, 1 2
10.7 Comparing Two Variances
Chapter 10
So many topics, so little time …
![Page 3: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/3.jpg)
10-3
• A two-sample test compares two sample estimates with each other.
• A one-sample test compares a sample estimate to a nonsample benchmark.
What Is a Two-Sample Test
Basis of Two-Sample Tests• Two-sample tests are especially useful because they possess
a built-in point of comparison.
• The logic of two-sample tests is based on the fact that two samples drawn from the same population may yield different estimates of a parameter due to chance.
Chapter 10
Two-Sample Tests
![Page 4: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/4.jpg)
10-4
If the two sample statistics differ by more than the amount attributable to chance, then we conclude that the samples came from populations with different parameter values.
What Is a Two-Sample Test
Chapter 10
Two-Sample Tests
![Page 5: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/5.jpg)
10-5
• The hypotheses for comparing two independent population means µ1 and µ2 are:
Format of Hypotheses
Chapter 10
Comparing Two Means: ML 9.1Independent Samples
![Page 6: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/6.jpg)
10-6
• When the population variances 12 and 2
2 are known, use the normal distribution for the test (assuming a normal population).
• The test statistic is:
Case 1: Known Variances
Chapter 10
Comparing Two Means: Independent Samples
![Page 7: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/7.jpg)
10-7
• If the variances are unknown, they must be estimated and the Student’s t distribution used to test the means.
• Assuming the population variances are equal, s12 and s2
2 can be used to estimate a common pooled variance sp
2.
Case 2: Unknown Variances, Assumed Equal
Chapter 10
Comparing Two Means: Independent Samples
![Page 8: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/8.jpg)
10-8
• If the population variances cannot be assumed equal, the distribution of the random variable is uncertain (Behrens-Fisher problem)..
• The Welch-Satterthwaite test addresses this difficulty by estimating each variance separately and then adjusting the degrees of freedom.
A quick rule for degrees of freedom is to use min(n1 – 1, n2 – 1). You will get smaller d.f. but avoid the tedious formula above.
Chapter 10
Comparing Two Means: Independent Samples
Case 3: Unknown Variances, Assumed Unqual
1 2x x
![Page 9: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/9.jpg)
10-9
• If the population variances 12 and 2
2 are known, then use the normal distribution. Of course, we rarely know 1
2 and 22 .
• If population variances are unknown and estimated using s12 and s2
2, then use the Student’s t distribution (Case 2 or Case 3)
• If you are testing for zero difference of means (H0: µ1−µ2 = 0) the formulas are simplified to:
Test Statistic
Chapter 10
Comparing Two Means: Independent Samples
![Page 10: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/10.jpg)
10-10
• If the sample sizes are equal, the Case 2 and Case 3 test statistics will be identical, although the degrees of freedom may differ and therefore the p-values may differ.
• If the variances are similar, the two tests will usually agree.• If no information about the population variances is available, then the
best choice is Case 3.• The fewer assumptions, the better.
Which Assumption Is Best?
Chapter 10
Must Sample Sizes Be Equal?• Unequal sample sizes are common and the formulas still apply.
Comparing Two Means: Independent Samples
![Page 11: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/11.jpg)
10-11
Large Samples• If both samples are large (n1 30 and n2 30) and the population is
not badly skewed, it is reasonable to assume normality for the difference in sample means and use Appendix C.
Chapter 10
• Assuming normality makes the test easier. However, it is not conservative to replace t with z.
• Excel does the calculations, so we should use t whenever population variances are unknown (i.e., almost always).
Comparing Two Means: Independent Samples
![Page 12: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/12.jpg)
10-12
Three Caveats:
• In small samples, the mean may not be a reliable indicator of central tendency and the t-test will lack power.
• In large samples, a small difference in means could be “significant” but may lack practical importance.
Chapter 10
Comparing Two Means: Independent Samples
• Are the populations severely skewed? Are there outliers? Check using histograms and/or dot plots of each sample. t tests are OK if moderately skewed, while outliers are more serious.
![Page 13: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/13.jpg)
10-13
Example: Order Size
Chapter 10
Summary statistics in 8 spreadsheet cells and use MegaStat:
Hypothesis Test: Independent Groups (t-test, pooled variance)Friday Saturday22.32 25.56 mean4.35 6.16 std. dev.
13 18 n
29 df-3.24000 difference (Friday - Saturday)30.07397 pooled variance5.48397 pooled std. dev.1.99604 standard error of difference
0 hypothesized difference
-1.623 t.1154 p-value (two-tailed)
Hypothesis Test: Independent Groups (t-test, unequal variance)Friday Saturday22.32 25.56 mean4.35 6.16 std. dev.
13 18 n
28 df-3.24000 difference (Friday - Saturday)1.88777 standard error of difference
0 hypothesized difference
-1.716 t.0972 p-value (two-tailed)
Friday Saturday22.32 25.56
4.35 6.1613 18
Assuming either Case 2 or Case 3, we would not reject H0 at α = .05 (because the p-value exceeds .05)
H0: μ1 = μ2
H0: μ1 ≠ μ2
Are the means equal? Test the hypotheses:
Comparing Two Means: Independent Samples
![Page 14: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/14.jpg)
10-14
Paired Data• Data occur in matched pairs when the same item is observed
twice but under different circumstances.• For example, blood pressure is taken before and after a
treatment is given.• Paired data are typically displayed in columns.
Chapter 10
Comparing Two Means: ML 9.2Paired Samples
![Page 15: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/15.jpg)
10-15
Paired t Test• Paired data typically come from a before/after experiment.• In the paired t test, the difference between x1 and x2 is
measured as d = x1 – x2
• The mean and standard deviation for the differences d are:
• The test statistic becomes just a one-sample t-test.
Chapter 10
Comparing Two Means: Paired Samples
![Page 16: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/16.jpg)
10-16
• Step 1: State the hypotheses. For example:H0: µd = 0H1: µd ≠ 0
• Step 2: Specify the decision rule. Choose (the level of significance) and determine the critical values from Appendix D or with use of Excel.
• Step 3: Calculate the test statistic t.
• Step 4: Make the decision. Reject H0 if the test statistic falls in the rejection region(s) as defined by the critical values.
Steps in Testing Paired Data
Chapter 10
Comparing Two Means: Paired Samples
![Page 17: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/17.jpg)
10-17
A two-tailed test for a zero difference is equivalent to asking whether the confidence interval for the true mean difference µd includes zero.
Analogy to Confidence Interval
Chapter 10
Comparing Two Means: Paired Samples
![Page 18: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/18.jpg)
10-18
Example: Exam Scores
Chapter 10
Comparing Two Means: Paired Samples
Hypothesis Test: Paired Observations0.000 hypothesized value
84.000 mean Post-Test81.833 mean Pre-Test2.167 mean difference (Post-Test - Pre-Test)5.345 std. dev.2.182 std. error
6 n5 df
0.993 t.1832 p-value (one-tailed, upper)
-3.442 confidence interval 95.% lower7.776 confidence interval 95.% upper5.609 margin of error
confidence interval includes zero
=T.DIST.RT(0.9930,5)calc2.1667
/ (5.3448) / 6d
dts n
Name Post-Test Pre-Test DiffCecil 85 79 6David 97 87 10Edward 81 78 3Fred 77 82 -5Gary 96 96 0Henry 68 69 -1
2.16675.3448
H 0: μ d = 0 (no change in mean) t calc 0.9930
H 1: μ d > 0 (improved mean score) t .05 2.015p -value 0.1832
Mean differenceSt dev of differences
Right-tailed test to see if mean scores improved
Do not reject H 0 because t calc does not exceed t .05 (p > .05).
Using MegaStat:
![Page 19: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/19.jpg)
10-19
To test for equality of two population proportions, 1, 2, use the following hypotheses:
Testing for Zero Difference: 1 2 = 0
Chapter 10
Comparing Two Proportions ML 9.3
![Page 20: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/20.jpg)
10-20
The sample proportion p1 is a point estimate of 1 and p2 is a point estimate of 2:
Chapter 10
Sample Proportions
Comparing Two Proportions
Testing for Zero Difference: 1 2 = 0
![Page 21: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/21.jpg)
10-21
If H0 is true, there is no difference between 1 and 2, so the samples are pooled (or averaged) in order to estimate the common population proportion.
Pooled Proportion
Chapter 10
Comparing Two Proportions
Testing for Zero Difference: 1 2 = 0
![Page 22: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/22.jpg)
10-22
• If the samples are large, p1 – p2 may be assumed normally distributed.• The test statistic is the difference of the sample proportions divided
by the standard error of the difference.• The standard error is calculated by using the pooled proportion.• The test statistic for the hypothesis 1 2 = 0 is:
Test Statistic
Chapter 10 Testing for Zero Difference: 1 2 = 0
Comparing Two Proportions
![Page 23: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/23.jpg)
10-23
Example: Hurricanes
Chapter 10
Comparing Two Proportions
1 21 2
1 2
19 45=.4130 .642946 70
x xp pn n
1 2
1 2
19 45 64 .551746 70 116
x xpn n
2.435
Hypothesis test for two independent proportionsp1 p2 p c
0.413 0.6429 0.5517 p (as decimal)19/46 45/70 64/116 p (as fraction)
19. 45. 64. X46 70 116 n
-0.2298 difference0. hypothesized difference
0.0944 std. error-2.435 z.01491 p-value (two-tailed)
-0.468 confidence interval 99.% lower0.0084 confidence interval 99.% upper0.2382 margin of error
… or using MegaStat:
=2*NORM.S.DIST(-2.435,1)
![Page 24: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/24.jpg)
10-24
• We have assumed a normal distribution for the statistic p1 – p2.
• This assumption can be checked.
• For a test of two proportions, the criterion for normality is n 10 and n(1 − ) 10 for each sample, using each sample proportion in place of .
• If either sample proportion is not normal, their difference cannot safely be assumed normal.
• The sample size rule of thumb is equivalent to requiring that each sample contains at least 10 “successes” and at least 10 “failures.”
Chapter 10
Checking for Normality
Testing for Zero Difference: 1 2 = 0
Comparing Two Proportions
![Page 25: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/25.jpg)
10-25
Chapter 10 Testing for Nonzero Difference
Comparing Two Proportions
![Page 26: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/26.jpg)
10-26
We may need to test whether two population variances are equal.
Format of Hypotheses
Chapter 10
Comparing Two Variances ML 9.4
![Page 27: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/27.jpg)
10-27
• The test statistic is the ratio of the sample variances:
The F Test
• If the variances are equal, this ratio should be near unity: F = 1.
Chapter 10
Comparing Two Variances
![Page 28: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/28.jpg)
10-28
• If the test statistic is far below 1 or above 1, we would reject the hypothesis of equal population variances.
• The numerator s12 has degrees of freedom df1 = n1 – 1 and the denominator
s22 has degrees of freedom df2 = n2 – 1.
• The F distribution is skewed with mean > 1 and mode < 1.
The F Test
Chapter 10
Comparing Two Variances
Example: 5% right-tailed area for F11,8
![Page 29: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/29.jpg)
10-29
• For a two-tailed test, critical values for the F test are denoted FL (left tail) and FR (right tail).
• A right-tail critical value FR may be found from Appendix F using df1 and df2 degrees of freedom.
FR = Fdf1, df2
• A left-tail critical value FL may be found by reversing the numerator and denominator degrees of freedom, finding the critical value from Appendix F and taking its reciprocal:
FL = 1/Fdf2, df1
F Test: Critical Values
Chapter 10
Comparing Two Variances
Excel function is:=F.INV.RT(α, df1, df2)
Excel function is:=F.INV(α, df1, df2)
![Page 30: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/30.jpg)
10-30
• Step 1: State the hypotheses:H0: 1
2 = 22
H1: 12 ≠ 2
2
• Step 2: Specify the decision rule.Degrees of freedom are:
Numerator: df1 = n1 – 1 Denominator: df2 = n2 – 1
Choose α and find the left-tail and right-tail critical values from Appendix F or from Excel.
Two-Tailed F-Test:
Chapter 10
Comparing Two Variances
• Step 3: Calculate the test statistic.
• Step 4: Make the decision. Reject H0 if the test statistic falls in the rejection regions as defined by the critical values.
![Page 31: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/31.jpg)
10-31
One -Tailed F-Test
• Step 1: State the hypotheses. For example: H0: 1
2 22
H1: 12 < 2
2
• Step 2: State the decision rule. Degrees of freedom are:Numerator: df1 = n1 – 1 Denominator: df2 = n2 – 1
Choose α and find the critical value from Appendix F or Excel.
Chapter 10
Comparing Two Variances
• Step 3: Calculate the test statistic.
• Step 4: Make the decision. Reject H0 if the test statistic falls in the rejection region as defined by the critical value.
Example: 5% left-tailed area for F11,8
=F.INV(0.05,11,8)
![Page 32: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/32.jpg)
10-32
EXCEL’s F Test
Chapter 10
Comparing Two Variances
Note: Excel uses a left-tailed test if s1
2 < s22
So, if you want a two-tailed test, you must double Excel’s one-tailed p-value.
Conversely, Excel uses a right-tailed test if s1
2 > s22
![Page 33: Week 9 October 27-31](https://reader034.fdocuments.in/reader034/viewer/2022050821/56816437550346895dd5ffb5/html5/thumbnails/33.jpg)
10-33
Assumptions of the F Test
• The F test assumes that the populations being sampled are normal. It is sensitive to nonnormality of the sampled populations.
• MINITAB reports both the F test and a robust alternative called Levene’s test along with its p-values.
Chapter 10
Comparing Two Variances