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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847

1
00:00:06,480 --> 00:00:12,100
Last time, I mean Tuesday, we discussed box plots.

2
00:00:12,100 --> 00:00:19,540
and we introduced how can we use box plots to

3
00:00:19,540 --> 00:00:24,160
determine if any point is suspected to be an

4
00:00:24,160 --> 00:00:28,280
outlier by using the lower limit and upper limit.

5
00:00:29,460 --> 00:00:32,980
And we mentioned last time that if any point is

6
00:00:32,980 --> 00:00:38,580
below the lower limit or is above the upper limit,

7
00:00:39,200 --> 00:00:43,000
that point is considered to be an outlier. So

8
00:00:43,000 --> 00:00:46,940
that's one of the usage of the boxplot. I mean,

9
00:00:47,000 --> 00:00:51,360
for this specific example, we mentioned last time

10
00:00:51,360 --> 00:00:56,910
27 is an outlier. And also here you can tell also

11
00:00:56,910 --> 00:01:02,770
the data are right skewed because the right tail

12
00:01:02,770 --> 00:01:06,090
is much longer than the left tail. I mean

13
00:01:06,090 --> 00:01:10,450
the distance between or from the median and the

14
00:01:10,450 --> 00:01:14,150
maximum value is bigger or larger than the

15
00:01:14,150 --> 00:01:16,950
distance from the median to the smallest value.

16
00:01:17,450 --> 00:01:20,870
That means the data is not symmetric, it's quite

17
00:01:20,870 --> 00:01:24,050
skewed to the right. In this case, you cannot use

18
00:01:24,050 --> 00:01:29,370
the mean or the range as a measure of spread and

19
00:01:29,370 --> 00:01:31,730
median and, I'm sorry, mean as a measure of

20
00:01:31,730 --> 00:01:36,130
central tendency. Because these measures are affected by

21
00:01:36,130 --> 00:01:39,450
outliers. In this case, you have to use the median

22
00:01:39,450 --> 00:01:43,690
instead of the mean and IQR instead of the range

23
00:01:43,690 --> 00:01:48,090
because IQR is the mid-spread of the data because

24
00:01:48,090 --> 00:01:52,790
we just take the range from Q3 to Q1. That means

25
00:01:52,790 --> 00:01:57,450
we ignore the data below Q1 and data after Q3.

26
00:01:57,970 --> 00:02:01,370
That means IQR is not affected by outliers and it's

27
00:02:01,370 --> 00:02:04,610
better to use it instead of R, of the range.

28
00:02:07,470 --> 00:02:10,950
If the data has an outlier, it's better just to

29
00:02:10,950 --> 00:02:13,990
make a star or circle for the box plot because

30
00:02:13,990 --> 00:02:17,250
this one mentioned that that point is an outlier.

31
00:02:18,390 --> 00:02:21,390
Sometimes an outlier is the maximum value or the largest

32
00:02:21,390 --> 00:02:25,000
value you have. Sometimes maybe the minimum value.

33
00:02:25,520 --> 00:02:28,480
So it depends on the data. For this example, 27,

34
00:02:28,720 --> 00:02:33,360
which was the maximum, is an outlier. But zero is

35
00:02:33,360 --> 00:02:36,520
not an outlier in this case, because zero is above

36
00:02:36,520 --> 00:02:41,500
the lower limit. Let's move to the next topic,

37
00:02:42,140 --> 00:02:48,060
which talks about covariance and correlation.

38
00:02:48,960 --> 00:02:51,740
Later, we'll talk in more details about

39
00:02:53,020 --> 00:02:56,060
correlation and regression, that's when maybe

40
00:02:56,060 --> 00:03:02,840
chapter 11 or 12. But here we just show how can we

41
00:03:02,840 --> 00:03:05,420
compute the covariance of the correlation

42
00:03:05,420 --> 00:03:10,220
coefficient and what's the meaning of that value

43
00:03:10,220 --> 00:03:15,840
we have. The covariance means it measures the

44
00:03:15,840 --> 00:03:21,090
strength of the linear relationship between two

45
00:03:21,090 --> 00:03:25,410
numerical variables. That means if the data set is

46
00:03:25,410 --> 00:03:29,770
numeric, I mean if both variables are numeric, in

47
00:03:29,770 --> 00:03:33,050
this case we can use the covariance to measure the

48
00:03:33,050 --> 00:03:38,390
strength of the linear association or relationship

49
00:03:38,390 --> 00:03:42,310
between two numerical variables. Now the formula

50
00:03:42,310 --> 00:03:45,330
is used to compute the covariance given by this

51
00:03:45,330 --> 00:03:52,540
one. It's the summation of the product of xi minus x

52
00:03:52,540 --> 00:03:56,380
bar, yi minus y bar, divided by n minus 1.

53
00:03:59,660 --> 00:04:03,120
So we need first to compute the means of x and y,

54
00:04:03,620 --> 00:04:07,680
then find x minus x bar times y minus y bar, then

55
00:04:07,680 --> 00:04:11,160
sum all of these values, then divide by n minus 1.

56
00:04:12,870 --> 00:04:17,770
The covariance only concerns with the strength of

57
00:04:17,770 --> 00:04:23,370
the relationship. By using the sign of the

58
00:04:23,370 --> 00:04:27,010
covariance, you can tell if there exists a positive

59
00:04:27,010 --> 00:04:31,070
or negative relationship between the two

60
00:04:31,070 --> 00:04:33,710
variables. For example, if the covariance between

61
00:04:33,710 --> 00:04:42,760
x and y is positive, that means x and y move in

62
00:04:42,760 --> 00:04:48,080
the same direction. It means that if X goes up, Y

63
00:04:48,080 --> 00:04:52,260
will go in the same direction. If X goes down, also

64
00:04:52,260 --> 00:04:55,660
Y goes down. For example, suppose we are

65
00:04:55,660 --> 00:04:57,920
interested in the relationship between consumption

66
00:04:57,920 --> 00:05:02,440
and income. We know that if income increases, if

67
00:05:02,440 --> 00:05:07,160
income goes up, if your salary goes up, that means

68
00:05:07,160 --> 00:05:13,510
consumption also will go up. So that means they go

69
00:05:13,510 --> 00:05:18,650
in the same or move in the same direction. So for

70
00:05:18,650 --> 00:05:20,690
sure, the covariance between X and Y should be

71
00:05:20,690 --> 00:05:25,550
positive. On the other hand, if the covariance

72
00:05:25,550 --> 00:05:31,110
between X and Y is negative, that means X goes up.

73
00:05:32,930 --> 00:05:36,370
Y will go to the same, to the opposite direction.

74
00:05:36,590 --> 00:05:40,090
I mean they move to the opposite direction. That means

75
00:05:40,090 --> 00:05:42,230
there exists a negative relationship between X and

76
00:05:42,230 --> 00:05:47,630
Y. For example, your score in statistics, a number

77
00:05:47,630 --> 00:05:55,220
of missing classes. If you miss more classes, it

78
00:05:55,220 --> 00:05:59,860
means your score will go down, so as x increases, y

79
00:05:59,860 --> 00:06:04,820
will go down so there is a positive relationship or

80
00:06:04,820 --> 00:06:08,720
negative relationship between x and y, I mean, x

81
00:06:08,720 --> 00:06:12,020
goes up, the other goes in the same direction

82
00:06:12,020 --> 00:06:16,500
sometimes.

83
00:06:16,500 --> 00:06:21,800
There is no relationship between x and y in

84
00:06:21,800 --> 00:06:24,780
that case, covariance between x and y equals zero.

85
00:06:24,880 --> 00:06:31,320
For example, your score in statistics and your

86
00:06:31,320 --> 00:06:31,700
weight.

87
00:06:34,540 --> 00:06:36,760
It makes sense that there is no relationship

88
00:06:36,760 --> 00:06:42,680
between your weight and your score. In this case,

89
00:06:43,580 --> 00:06:46,760
we are saying x and y are independent. I mean,

90
00:06:46,840 --> 00:06:50,790
they are uncorrelated. Because as one variable

91
00:06:50,790 --> 00:06:56,010
increases, the other may go up or go down. Or

92
00:06:56,010 --> 00:06:59,690
maybe remain constant. So that means there exists no

93
00:06:59,690 --> 00:07:02,390
relationship between the two variables. In that

94
00:07:02,390 --> 00:07:05,950
case, the covariance between x and y equals zero.

95
00:07:06,450 --> 00:07:09,210
Now, by using the covariance, you can determine

96
00:07:09,210 --> 00:07:12,710
the direction of the relationship. I mean, you can

97
00:07:12,710 --> 00:07:14,850
just figure out if the relation is positive or

98
00:07:14,850 --> 00:07:18,980
negative. But you cannot tell exactly the strength

99
00:07:18,980 --> 00:07:22,100
of the relationship. I mean, you cannot tell if

100
00:07:22,100 --> 00:07:27,640
they exist. A strong, moderate, or weak relationship,

101
00:07:27,640 --> 00:07:31,040
just you can tell there exists a positive or

102
00:07:31,040 --> 00:07:33,520
negative or maybe the relationship does not exist

103
00:07:33,520 --> 00:07:36,580
but you cannot tell the exact strength of the

104
00:07:36,580 --> 00:07:40,120
relationship by using the value of the covariance

105
00:07:40,120 --> 00:07:43,060
I mean, the size of the covariance does not tell

106
00:07:43,060 --> 00:07:48,520
anything about the strength, so generally speaking

107
00:07:48,520 --> 00:07:53,150
covariance between x and y measures the strength

108
00:07:53,150 --> 00:07:58,590
of two numerical variables, and you only tell if

109
00:07:58,590 --> 00:08:01,270
there exists a positive or negative relationship,

110
00:08:01,770 --> 00:08:04,510
but you cannot tell anything about the strength of

111
00:08:04,510 --> 00:08:06,910
the relationship. Any questions?

112
00:08:09,610 --> 00:08:15,210
So let me ask you just to summarize what I said so

113
00:08:15,210 --> 00:08:21,100
far. Just give me the summary or conclusion of

114
00:08:21,100 --> 00:08:24,670
the covariance. The value of the covariance

115
00:08:24,670 --> 00:08:26,810
determines if the relationship between the

116
00:08:26,810 --> 00:08:29,410
variables is positive or negative, or there is no

117
00:08:29,410 --> 00:08:31,970
relationship, that when the covariance is more than

118
00:08:31,970 --> 00:08:34,170
zero, the meaning is that it's positive, the

119
00:08:34,170 --> 00:08:36,930
relationship is positive and one variable goes up,

120
00:08:37,290 --> 00:08:39,590
another goes up and vice versa. And when the

121
00:08:39,590 --> 00:08:41,810
covariance is less than zero, there is a negative

122
00:08:41,810 --> 00:08:44,250
relationship, and the meaning is that when one

123
00:08:44,250 --> 00:08:47,490
variable goes up, the other goes down, and vice versa.

124
00:08:47,490 --> 00:08:50,550
And when the covariance equals zero, there is no

125
00:08:50,550 --> 00:08:53,350
relationship between the variables. And what's

126
00:08:53,350 --> 00:08:54,930
about the strength?

127
00:08:57,950 --> 00:09:03,450
So it just tells the direction, not the strength of

128
00:09:03,450 --> 00:09:08,610
the relationship. Now, in order to determine both

129
00:09:08,610 --> 00:09:12,110
the direction and the strength, we can use the

130
00:09:12,110 --> 00:09:17,580
coefficient of correlation. The coefficient of

131
00:09:17,580 --> 00:09:20,320
correlation measures the relative strength of the

132
00:09:20,320 --> 00:09:22,780
linear relationship between two numerical

133
00:09:22,780 --> 00:09:27,940
variables. The simplest formula that can be used

134
00:09:27,940 --> 00:09:31,220
to compute the correlation coefficient is given by

135
00:09:31,220 --> 00:09:34,440
this one. Maybe this is the easiest formula you

136
00:09:34,440 --> 00:09:38,060
can use. I mean, it's a shortcut formula for

137
00:09:38,060 --> 00:09:40,860
computation. There are many other formulas to

138
00:09:40,860 --> 00:09:44,490
compute the correlation. This one is the easiest

139
00:09:44,490 --> 00:09:52,570
one. R is just the sum of xy minus n, n is the sample

140
00:09:52,570 --> 00:09:57,570
size, times x bar is the sample mean, y bar is the

141
00:09:57,570 --> 00:10:01,090
sample mean for y, because here we have two

142
00:10:01,090 --> 00:10:06,250
variables, divided by the square root, don't forget

143
00:10:06,250 --> 00:10:11,490
the square root, of two quantities. One concerns

144
00:10:11,490 --> 00:10:15,710
for x and the other for y. The first one, sum of x

145
00:10:15,710 --> 00:10:18,850
squared minus nx bar squared. The other one is

146
00:10:18,850 --> 00:10:21,830
similar, just for the other variable, sum y

147
00:10:21,830 --> 00:10:26,090
squared minus ny bar squared. So in order to

148
00:10:26,090 --> 00:10:28,650
determine the value of R, we need,

149
00:10:32,170 --> 00:10:35,890
suppose for example, we have x and y, then x and

150
00:10:35,890 --> 00:10:36,110
y.

151
00:10:40,350 --> 00:10:44,730
x is called an explanatory

152
00:10:44,730 --> 00:10:54,390
variable and

153
00:10:54,390 --> 00:11:04,590
y is called a response variable

154
00:11:04,590 --> 00:11:07,970
sometimes x is called an independent

155
00:11:21,760 --> 00:11:25,320
For example, suppose we are talking about

156
00:11:25,320 --> 00:11:32,280
consumption and

157
00:11:32,280 --> 00:11:36,700
income. And we are interested in the relationship

158
00:11:36,700 --> 00:11:41,360
between these two variables. Now, except for the

159
00:11:41,360 --> 00:11:44,900
variable or the independent variable, this one affects the

160
00:11:44,900 --> 00:11:49,840
other variable. As we mentioned, as your income

161
00:11:49,840 --> 00:11:53,800
increases, your consumption will go in the same

162
00:11:53,800 --> 00:11:59,580
direction, increasing also. Income causes Y, or

163
00:11:59,580 --> 00:12:04,340
income affects Y. In this case, income is your X.

164
00:12:06,180 --> 00:12:07,780
Most of the time, we use

165
00:12:10,790 --> 00:12:15,590
X for the independent variable. So in this case, the

166
00:12:15,590 --> 00:12:19,370
response variable or your outcome or the dependent

167
00:12:19,370 --> 00:12:23,110
variable is your consumption. So Y is consumption,

168
00:12:23,530 --> 00:12:29,150
X is income. So now in order to determine the

169
00:12:29,150 --> 00:12:32,950
correlation coefficient, we have the data of X and

170
00:12:32,950 --> 00:12:33,210
Y.

171
00:12:36,350 --> 00:12:39,190
The values of X, I mean, the number of pairs of X

172
00:12:39,190 --> 00:12:41,990
should be equal to the number of pairs of Y. So if

173
00:12:41,990 --> 00:12:44,930
we have ten observations for X, we should have the

174
00:12:44,930 --> 00:12:50,010
same number of observations for Y. It's pairs: X1,

175
00:12:50,090 --> 00:12:54,750
Y1, X2, Y2, and so on. Now, the formula to compute

176
00:12:54,750 --> 00:13:04,170
R, the shortcut formula is the sum of XY minus N times

177
00:13:04,970 --> 00:13:09,630
x bar, y bar, divided by the square root of two

178
00:13:09,630 --> 00:13:12,770
quantities. The first one, sum of x squared minus

179
00:13:12,770 --> 00:13:17,270
n x bar squared. The other one, sum of y squared minus ny

180
00:13:17,270 --> 00:13:21,710
y squared. So the first thing we have to do is to

181
00:13:21,710 --> 00:13:24,210
find the mean for each x and y.

182
00:13:28,230 --> 00:13:37,210
So the first step, compute x bar and y bar. Next, if

183
00:13:37,210 --> 00:13:41,690
you look here, we have x and y, x times y. So we

184
00:13:41,690 --> 00:13:48,870
need to compute the product of x times y. So just

185
00:13:48,870 --> 00:13:53,870
for example, suppose x is 10, y is 5. So x times y

186
00:13:53,870 --> 00:13:54,970
is 50.

187
00:13:57,810 --> 00:13:59,950
In addition to that, you have to compute

188
00:14:06,790 --> 00:14:12,470
x squared and y squared. It's like 125.

189
00:14:14,810 --> 00:14:18,870
Do the same calculations for the rest of the data

190
00:14:18,870 --> 00:14:22,290
you have. We have other data here, so we have to

191
00:14:22,290 --> 00:14:25,410
compute the same for the others.

192
00:14:28,470 --> 00:14:33,250
Then finally, just add xy, x squared, y squared.

193
00:14:35,910 --> 00:14:40,830
The values you have here in this formula, in order

194
00:14:40,830 --> 00:14:44,830
to compute the coefficient.

195
00:14:54,250 --> 00:15:00,070
Now, this value ranges between minus one and plus

196
00:15:00,070 --> 00:15:00,370
one.

197
00:15:06,520 --> 00:15:10,80

223
00:17:13,090 --> 00:17:13,690
coefficient?

224
00:17:17,010 --> 00:17:23,210
We said last time outliers affect the mean, the 

225
00:17:23,210 --> 00:17:28,310
range, the variance. Now the question is, do 

226
00:17:28,310 --> 00:17:33,510
outliers affect the correlation?

227
00:17:37,410 --> 00:17:38,170
Y.

228
00:17:43,830 --> 00:17:51,330
Exactly. The formula for R has X bar in it or Y 

229
00:17:51,330 --> 00:17:56,670
bar. So it means outliers affect 

230
00:17:56,670 --> 00:18:01,210
the correlation coefficient. So the answer is yes.

231
00:18:03,470 --> 00:18:06,410
Here we have x bar and y bar. Also, there is 

232
00:18:06,410 --> 00:18:10,690
another formula to compute R. That formula is 

233
00:18:10,690 --> 00:18:13,370
given by covariance between x and y.

234
00:18:17,510 --> 00:18:21,930
These two formulas are quite similar. I mean, by 

235
00:18:21,930 --> 00:18:26,070
using this one, we can end with this formula. So 

236
00:18:26,070 --> 00:18:33,090
this formula depends on this x is y. standard 

237
00:18:33,090 --> 00:18:36,170
deviations of X and Y. That means outlier will 

238
00:18:36,170 --> 00:18:42,530
affect the correlation coefficient. So in case of 

239
00:18:42,530 --> 00:18:45,670
outliers, R could be changed.

240
00:18:51,170 --> 00:18:55,530
That formula is called simple correlation 

241
00:18:55,530 --> 00:18:58,790
coefficient. On the other hand, we have population 

242
00:18:58,790 --> 00:19:02,200
correlation coefficient. If you remember last 

243
00:19:02,200 --> 00:19:08,940
time, we used X bar as the sample mean and mu as 

244
00:19:08,940 --> 00:19:14,460
population mean. Also, S square as sample variance 

245
00:19:14,460 --> 00:19:18,740
and sigma square as population variance. Here, R 

246
00:19:18,740 --> 00:19:24,360
is used as sample coefficient of correlation and 

247
00:19:24,360 --> 00:19:29,420
rho, this Greek letter pronounced as rho. Rho is 

248
00:19:29,420 --> 00:19:35,160
used for population coefficient of correlation.

249
00:19:37,640 --> 00:19:42,040
There are some features of R or Rho. The first one 

250
00:19:42,040 --> 00:19:47,960
is unity-free. R or Rho is unity-free. That means 

251
00:19:47,960 --> 00:19:54,900
if X represents...

252
00:19:54,900 --> 00:19:58,960
And let's assume that the correlation between X 

253
00:19:58,960 --> 00:20:02,040
and Y equals 0.75.

254
00:20:04,680 --> 00:20:07,260
Now, in this case, there is no unity. You cannot 

255
00:20:07,260 --> 00:20:13,480
say 0.75 years or 0.75 kilograms. It's unity-free.

256
00:20:13,940 --> 00:20:17,840
There is no unit for the correlation coefficient, 

257
00:20:18,020 --> 00:20:21,120
the same as Cv. If you remember Cv, the 

258
00:20:21,120 --> 00:20:24,320
coefficient of correlation, also this one is unity 

259
00:20:24,320 --> 00:20:30,500
-free. The second feature of R ranges between 

260
00:20:30,500 --> 00:20:36,740
minus one and plus one. As I mentioned, R lies 

261
00:20:36,740 --> 00:20:42,340
between minus one and plus one. Now, by using the 

262
00:20:42,340 --> 00:20:48,100
value of R, you can determine two things. Number 

263
00:20:48,100 --> 00:20:53,360
one, we can determine the direction. and strength 

264
00:20:53,360 --> 00:20:56,940
by using the sign you can determine if there 

265
00:20:56,940 --> 00:21:03,980
exists positive or negative so sign of R determine 

266
00:21:03,980 --> 00:21:08,040
negative or positive relationship the direction 

267
00:21:08,040 --> 00:21:17,840
the absolute value of R I mean absolute of R I 

268
00:21:17,840 --> 00:21:21,980
mean ignore the sign So the absolute value of R 

269
00:21:21,980 --> 00:21:24,100
determines the strength.

270
00:21:27,700 --> 00:21:30,760
So by using the sine of R, you can determine the 

271
00:21:30,760 --> 00:21:35,680
direction, either positive or negative. By using 

272
00:21:35,680 --> 00:21:37,740
the absolute value, you can determine the 

273
00:21:37,740 --> 00:21:43,500
strength. We can split the strength into two 

274
00:21:43,500 --> 00:21:52,810
parts, either strong, moderate, or weak. So weak, 

275
00:21:53,770 --> 00:21:59,130
moderate, and strong by using the absolute value 

276
00:21:59,130 --> 00:22:03,870
of R. The closer to minus one, if R is close to 

277
00:22:03,870 --> 00:22:07,010
minus one, the stronger the negative relationship 

278
00:22:07,010 --> 00:22:09,430
between X and Y. For example, imagine 

279
00:22:22,670 --> 00:22:26,130
And as we mentioned, R ranges between minus 1 and 

280
00:22:26,130 --> 00:22:26,630
plus 1.

281
00:22:30,070 --> 00:22:35,710
So if R is close to minus 1, it's a strong 

282
00:22:35,710 --> 00:22:41,250
relationship. Strong linked relationship. The 

283
00:22:41,250 --> 00:22:45,190
closer to 1, the stronger the positive 

284
00:22:45,190 --> 00:22:49,230
relationship. I mean, if R is close. Strong 

285
00:22:49,230 --> 00:22:54,480
positive. So strong in either direction, either to 

286
00:22:54,480 --> 00:22:57,640
the left side or to the right side. Strong 

287
00:22:57,640 --> 00:23:00,280
negative. On the other hand, there exists strong 

288
00:23:00,280 --> 00:23:05,940
negative relationship. Positive. Positive. If R is 

289
00:23:05,940 --> 00:23:10,640
close to zero, weak. Here we can say there exists 

290
00:23:10,640 --> 00:23:15,940
weak relationship between X and Y.

291
00:23:19,260 --> 00:23:25,480
If R is close to 0.5 or 

292
00:23:25,480 --> 00:23:32,320
minus 0.5, you can say there exists positive 

293
00:23:32,320 --> 00:23:38,840
-moderate or negative-moderate relationship. So 

294
00:23:38,840 --> 00:23:42,200
you can split or you can divide the strength of 

295
00:23:42,200 --> 00:23:44,540
the relationship between X and Y into three parts.

296
00:23:45,860 --> 00:23:50,700
Strong, close to minus one of Plus one, weak, 

297
00:23:51,060 --> 00:23:59,580
close to zero, moderate, close to 0.5. 0.5 is 

298
00:23:59,580 --> 00:24:04,580
halfway between 0 and 1, and minus 0.5 is also 

299
00:24:04,580 --> 00:24:09,040
halfway between minus 1 and 0. Now for example, 

300
00:24:09,920 --> 00:24:15,580
what's about if R equals minus 0.5? Suppose R1 is 

301
00:24:15,580 --> 00:24:16,500
minus 0.5.

302
00:24:20,180 --> 00:24:27,400
strong negative or equal minus point eight strong 

303
00:24:27,400 --> 00:24:33,540
negative which is more strong nine nine because 

304
00:24:33,540 --> 00:24:39,670
this value is close closer to minus one than Minus 

305
00:24:39,670 --> 00:24:44,070
0.8. Even this value is greater than minus 0.9, 

306
00:24:44,530 --> 00:24:50,870
but minus 0.9 is close to minus 1, more closer to 

307
00:24:50,870 --> 00:24:56,910
minus 1 than minus 0.8. On the other hand, if R 

308
00:24:56,910 --> 00:25:01,190
equals 0.75, that means there exists positive 

309
00:25:01,190 --> 00:25:06,970
relationship. If R equals 0.85, also there exists 

310
00:25:06,970 --> 00:25:13,540
positive. But R2 is stronger than R1, because 0.85 

311
00:25:13,540 --> 00:25:20,980
is closer to plus 1 than 0.7. So we can say that 

312
00:25:20,980 --> 00:25:23,960
there exists strong relationship between X and Y, 

313
00:25:24,020 --> 00:25:27,260
and this relationship is positive. So again, by 

314
00:25:27,260 --> 00:25:32,530
using the sign, you can tell the direction. The 

315
00:25:32,530 --> 00:25:35,910
absolute value can tell the strength of the 

316
00:25:35,910 --> 00:25:39,870
relationship between X and Y. So there are five 

317
00:25:39,870 --> 00:25:44,150
features of R, unity-free. Ranges between minus 

318
00:25:44,150 --> 00:25:47,750
one and plus one. Closer to minus one, it means 

319
00:25:47,750 --> 00:25:51,950
stronger negative. Closer to plus one, stronger 

320
00:25:51,950 --> 00:25:56,410
positive. Close to zero, it means there is no 

321
00:25:56,410 --> 00:26:00,790
relationship. Or the weaker, the relationship 

322
00:26:00,790 --> 00:26:13,240
between X and Y. By using scatter plots, we 

323
00:26:13,240 --> 00:26:18,160
can construct a scatter plot by plotting the Y 

324
00:26:18,160 --> 00:26:24,060
values versus the X values. Y in the vertical axis 

325
00:26:24,060 --> 00:26:28,400
and X in the horizontal axis. If you look 

326
00:26:28,400 --> 00:26:34,500
carefully at graph number one and three, We see 

327
00:26:34,500 --> 00:26:42,540
that all the points lie on the straight line, 

328
00:26:44,060 --> 00:26:48,880
either this way or the other way. If all the 

329
00:26:48,880 --> 00:26:52,320
points lie on the straight line, it means they 

330
00:26:52,320 --> 00:26:56,970
exist perfectly. not even strong it's perfect 

331
00:26:56,970 --> 00:27:02,710
relationship either negative or positive so this 

332
00:27:02,710 --> 00:27:07,530
one perfect negative negative

333
00:27:07,530 --> 00:27:14,090
because x increases y goes down decline so if x is 

334
00:27:14,090 --> 00:27:19,590
for example five maybe y is supposed to twenty if 

335
00:27:19,590 --> 00:27:25,510
x increased to seven maybe y is fifteen So if X 

336
00:27:25,510 --> 00:27:29,290
increases, in this case, Y declines or decreases, 

337
00:27:29,850 --> 00:27:34,290
it means there exists negative relationship. On 

338
00:27:34,290 --> 00:27:40,970
the other hand, the left corner here, positive 

339
00:27:40,970 --> 00:27:44,710
relationship, because X increases, Y also goes up.

340
00:27:45,970 --> 00:27:48,990
And perfect, because all the points lie on the 

341
00:27:48,990 --> 00:27:52,110
straight line. So it's perfect, positive, perfect, 

342
00:27:52,250 --> 00:27:57,350
negative relationship. So it's straightforward to 

343
00:27:57,350 --> 00:27:59,550
determine if it's perfect by using scatterplot.

344
00:28:02,230 --> 00:28:04,950
Also, by scatterplot, you can tell the direction 

345
00:28:04,950 --> 00:28:09,270
of the relationship. For the second scatterplot, 

346
00:28:09,630 --> 00:28:12,270
it seems to be that there exists negative 

347
00:28:12,270 --> 00:28:13,730
relationship between X and Y.

348
00:28:16,850 --> 00:28:21,030
In this one, also there exists a relationship 

349
00:28:24,730 --> 00:28:32,170
positive which one is strong more strong this 

350
00:28:32,170 --> 00:28:37,110
one is stronger because the points are close to 

351
00:28:37,110 --> 00:28:40,710
the straight line much more than the other scatter 

352
00:28:40,710 --> 00:28:43,410
plot so you can say there exists negative 

353
00:28:43,410 --> 00:28:45,810
relationship but that one is stronger than the 

354
00:28:45,810 --> 00:28:49,550
other one this one is positive but the points are 

355
00:28:49,550 --> 00:28:55,400
scattered around the straight line so you can tell 

356
00:28:55,400 --> 00:29:00,000
the direction and sometimes sometimes not all the 

357
00:29:00,000 --> 00:29:04,640
time you can tell the strength sometimes it's very 

358
00:29:04,640 --> 00:29:07,960
clear that the relation is strong if the points 

359
00:29:07,960 --> 00:29:11,480
are very close straight line that means the 

360
00:29:11,480 --> 00:29:15,940
relation is strong now the other one the last one 

361
00:29:15,940 --> 00:29:23,850
here As X increases, Y stays at the same value.

362
00:29:23,970 --> 00:29:29,450
For example, if Y is 20 and X is 1. X is 1, Y is 

363
00:29:29,450 --> 00:29:33,870
20. X increases to 2, for example. Y is still 20.

364
00:29:34,650 --> 00:29:37,230
So that means there is no relationship between X 

365
00:29:37,230 --> 00:29:41,830
and Y. It's a constant. Y equals a constant value.

366
00:29:42,690 --> 00:29:50,490
Whatever X is, Y will have constant value. So that 

367
00:29:50,490 --> 00:29:54,790
means there is no relationship between X and Y.

368
00:29:56,490 --> 00:30:01,850
Let's see how can we compute the correlation 

369
00:30:01,850 --> 00:30:07,530
between two variables. For example, suppose we 

370
00:30:07,530 --> 00:30:12,150
have data for father's height and son's height.

371
00:30:13,370 --> 00:30:16,510
And we are interested to see if father's height 

372
00:30:16,510 --> 00:30:21,730
affects his son's height. So we have data for 10 

373
00:30:21,730 --> 00:30:28,610
observations here. Father number one, his height 

374
00:30:28,610 --> 00:30:38,570
is 64 inches. And you know that inch equals 2 

375
00:30:38,570 --> 00:30:39,230
.5.

376
00:30:43,520 --> 00:30:52,920
So X is 64, Sun's height is 65. X is 68, Sun's 

377
00:30:52,920 --> 00:30:58,820
height is 67 and so on. Sometimes, if the dataset 

378
00:30:58,820 --> 00:31:02,600
is small enough, as in this example, we have just 

379
00:31:02,600 --> 00:31:08,640
10 observations, you can tell the direction. I 

380
00:31:08,640 --> 00:31:12,060
mean, you can say, yes, for this specific example, 

381
00:31:12,580 --> 00:31:15,280
there exists positive relationship between x and 

382
00:31:15,280 --> 00:31:20,820
y. But if the data set is large, it's very hard to 

383
00:31:20,820 --> 00:31:22,620
figure out if the relation is positive or 

384
00:31:22,620 --> 00:31:26,400
negative. So we have to find or to compute the 

385
00:31:26,400 --> 00:31:29,700
coefficient of correlation in order to see there 

386
00:31:29,700 --> 00:31:32,940
exists positive, negative, strong, weak, or 

387
00:31:32,940 --> 00:31:37,820
moderate. but again you can tell from this simple 

388
00:31:37,820 --> 00:31:40,280
example yes there is a positive relationship 

389
00:31:40,280 --> 00:31:44,660
because just if you pick random numbers here for 

390
00:31:44,660 --> 00:31:49,240
example 64 father's height his son's height 65 if 

391
00:31:49,240 --> 00:31:54,600
we move up here to 70 for father's height his 

392
00:31:54,600 --> 00:32:00,160
son's height is going to be 72 so as father 

393
00:32:00,160 --> 00:32:05,020
heights increases Also, son's height increases.

394
00:32:06,320 --> 00:32:11,700
For example, 77, father's height. His son's height 

395
00:32:11,700 --> 00:32:15,160
is 76. So that means there exists positive 

396
00:32:15,160 --> 00:32:19,740
relationship. Make sense? But again, for large 

397
00:32:19,740 --> 00:32:20,780
data, you cannot tell that.

398
00:32:31,710 --> 00:32:36,090
If, again, by using this data, small data, you can 

399
00:32:36,090 --> 00:32:40,730
determine just the length, the strength, I'm 

400
00:32:40,730 --> 00:32:43,490
sorry, the strength of a relationship or the 

401
00:32:43,490 --> 00:32:47,590
direction of the relationship. Just pick any 

402
00:32:47,590 --> 00:32:51,030
number at random. For example, if we pick this 

403
00:32:51,030 --> 00:32:51,290
number.

404
00:32:55,050 --> 00:33:00,180
Father's height is 68, his son's height is 70. Now 

405
00:33:00,180 --> 00:33:02,180
suppose we pick another number that is greater 

406
00:33:02,180 --> 00:33:05,840
than 68, then let's see what will happen. For 

407
00:33:05,840 --> 00:33:11,060
father's height 70, his son's height increases up 

408
00:33:11,060 --> 00:33:17,160
to 72. Similarly, 72 father's height, his son's 

409
00:33:17,160 --> 00:33:22,060
height 75. So that means X increases, Y also 

410
00:33:22,060 --> 00:33:25,740
increases. So that means there exists both of 

411
00:33:25

445
00:37:34,210 --> 00:37:40,810
So square root, that will give this result. So now 

446
00:37:40,810 --> 00:37:46,990
R equals this value divided by 

447
00:37:49,670 --> 00:37:54,890
155 and round always to two decimal places will

448
00:37:54,890 --> 00:38:05,590
give 87 so r is 87 so first step we have x and y 

449
00:38:05,590 --> 00:38:12,470
compute xy x squared y squared sum of these all of 

450
00:38:12,470 --> 00:38:18,100
these then x bar y bar values are given Then just 

451
00:38:18,100 --> 00:38:20,820
use the formula you have, we'll get R to be at 

452
00:38:20,820 --> 00:38:31,540
seven. So in this case, if we just go back to 

453
00:38:31,540 --> 00:38:33,400
the slide we have here.

454
00:38:36,440 --> 00:38:41,380
As we mentioned, father's height is the 

455
00:38:41,380 --> 00:38:45,640
explanatory variable. Son's height is the response 

456
00:38:45,640 --> 00:38:46,060
variable.

457
00:38:49,190 --> 00:38:52,810
And that simple calculation gives summation of xi, 

458
00:38:54,050 --> 00:38:57,810
summation of yi, summation x squared, y squared, 

459
00:38:57,970 --> 00:39:02,690
and some xy. And finally, we'll get that result,

460
00:39:02,850 --> 00:39:07,850
87%. Now, the sign is positive. That means there

461
00:39:07,850 --> 00:39:13,960
exists positive. And 0.87 is close to 1. That 

462
00:39:13,960 --> 00:39:17,320
means there exists strong positive relationship 

463
00:39:17,320 --> 00:39:22,480
between father's and son's height. I think the 

464
00:39:22,480 --> 00:39:25,060
calculation is straightforward. 

465
00:39:27,280 --> 00:39:33,280
Now, for this example, the data are given in 

466
00:39:33,280 --> 00:39:37,460
inches. I mean father's and son's height in inch.

467
00:39:38,730 --> 00:39:41,050
Suppose we want to convert from inch to

468
00:39:41,050 --> 00:39:44,750
centimeter, so we have to multiply by 2. Do you

469
00:39:44,750 --> 00:39:52,050
think in this case, R will change? So if we add or

470
00:39:52,050 --> 00:39:59,910
multiply or divide, R will not change? I mean, if

471
00:39:59,910 --> 00:40:06,880
we have X values, And we divide or multiply X, I

472
00:40:06,880 --> 00:40:09,460
mean each value of X, by a number, by a fixed

473
00:40:09,460 --> 00:40:12,600
value. For example, suppose here we multiplied

474
00:40:12,600 --> 00:40:19,460
each value by 2.5 for X. Also multiply Y by the

475
00:40:19,460 --> 00:40:24,520
same value, 2.5. Y will be the same. In addition 

476
00:40:24,520 --> 00:40:28,920
to that, if we multiply X by 2.5, for example, and

477
00:40:28,920 --> 00:40:34,960
Y by 5, also R will not change. But you have to be

478
00:40:34,960 --> 00:40:39,400
careful. We multiply each value of x by the same

479
00:40:39,400 --> 00:40:45,700
number. And each value of y by the same number,

480
00:40:45,820 --> 00:40:49,640
that number may be different from x. So I mean

481
00:40:49,640 --> 00:40:56,540
multiply x by 2.5 and y by minus 1 or plus 2 or

482
00:40:56,540 --> 00:41:01,000
whatever you have. But if it's negative, then 

483
00:41:01,000 --> 00:41:05,640
we'll get negative answer. I mean if Y is

484
00:41:05,640 --> 00:41:08,060
positive, for example, and we multiply each value

485
00:41:08,060 --> 00:41:13,000
Y by minus one, that will give negative sign. But 

486
00:41:13,000 --> 00:41:17,640
here I meant if we multiply this value by positive 

487
00:41:17,640 --> 00:41:21,320
sign, plus two, plus three, and let's see how can

488
00:41:21,320 --> 00:41:22,540
we do that by Excel. 

489
00:41:26,320 --> 00:41:31,480
Now this is the data we have. I just make copy.

490
00:41:37,730 --> 00:41:45,190
I will multiply each value X by 2.5. And I will do

491
00:41:45,190 --> 00:41:49,590
the same for Y

492
00:41:49,590 --> 00:41:57,190
value. I will replace this data by the new one. 

493
00:41:58,070 --> 00:42:00,410
For sure the calculations will, the computations 

494
00:42:00,410 --> 00:42:09,740
here will change, but R will stay the same. So

495
00:42:09,740 --> 00:42:14,620
here we multiply each x by 2.5 and the same for y.

496
00:42:15,540 --> 00:42:19,400
The calculations here are different. We have

497
00:42:19,400 --> 00:42:22,960
different sum, different sum of x, sum of y and so 

498
00:42:22,960 --> 00:42:31,040
on, but are the same. Let's see if we multiply 

499
00:42:31,040 --> 00:42:38,880
just x by 2.5 and y the same.

500
00:42:41,840 --> 00:42:49,360
So we multiplied x by 2.5 and we keep it make

501
00:42:49,360 --> 00:42:57,840
sense? Now let's see how outliers will affect the 

502
00:42:57,840 --> 00:43:03,260
value of R. Let's say if we change one point in

503
00:43:03,260 --> 00:43:08,480
the data set support. I just changed 64. 

504
00:43:13,750 --> 00:43:24,350
for example if just by typo and just enter 6 so it

505
00:43:24,350 --> 00:43:33,510
was 87 it becomes 0.7 so there is a big difference 

506
00:43:33,510 --> 00:43:38,670
between 0.87 and 0.7 and just we change one value 

507
00:43:38,670 --> 00:43:45,920
now suppose the other one is zero 82. The other is

508
00:43:45,920 --> 00:43:48,260
2, for example. 1.

509
00:43:53,380 --> 00:43:59,200
I just changed half of the data. Now R was 87, it 

510
00:43:59,200 --> 00:44:02,920
becomes 59. That means these outliers, these 

511
00:44:02,920 --> 00:44:06,180
values for sure are outliers and they fit the

512
00:44:06,180 --> 00:44:07,060
correlation coefficient. 

513
00:44:11,110 --> 00:44:14,970
Now let's see if we just change this 1 to be 200. 

514
00:44:15,870 --> 00:44:20,430
It will go from 50 to up to 63. That means any

515
00:44:20,430 --> 00:44:26,010
changes in x or y values will change the y. But if 

516
00:44:26,010 --> 00:44:30,070
we add or multiply all the values by a constant, r 

517
00:44:30,070 --> 00:44:31,170
will stay the same. 

518
00:44:35,250 --> 00:44:43,590
Any questions? That's the end of chapter 3. I will 

519
00:44:43,590 --> 00:44:48,990
move quickly to the practice problems we have. And 

520
00:44:48,990 --> 00:44:55,270
we posted the practice in the course website.