-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08-testing-hypothesis-for-two-population-parameters.Rmd
1690 lines (1296 loc) · 64.1 KB
/
08-testing-hypothesis-for-two-population-parameters.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Testing Hypothesis for Two Population Parameters
[book](pdf/book08.pdf){target="_blank"}
[eStat YouTube Channel](https://www.youtube.com/channel/UCw2Rzl9A4rXMcT8ue8GH3IA){target="_blank"}
**CHAPTER OBJECTIVES**
In Chapter 7, we discussed how to test hypotheses about parameters in a
single population.
In this chapter, we discuss testing hypothesis to compare population
parameters of two populations.
Section 8.1 discusses a t-test for testing hypothesis of two population
means when samples are independent and when samples are paired.
Section 8.2 discusses a F-test for testing hypothesis of two population
variances.
Section 8.3 discusses a Z-test for testing hypothesis of two population
proportions when samples are large enough.
:::
:::
## Testing Hypothesis for Two Population Means
::: presentation-video-link
[presentation](pdf/080101.pdf){.presentation-link target="_blank"}
[video](https://youtu.be/S21BDljaOKM){.video-link target="_blank"}
:::
::: mainTable
There are many examples comparing means of two populations as follows:
::: textL30M10
- Is there a difference between the starting salary of male graduates
and of female graduates in this year's college graduates?
- Is there a difference in the weight of the products produced in the
two production lines?
- Did the special training for typists to increase the speed of typing
really bring about an increase in the speed of typing?
:::
As such, a comparison of the two population means ( and ) is possible by
testing hypothesis that the difference in the population means is
greater than, or less than, or equal to zero. The comparison of two
population means differs depending on whether samples are extracted
independently from each population or not (referred to as paired
samples).
:::
### Two Independent Samples
::: mainTable
Generally, testing hypothesis for two population means can be divided
into three types, depending on the type of the alternative hypothesis as
follows. $$
\begin{multline}
\shoveleft 1)\quad H_0 : \mu_1 - \mu_2 = D_0 \qquad H_1 : \mu_1 - \mu_2 \gt D_0 \\
\shoveleft 2)\quad H_0 : \mu_1 - \mu_2 = D_0 \qquad H_1 : \mu_1 - \mu_2 \lt D_0 \\
\shoveleft 3)\quad H_0 : \mu_1 - \mu_2 = D_0 \qquad H_1 : \mu_1 - \mu_2 \ne D_0 \\
\end{multline}
$$ Here $D_0$ is the value for the difference in population means
to be tested.
When samples are selected independently from each other in the
population, the estimator of the difference of the population means
$\mu_1 - \mu_2$ is the difference in sample means
${\overline x}_1 - {\overline x}_2$. The sampling distribution of all
possible sample mean differences is approximately a normal distribution
with the mean $\mu_1 - \mu_2$ and variance
$\frac{\sigma^2_1}{n_1} + \frac{\sigma^2_2}{n_2}$ if both sample sizes
are large enough.
Since the population variances $\sigma^2_1$ and $\sigma^2_2$ are usually
unknown, estimates of these variances, $s^2_1$ and $s^2_2$, are used to
test the hypothesis. The test statistic differs slightly depending on
the assumption of two population variances. If two populations follow
normal distributions and their variances can be assumed the same, the
testing hypothesis for the difference of two population means uses the
following statistic. $$
\frac { ({\overline x}_1 - {\overline x}_2 ) - D_0 }{\sqrt{\frac{s^2_p}{n_1} +\frac{s^2_p}{n_2} } }
\qquad \text{where } s^2_p = \frac{(n_1 -1 )s^2_1 + (n_2 -1)s^2_2}{n_1 + n_2 -2}
$$ $s^2_p$ is an estimator of the population variance called as a
**pooled variance** which is an weighted average of two sample variances
$s^2_1$ and $s^2_2$ by using the sample sizes as weights when population
variances are assumed to be the same.
The above statistic follows a $t$-distribution with $n_1 + n_2 -2$
degrees of freedom and it is used to test the difference of two
population means as follows:
Table 8.1.1 Testing hypothesis of two population means\
- independent samples, populations are normal distributions, two
population variances are assumed to be equal
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Type of Hypothesis Decision Rule
----------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------
1\) $\; H_0 : \mu_1 - \mu_2 = D_0$\ If $\frac { ({\overline x}_1 - {\overline x}_2 ) - D_0 }{\sqrt{\frac{s^2_p}{n_1} +\frac{s^2_p}{n_2} } } > t_{n_1 + n_2 -2; α}$, then reject
$\quad\,\, H_1 : \mu_1 - \mu_2 > D_0$ $H_0$, else accept $H_0$
2\) $\; H_0 : \mu_1 - \mu_2 = D_0$\ If $\frac { ({\overline x}_1 - {\overline x}_2 ) - D_0 }{\sqrt{\frac{s^2_p}{n_1} +\frac{s^2_p}{n_2} } } < - t_{n_1 + n_2 -2; α}$, then reject
$\quad\,\, H_1 : \mu_1 - \mu_2 < D_0$ $H_0$, else accept $H_0$
3\) $\; H_0 : \mu_1 - \mu_2 = D_0$\ If
$\quad\,\, H_1 : \mu_1 - \mu_2 \ne D_0$ $\left | \frac { ({\overline x}_1 - {\overline x}_2 ) - D_0 }{\sqrt{\frac{s^2_p}{n_1} +\frac{s^2_p}{n_2} } } \right | > t_{n_1 + n_2 -2; α/2}$,
then reject $H_0$, else accept $H_0$
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note: If sample sizes are large enough ($n_1 > 30, n_2 >30$),
$t$-distribution is approximately close to the standard normal
distribution and the decision rule may use the standard normal
distribution.
:::
::: mainTableGrey
**Example 8.1.1** Two machines produce cookies at a factory and the
average weight of a cookie bag should be 270g. Cookie bags were sampled
from each of two machines to examine the weight of the cookie bag. The
average weight of 15 cookie bags extracted from the machine 1 was 275g
and their standard deviation was 12g, and the average weight of 14
cookie bags extracted from the machine 2 was 269g and the standard
deviation was 10g. Test whether weights of cookie bags produced by two
machines are different at the 1% significance level. Check the test
result using 『eStatU』.
**Answer**
The hypothesis of this problem is
$\small H_0 : \mu_1 = \mu_2 ,\, H_1 : \mu_1 \ne \mu_2$. Hence the
decision rule is as follows. $$ \small
\begin{multline}
\shoveleft '\text{If } \left | \frac { ({\overline x}_1 - {\overline x}_2 ) - D_0 }{\sqrt{\frac{s^2_p}{n_1} +\frac{s^2_p}{n_2} } } \right | > t_{n_1 + n_2 -2; α/2} , \text{ then reject } H_0 ’ \\
\end{multline}
$$ where $\small D_0 = 0$ and the information in this example can
be summarized as follows. $$ \small
\begin{multline}
\shoveleft n_1 = 15,\quad \overline x_1 = 275,\quad s_1 = 12 \\
\shoveleft n_2 = 14,\quad \overline x_2 = 269,\quad s_2 = 10 \\
\end{multline}
$$ Therefore, the calculation of the statistics are as follows.
$$ \small
\begin{multline}
\shoveleft s^2_p = \frac{(n_1 -1 )s^2_1 + (n_2 -1)s^2_2}{n_1 + n_2 -2}
= \frac{(15 - 1 ) 12^2 + (14 - 1) 10^2}{15 + 14 -2} = 122.815 \\
\shoveleft \left | \frac {275 - 269} { \sqrt{\frac{122.815}{15} +\frac{122.815}{14} } } \right | = 1.457 \\
\shoveleft t_{15 + 14 -2; 0.01/2} = t_{27: 0.005} = 2.7707 \\
\end{multline}
$$ Since 1.457 \< 2.7707, $H_0$ can not be rejected.
In 『eStatU』 menu, select 'Testing Hypothesis $\mu_1 , \mu_2$', In the
window shown in [Figure 8.1.1]{.figure-ref}, check the alternative hypothesis of
not equal case at \[Hypothesis\], check the variance assumption of
\[Test Type\] as the equal case, check the significance level of 1%,
check the independent sample, and enter sample sizes $n_1 , n_2$, sample
means $\overline x_1 , \overline x_2$, and sample variances as in
[Figure 8.1.1]{.figure-ref}.
::: width:650
<div>
<input class="qrBtn" onclick="window.open(addrStr[106])" src="QR/eStatU800_TestMu12.svg" type="image"/>
</div>
<div>
![](Figure/Fig080101.png){.imgFig600400}
::: figText
[Figure 8.1.1]{.figure-ref} Testing hypothesis for two population means using
『eStatU』
:::
</div>
:::
Click the [Execute]{.button-ref} button will show the result of testing hypothesis
as [Figure 8.1.2]{.figure-ref}.
![](Figure/Fig080102.png){.imgFig600400}
::: figText
[Figure 8.1.2]{.figure-ref} Testing hypothesis for two population means -- case of
the same population variances
:::
:::
::: mainTable
If variances of two populations are different, the test statistic $$
\frac { ({\overline x}_1 - {\overline x}_2 ) - D_0 }{\sqrt{\frac{s^2_1}{n_1} +\frac{s^2_2}{n_2} } }
$$ do not follow a $t$-distribution even if populations are
normally distributed. The testing hypothesis for two population means
when their population variances are different is called a Behrens-Fisher
problem and several methods to solve this problem have been studied. The
Satterthwaite method approximates the degrees of freedom of the
$t$-distribution in the decision rule in [Table 8.1.1]{.table-ref} with $\phi$ as
follows. $$
\phi = \frac { \left( \frac{s_1^2}{n_1} + \frac{s_2^2}{n_2} \right)^2 }
{ \frac { \left( \frac{s_1^2}{n_1} \right)^2 } {n_1 -1} + \frac { \left( \frac{s_2^2}{n_2} \right)^2 } {n_2 -1} }
$$
:::
Table 8.1.2 Testing hypothesis of two population means\
- independent samples, populations are normal distributions, two
population variances are assumed to be different
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Type of Hypothesis Decision Rule
----------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------
1\) $\; H_0 : \mu_1 - \mu_2 = D_0$\ If $\frac { ({\overline x}_1 - {\overline x}_2 ) - D_0 }{\sqrt{\frac{s^2_1}{n_1} +\frac{s^2_2}{n_2} } } > t_{\phi ; α}$, then reject
$\quad\,\, H_1 : \mu_1 - \mu_2 > D_0$ $H_0$, else accept $H_0$
2\) $\; H_0 : \mu_1 - \mu_2 = D_0$\ If $\frac { ({\overline x}_1 - {\overline x}_2 ) - D_0 }{\sqrt{\frac{s^2_1}{n_1} +\frac{s^2_2}{n_2} } } < - t_{\phi ; α}$, then reject
$\quad\,\, H_1 : \mu_1 - \mu_2 < D_0$ $H_0$, else accept $H_0$
3\) $\; H_0 : \mu_1 - \mu_2 = D_0$\ If
$\quad\,\, H_1 : \mu_1 - \mu_2 \ne D_0$ $\left | \frac { ({\overline x}_1 - {\overline x}_2 ) - D_0 }{\sqrt{\frac{s^2_1}{n_1} +\frac{s^2_2}{n_2} } } \right | > t_{\phi ; α/2}$,
then reject $H_0$, else accept $H_0$
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
::: mainTableGrey
**Example 8.1.2** If two population variances are assumed to be
different in [Example 8.1.1]{.example-ref}, test whether weights of cookie bags
produced from two machines are equal or not at a 1% significance level.
Check the test result using 『eStatU』.
**Answer**
Since the population variances are different, the degrees of freedom of
distribution is approximated as follows: $$ \small
\begin{multline}
\shoveleft \phi = \frac { \left( \frac{12^2}{15} + \frac{10^2}{14} \right)^2 }
{ \frac { \left( \frac{12^2}{15} \right)^2 } {15 -1} + \frac { \left( \frac{10^2}{14} \right)^2 } {14 - 1} } = 26.67 \\
\shoveleft t_{26.7; 0.01/2} = 2.773 \\
\end{multline}
$$ Since 1.457 \< 2.773, $H_0$ can not be rejected.
In order to practice using 『eStatU』, select the different population
variances assumption of \[Test Type\] in the window of [Figure 8.1.1]{.figure-ref}
and click the [Execute]{.button-ref} button to see the result as shown in \<Figure
8.1.3\>.
![](Figure/Fig080102.png){.imgFig600400}
::: figText
[Figure 8.1.3]{.figure-ref} Testing hypothesis for two population means -- Case of
two different population variances
:::
:::
::: mainTableGrey
**Example 8.1.3** (Monthly wages by male and female)
Samples of 10 male and female college graduates this year were randomly
taken and their monthly average wages were examined as follows: (Unit
10,000 KRW)
::: textLeft
Male 272 255 278 282 296 312 356 296 302 312\
Female 276 280 369 285 303 317 290 250 313 307\
Ex ⇨ eBook ⇨ EX080103_WageByGender.csv.
:::
Using 『eStat』, answer the following questions.
::: textL20M20
1\) If population variances are assumed to be the same, test the
hypothesis at the 5% significance level whether the average monthly wage
for male and female is the same.
:::
::: textL20M20
2\) If population variances are assumed to be different, test the
hypothesis at the 5% significance level whether the average monthly wage
for male and female is the same.
:::
**Answer**
::: textL20M20
1\) In 『eStat』, enter raw data of gender (M or F) and income as shown
in [Figure 8.1.4]{.figure-ref} on the sheet. This type of data input is similar to
all statistical packages. After entering the data, click the icon for
testing two population means and select 'Analysis Var' as V2 and 'By
Group' variable as V1. A 95% confidence interval graph that compares
sample means of two populations will be displayed as [Figure 8.1.5]{.figure-ref}.
:::
::: width:650
<div>
<input class="qrBtn" onclick="window.open(addrStr[25])" src="QR/EX080103.svg" type="image"/>
</div>
<div>
![](Figure/Fig080104.png){.imgFig150200}
::: figText
[Figure 8.1.4]{.figure-ref} Data input for testing two population means
:::
</div>
:::
![](Figure/Fig080105.png){.imgFig600540}
::: figText
[Figure 8.1.5]{.figure-ref} Dot graph and confidence Intervals by gender for
testing two population means
:::
In the options window as in [Figure 8.1.6]{.figure-ref} located at the below of the
Graph Area, enter the average difference $\small D = 0$ for the desired
test, select the variance assumption $\sigma_1^2 = \sigma_2^2$, select
the 5% significance level and click the \[t-test\] button. Then the
graphical result of testing hypothesis for two population means will be
shown as in [Figure 8.1.7]{.figure-ref} and the test result as in [Figure 8.1.8]{.figure-ref}.
![](Figure/Fig080106.png){.imgFig400100}
::: figText
[Figure 8.1.6]{.figure-ref} Options to test for two population means
:::
![](Figure/Fig080107.png){.imgFig600540}
::: figText
[Figure 8.1.7]{.figure-ref} Testing hypothesis for and -- case of the same
population variances
:::
![](Figure/Fig080108.png){.imgFig600540}
::: figText
[Figure 8.1.8]{.figure-ref} result of testing hypothesis for two population means
if population variances are the same
:::
::: textL20M20
2\) Select the variance assumption $\sigma_1^2 \ne \sigma_2^2$ at the
option window and click \[t-test\] button under the graph to display the
graph of the hypothesis test and the test result table as in \<Figure
8.1.9\> and [Figure 8.1.10]{.figure-ref}.
:::
![](Figure/Fig080109.png){.imgFig600540}
::: figText
[Figure 8.1.9]{.figure-ref} Testing hypothesis for and -- case of the different
population variances
:::
![](Figure/Fig080110.png){.imgFig600540}
::: figText
[Figure 8.1.10]{.figure-ref} result of testing hypothesis for two population means
if population variances are different
:::
:::
::: mainTablePink
::: width:650px
<div>
<input class="qrBtn" onclick="window.open(addrStr[63])" src="QR/PR080101.svg" type="image"/>
</div>
<div>
**Practice 8.1.1** (Oral Cleanliness by Brushing Methods)\
Oral cleanliness scores were examined for 8 samples who are using the
basic brushing method (coded 1) and 7 samples who are using the rotation
method (coded 2). The data are saved at the following location of
『eStat』.
::: {clsss="textLeft"}
Ex ⇨ eBook ⇨ PR080101_ToothCleanByBrushMethod.csv
:::
::: textL20M20
1\) If population variances are the same, test the hypothesis at the 5%
significance level whether scores for both brushing methods are the same
using 『eStat』.
:::
::: textL20M20
2\) If population variances are different, test the hypothesis at the 5%
significance level whether scores for both brushing methods are the same
using 『eStat』.
:::
</div>
:::
:::
::: mainTablePink
### Multiple Choice Exercise
Choose one answer and click Submit button
::: textL30M30
8.1 One professor claims that 'A student who studies in the morning
will get better math score than a student who studies in the evening.'
Assume that $\mu_1$ is the average exam score of students who study in
the morning and $\mu_2$ is the average exam score of students who study
in the evening. What is the null hypothesis of this test?
:::
<form name="Q1">
<label><input name="item" type="radio" value="1"/> \(\mu_1 \gt \mu_2\)</label><br/>
<label><input name="item" type="radio" value="2"/> \(\mu_1 \ge \mu_2\)</label><br/>
<label><input name="item" type="radio" value="3"/> \(\mu_1 \ne \mu_2\)</label><br/>
<label><input name="item" type="radio" value="4"/> \(\mu_1 = \mu_2\)</label><br/>
<p>
<input onclick="radio(8,1,Q1)" type="button" value="Submit"/>
<input id="ansQ1" size="15" type="text"/>
</p></form>
::: textL30M30
8.2 What is the alternative hypothesis of the test of the above question
8.1?
:::
<form name="Q2">
<label><input name="item" type="radio" value="1"/> \(\mu_1 \gt \mu_2\)</label><br/>
<label><input name="item" type="radio" value="2"/> \(\mu_1 \ge \mu_2\)</label><br/>
<label><input name="item" type="radio" value="3"/> \(\mu_1 \ne \mu_2\)</label><br/>
<label><input name="item" type="radio" value="4"/> \(\mu_1 = \mu_2\)</label><br/>
<p>
<input onclick="radio(8,2,Q2)" type="button" value="Submit"/>
<input id="ansQ2" size="15" type="text"/>
</p></form>
::: textL30M30
8.3 A researcher claims that "After age of 40 and over, there is no
difference in weight between male and female." Assume the average weight
of males whose age is 40 and more is $\mu_1$ and the average weight of
females whose age is 40 and more is $\mu_2$. What is the alternative
hypothesis of the test?
:::
<form name="Q3">
<label><input name="item" type="radio" value="1"/> \(\mu_1 = \mu_2\)</label><br/>
<label><input name="item" type="radio" value="2"/> \(\mu_1 \ne \mu_2\)</label><br/>
<label><input name="item" type="radio" value="3"/> \(\mu_1 \gt \mu_2\)</label><br/>
<label><input name="item" type="radio" value="4"/> \(\mu_1 \lt \mu_2\)</label><br/>
<p>
<input onclick="radio(8,3,Q3)" type="button" value="Submit"/>
<input id="ansQ3" size="15" type="text"/>
</p></form>
::: textL30M30
8.4 We want to test whether two population means are equal or not using
t-test. Which one of the following is not a required assumption?
:::
<form name="Q4">
<label><input name="item" type="radio" value="1"/> Populations are normal distributions.</label><br/>
<label><input name="item" type="radio" value="2"/> Two population variances are the same.</label><br/>
<label><input name="item" type="radio" value="3"/> Samples are selected independently.</label><br/>
<label><input name="item" type="radio" value="4"/> Samples are collected using cluster sampling method.</label><br/>
<p>
<input onclick="radio(8,4,Q4)" type="button" value="Submit"/>
<input id="ansQ4" size="15" type="text"/>
</p></form>
::: textL30M30
8.5 Which sampling distribution is used to test whether two population
means are equal or not when sample sizes are small?
:::
<form name="Q5">
<label><input name="item" type="radio" value="1"/> Normal distribution </label><br/>
<label><input name="item" type="radio" value="2"/> \(t\)-distribution</label><br/>
<label><input name="item" type="radio" value="3"/> chi-square distribution</label><br/>
<label><input name="item" type="radio" value="4"/> \(F\)-distribution</label><br/>
<p>
<input onclick="radio(8,5,Q5)" type="button" value="Submit"/>
<input id="ansQ5" size="15" type="text"/>
</p></form>
:::
:::
:::
### Paired Sample
::: presentation-video-link
[presentation](pdf/080102.pdf){.presentation-link target="_blank"}
[video](https://youtu.be/LmjMNOvDB7A){.video-link target="_blank"}
:::
::: mainTable
The testing hypothesis for two population means in the previous section
is based on two samples extracted independently from each population.
However, in some cases it is difficult to extract samples independently,
or if samples are extracted independently, then the resulting analysis
may be meaningless, because characteristics of each sample differ too
much.
For example, you want to give typists a special education to increase
the speed of typing and want to see if this training has been effective
in the speed of typing. In this case, if different samples are extracted
before and after education, it is difficult to measure the effectiveness
of education, because individual differences are severe. In order to
overcome the individual difference for a typist who has sampled before
training education, if you measure the typing speed before and after the
training for the typist, the effect of special education can be well
understood.
A hypothesis test that uses same samples to perform similar experiments
to compare means of two populations is called a paired comparison. In
the paired comparison, we calculate the difference ($d_i$) between
paired data $x_{i1}$ and $x_{i2}$ as shown in [Table 8.1.3]{.table-ref} and obtain the
mean of differences ($\overline d$) and variance of differences
($s_{d}^2$).
Table 8.1.3 Data for a paired comparison
-----------------------------------------------------------------------------------------------------
Sample of population 1\ Sample of population 2\ Difference of pair\
$x_{i1}$ $x_{i2}$ $d_{i} = x_{i1} - x{i2}$
----------------------- ----------------------- -----------------------------------------------------
$x_{11}$\ $x_{12}$\ $d_1 = x_{11} - x_{12}$\
$x_{21}$\ $x_{22}$\ $d_2 = x_{21} - x_{22}$\
$\cdots$\ $\cdots$\ $\cdots$\
$x_{n1}$ $x_{n2}$ $d_n = x_{n1} - x_{n2}$
Mean of $d_i$ : $\overline d = \frac{1}{n} \sum d_i$\
Variance of $d_i$ :
$s_d^2 = \frac{1}{n-1} \sum (d_i - \overline d )^2$
-----------------------------------------------------------------------------------------------------
When two populations of normal distributions have the same mean, the
sample statistic $\frac{\overline d}{\frac{s_d}{\sqrt{n}}}$ follows a
$t$-distribution with the $n-1$ degrees of freedom. It allows the
testing of the difference between two population means in case of the
paired comparison as follows.
:::
Table 8.1.4 Testing hypothesis of two population means (paired
comparison)\
- two populations are normal distributions, and paired sample case
-----------------------------------------------------------------------------------------------------------------------------
Type of Hypothesis Decision Rule
----------------------------------------- -----------------------------------------------------------------------------------
1\) $\; H_0 : \mu_1 - \mu_2 = D_0$\ If $\frac{\overline d - D_0}{\frac{s_d}{\sqrt{n}}} > t_{n-1; α}$, then reject
$\quad\,\, H_1 : \mu_1 - \mu_2 > D_0$ $H_0$, else accept $H_0$
2\) $\; H_0 : \mu_1 - \mu_2 = D_0$\ If $\frac{\overline d - D_0}{\frac{s_d}{\sqrt{n}}} < - t_{n-1; α}$, then reject
$\quad\,\, H_1 : \mu_1 - \mu_2 < D_0$ $H_0$, else accept $H_0$
3\) $\; H_0 : \mu_1 - \mu_2 = D_0$\ If
$\quad\,\, H_1 : \mu_1 - \mu_2 \ne D_0$ $\left | \frac{\overline d - D_0}{\frac{s_d}{\sqrt{n}}} \right | > t_{n-1; α/2}$,
then reject $H_0$, else accept $H_0$
-----------------------------------------------------------------------------------------------------------------------------
::: mainTableGrey
**Example 8.1.4** The following is the result of a special training to
improve the typing speed of eight typists before and after the training.
Test whether or not the typing speed has increased at the 5%
significance level. Assume that the speed of typing follows a normal
distribution. Check the test result using 『eStat』 and 『eStatU』.
-----------------------------------------------------------------------
id Typing speed\ Typing speed\
before training\ after training\
(unit: words/min) (unit: words/min)
----------------------- ----------------------- -----------------------
1\ 52\ 58\
2\ 60\ 62\
3\ 63\ 62\
4\ 43\ 48\
5\ 46\ 50\
6\ 56\ 55\
7\ 62\ 68\
8 50 57
-----------------------------------------------------------------------
**Answer**
This problem is for testing the null hypothesis
$\small H_0 : \mu_1 - \mu_2 = 0$ to the alternative hypothesis
$\small H_1 : \mu_1 - \mu_2 < 0$ to compare the typing speed of typists
before training (population 1) and after training (population 2) using
paired samples. Therefore, the decision rule is as follows. $$ \small
\begin{multline}
\shoveleft \text{If } \frac{\overline d - D_0}{\frac{s_d}{\sqrt{n}}} < - t_{n-1; α}, \text{ then reject } H_0 \\
\end{multline}
$$ Calculated differences ($d_i$) of paired samples before and
after training, the mean ($\overline d$) and standard deviation ($s_d$)
of differences are as follows.
-----------------------------------------------------------------------------
id Typing speed\ Typing speed\ Difference\
before training\ after training\ $d_i$
(unit: words/min) (unit: words/min)
----------------- ----------------- ----------------- -----------------------
1\ 52\ 58\ -6\
2\ 60\ 62\ -2\
3\ 63\ 62\ 1\
4\ 43\ 48\ -5\
5\ 46\ 50\ -4\
6\ 56\ 55\ 1\
7\ 62\ 68\ -6\
8 50 57 -7
Mean of $d_i$ :
$\overline d = -3.5$\
Standard deviation of
$d_i$ : $s_d = 3.16$
-----------------------------------------------------------------------------
The test statistic is as follows: $$ \small
\begin{multline}
\shoveleft \frac{\overline d - D_0}{\frac{s_d}{\sqrt{n}}} = \frac{-3.5}{\frac{3.16}{\sqrt{8}}} \\
\shoveleft - t_{n-1; α} = - t_{8-1: 0.05} = - t_{7: 0.05} = -1.8946 \\
\end{multline}
$$ Therefore, $\small H_0$ is rejected and conclude that the
training increased the typing speed.
In 『eStatU』 menu, select 'Testing Hypothesis: $\mu_1 , \mu_2$', select
the alternative hypothesis at \[Hypothesis\], check the 5% significance
level, check 'paired sample' at \[Test Type\], and enter data of sample
1 and sample 2 of paired samples at \[Sample Data\] as in \<Figure
8.1.11\>.
::: width:650
<div>
<input class="qrBtn" onclick="window.open(addrStr[106])" src="QR/eStatU800_TestMu12.svg" type="image"/>
</div>
<div>
![](Figure/Fig080111.png){.imgFig600400}
::: figText
[Figure 8.1.11]{.figure-ref} Testing hypothesis for two population means using
『eStatU』 - paired sample
:::
</div>
:::
Click the [Execute]{.button-ref} button to calculate the sample mean and sample
standard deviation of differences ($\overline d$ and $s_d^2$ ) and to
show the result of the hypothesis test as [Figure 8.1.12]{.figure-ref}.
![](Figure/Fig080112.png){.imgFig600400}
::: figText
[Figure 8.1.12]{.figure-ref} Result of testing hypothesis for two population means
using 『eStatU』 - paired sample
:::
In 『eStat』, the paired data is entered in two columns as shown in
[Figure 8.1.13]{.figure-ref}. Click the icon for testing two population means and
select 'Analysis Var' as V1 and 'by Group' as V2 to show the dot
graph and the confidence interval for differences of paired data as in
[Figure 8.1.14]{.figure-ref}.
Ex ⇨ eBook ⇨ EX080104_TypingSpeedEducation.csv.
::: width:650
<div>
<input class="qrBtn" onclick="window.open(addrStr[26])" src="QR/EX080104.svg" type="image"/>
</div>
<div>
![](Figure/Fig080113.png){.imgFig150200}
::: figText
[Figure 8.1.13]{.figure-ref} Data input of paired sample
:::
</div>
:::
![](Figure/Fig080114.png){.imgFig600540}
::: figText
[Figure 8.1.14]{.figure-ref} Dot graph of difference data of paired sample
:::
Enter the mean difference $\small D$ = 0 for the desired test in the
options window below the graph, select the 5% significance level, and
press the \[t-test\] button to display the result of the hypothesis test
for paired samples such as [Figure 8.1.15]{.figure-ref} and [Figure 8.1.16]{.figure-ref}.
![](Figure/Fig080115.png){.imgFig600540}
::: figText
[Figure 8.1.15]{.figure-ref} Testing hypothesis for two population means using
『eStat』 - paired sample
:::
![](Figure/Fig080116.png){.imgFig600600}
::: figText
[Figure 8.1.16]{.figure-ref} Result of testing hypothesis for two population means
using 『eStat』 - paired sample
:::
:::
::: mainTablePink
::: width:650px
<div>
<input class="qrBtn" onclick="window.open(addrStr[64])" src="QR/PR080102.svg" type="image"/>
</div>
<div>
**Practice 8.1.2** Randomly sampled data of (wife age, husband age) for
8 couples are as follows.
::: textLeft
(28, 28) (29, 30) (18, 21) (29, 33) (22, 22) (18, 21) (40, 35) (24, 29)
:::
::: textLeft
Ex ⇨ eBook ⇨ PR080102_CoupleAge.csv.
:::
Test whether the population mean of wife's age is the same as the
population mean husband's age or not. Use the significance level of
0.05.
</div>
:::
:::
::: mainTablePink
### Multiple Choice Exercise
Choose one answer and click Submit button
::: textL30M30
8.6 16 couples are randomly selected to compare their ages as follows:
What is the name of this kind of data?
:::
::: textLeft
(woman age, man age)
:::
::: textLeft
(28, 28) (29, 30) (18, 21) (29, 33) (22, 22) (18, 21) (40, 35) (24, 29)
:::
::: textLeft
(21, 31) (20, 24) (20, 34) (23, 25) (33, 39) (33, 35) (40, 29) (39, 40)
:::
<form name="Q6">
<label><input name="item" type="radio" value="1"/> independent data</label><br/>
<label><input name="item" type="radio" value="2"/> paired data</label><br/>
<label><input name="item" type="radio" value="3"/> random data</label><br/>
<label><input name="item" type="radio" value="4"/> cluster data</label><br/>
<p>
<input onclick="radio(8,6,Q6)" type="button" value="Submit"/>
<input id="ansQ6" size="15" type="text"/>
</p></form>
:::
:::
:::
## Testing Hypothesis for Two Population Variances
::: presentation-video-link
[presentation](pdf/0802.pdf){.presentation-link target="_blank"}
[video](https://youtu.be/y5x9ZOQ-F0o){.video-link target="_blank"}
:::
::: mainTable
Consider following examples to compare two population variances.
::: textL30M10
- When comparing two population means in the previous section, we
studied that if the sample size was small, the decision rule for testing
hypothesis were different depending on whether two population variances
were the same or different. So how can we test if two population
variances are the same?
- The quality of bolts used to assemble cars depends on the strict
specification for their diameters. Average diameters of bolts produced
by two factories were said to be the same and if the variance of
diameters is smaller, it is considered as superior production. How can
you compare variances of the diameter?
:::
When comparing variances ($\sigma_1^2$ and $\sigma_2^2$) of two
populations, the ratio ($\frac{\sigma_1^2}{\sigma_2^2}$) of variances is
calculated instead of comparing the difference in variances. If the
ratio of variances is greater, smaller, or equal to 1, you can see that
$\sigma_1^2$ is greater, smaller, or equal to $\sigma_2^2$. The reason
for using the ratio of variances instead of the difference of variances
is that it is easy to find the sampling distribution of the ratio of
variances mathematically. If two populations follow normal
distributions, and if $n_1$ and $n_2$ samples are collected randomly
from each population, the ratio of two sample variances $S_1^2$ and
$S_2^2$ such as $$
\frac{ \left( \frac{S_1^2}{\sigma_1^2} \right) } { \left( \frac{S_2^2}{\sigma_2^2} \right) }
$$ follows a $F$-distribution with the numerator degrees of
freedom $n_1 - 1$ and the denominator degrees of freedom $n_2 - 1$.
Using this fact, we can perform testing hypothesis on the ratio of
population variances.
$F$-distribution is an asymmetrical distribution group with two
parameters, the numerator degrees of freedom and denominator degrees of
freedom. [Figure 8.2.1]{.figure-ref} shows $F$-distributions for different
parameters.
![](Figure/Fig080201.png){.imgFig400300}
::: figText
[Figure 8.2.1]{.figure-ref} $F$-distribution of different degrees of freedom.
:::
Testing hypothesis for two population variances can be performed using
the $F$-distribution as following [Table 8.2.1]{.table-ref}.
:::
Table 8.2.1 Testing hypothesis for two population variances\
- Two populations are normally distributed -
--------------------------------------------------------------------------------------------------
Type of Hypothesis Decision Rule
--------------------------------------------- ----------------------------------------------------
1\) $\; H_0 : \sigma_1^2 = \sigma_2^2$\ If $\frac {S_1^2}{S_2^2} > F_{n_1 -1, n_2 -1; α}$,
$\quad\,\, H_1 : \sigma_1^2 \gt \sigma_2^2$ then reject $H_0$, else accept $H_0$
2\) $\; H_0 : \sigma_1^2 = \sigma_2^2$\ If $\frac {S_1^2}{S_2^2} < F_{n_1 -1, n_2 -1; 1-α}$,
$\quad\,\, H_1 : \sigma_1^2 \lt \sigma_2^2$ then reject $H_0$, else accept $H_0$
3\) $\; H_0 : \sigma_1^2 = \sigma_2^2$\ If
$\quad\,\, H_1 : \sigma_1^2 \ne \sigma_2^2$ $\frac {S_1^2}{S_2^2} < F_{n_1 -1, n_2 -1; 1-α/2}$
or $\frac {S_1^2}{S_2^2} > F_{n_1 -1, n_2 -1; α/2}$,
then reject $H_0$, else accept $H_0$
--------------------------------------------------------------------------------------------------
::: mainTableGrey
**Example 8.2.1** A company that produces a bolt has two plants. One
day, ten bolts produced in Plant 1 were sampled randomly and the
variance of diameter was $0.11^2$. 12 bolts produced in Plant 2 were
sampled randomly and the variance of diameter was $0.13^2$. Test whether
variances of the bolt from two plants are the same or not with the 5%
significance level. Check the test result using 『eStatU』.
**Answer**
The hypothesis of this problem is
$\small H_0 : \sigma_1^2 = \sigma_2^2 ,\; H_1 : \sigma_1^2 \ne \sigma_2^2$,
and its decision rule is as follows: $$ \small
\begin{multline}
\shoveleft \text{If } \frac {S_1^2}{S_2^2} < F_{n_1 -1, n_2 -1; 1-α/2} \text{ or }
\frac {S_1^2}{S_2^2} > F_{n_1 -1, n_2 -1; α/2} \text{ then reject } H_0
\end{multline}
$$ The test statistic using two sample variances and the
percentile of $\small F$-distribution is as follows. $$ \small
\begin{multline}
\shoveleft \frac {S_1^2}{S_2^2} = \frac{0.0121}{0.0169} = 0.716 \\
\shoveleft F_{n_1 -1, n_2 -1; 1-α/2} = F_{11,9;0.975} = 0.279 \\
\shoveleft F_{n_1 -1, n_2 -1; α/2} = F_{11,9;0.025} = 3.912 \\
\end{multline}
$$ Hence the hypothesis $\small H_0$ can not be rejected and
conclude that two variances are equal.
In 『eStatU』 menu, select 'Testing Hypothesis
$\sigma_1^2 , \sigma_2^2$. At the window shown in [Figure 8.2.2]{.figure-ref},
enter $n_1 = 12, n_2 = 10, s_1^2 = 0.0121, s_2^2 = 0.0169$. Click the
[Execute]{.button-ref} button to reveal the hypothesis test result shown in
[Figure 8.2.3]{.figure-ref}.
::: width:650
<div>
<input class="qrBtn" onclick="window.open(addrStr[107])" src="QR/eStatU820_TestSigma12.svg" type="image"/>
</div>
<div>
![](Figure/Fig080202.png){.imgFig600400}
::: figText
[Figure 8.2.2]{.figure-ref} Data input for testing hypothesis of two population
variances using 『eStatU』
:::
</div>
:::
![](Figure/Fig080203.svg){.imgFig600400}
::: figText
[Figure 8.2.3]{.figure-ref} Testing hypothesis for two population variances using
『eStatU』
:::
:::
::: mainTableGrey
**Example 8.2.2** (Income of college graduates, data of \[Example
8.1.3\])
Samples of 10 male and 10 female graduates of the college this year were
taken and the average monthly income were examined as follows: Test
whether variances of two populations are equal.
::: textLeft
Male 272 255 278 282 296 312 356 296 302 312
:::
::: textLeft
Female 276 280 369 285 303 317 290 250 313 307 (Unit 10000 KRW)
:::
::: textLeft
Ex ⇨ eBook ⇨ EX080103_WageByGender.csv.
:::
**Answer**
In 『eStat』, enter the gender and income in two columns on the sheet as
shown in [Figure 8.2.4]{.figure-ref}. This type of data input is similar to all
statistical packages. Once you entered the data, click on the icon for
testing two population variances and select 'Analysis Var' as V2 and
'By Groups' as V1. Then a mean-standard deviation graph for each group
will be appeared as in [Figure 8.2.5]{.figure-ref}.
::: width:650
<div>
<input class="qrBtn" onclick="window.open(addrStr[123])" src="QR/EX080202.svg" type="image"/>
</div>