1 00:00:15,580 --> 00:00:19,700 In general, the regression equation is given by 2 00:00:19,700 --> 00:00:26,460 this equation. Y represents the dependent variable 3 00:00:26,460 --> 00:00:30,680 for each observation I. Beta 0 is called 4 00:00:30,680 --> 00:00:35,280 population Y intercept. Beta 1 is the population 5 00:00:35,280 --> 00:00:39,400 slope coefficient. Xi is the independent variable 6 00:00:39,400 --> 00:00:44,040 for each observation, I. Epsilon I is the random 7 00:00:44,040 --> 00:00:48,420 error term. Beta 0 plus beta 1 X is called 8 00:00:48,420 --> 00:00:53,410 linear component. While Y and I are random error 9 00:00:53,410 --> 00:00:57,130 components. So, the regression equation mainly has 10 00:00:57,130 --> 00:01:01,970 two components. One is linear and the other is 11 00:01:01,970 --> 00:01:05,830 random. In general, the expected value for this 12 00:01:05,830 --> 00:01:08,810 error term is zero. So, for the predicted 13 00:01:08,810 --> 00:01:12,410 equation, later we will see that Y hat equals B 14 00:01:12,410 --> 00:01:15,930 zero plus B one X. This term will be ignored 15 00:01:15,930 --> 00:01:19,770 because the expected value for the epsilon equals 16 00:01:19,770 --> 00:01:20,850 zero. 17 00:01:36,460 --> 00:01:43,580 So again linear component B0 plus B1 X I and the 18 00:01:43,580 --> 00:01:46,860 random component is the epsilon term. 19 00:01:48,880 --> 00:01:53,560 So if we have X and Y axis, this segment is called 20 00:01:53,560 --> 00:01:57,620 Y intercept which is B0. The change in y divided 21 00:01:57,620 --> 00:02:01,480 by change in x is called the slope. Epsilon i is 22 00:02:01,480 --> 00:02:04,480 the difference between the observed value of y 23 00:02:04,480 --> 00:02:10,400 minus the expected value or the predicted value. 24 00:02:10,800 --> 00:02:14,200 The observed is the actual value. So actual minus 25 00:02:14,200 --> 00:02:17,480 predicted, the difference between these two values 26 00:02:17,480 --> 00:02:20,800 is called the epsilon. So epsilon i is the 27 00:02:20,800 --> 00:02:24,460 difference between the observed value of y for x, 28 00:02:25,220 --> 00:02:28,820 minus the predicted or the estimated value of Y 29 00:02:28,820 --> 00:02:33,360 for XR. So this difference actually is called the 30 00:02:33,360 --> 00:02:36,920 error term. So the error is just observed minus 31 00:02:36,920 --> 00:02:38,240 predicted. 32 00:02:40,980 --> 00:02:44,540 The estimated regression equation is given by Y 33 00:02:44,540 --> 00:02:50,210 hat equals V0 plus V1X. As I mentioned before, the 34 00:02:50,210 --> 00:02:53,450 epsilon term is cancelled because the expected 35 00:02:53,450 --> 00:02:57,590 value for the epsilon equals zero. Here, we have y 36 00:02:57,590 --> 00:03:00,790 hat instead of y because this one is called the 37 00:03:00,790 --> 00:03:05,670 estimated or the predicted value for y for the 38 00:03:05,670 --> 00:03:09,670 observation i. For example, b zero is the estimated 39 00:03:09,670 --> 00:03:12,590 value of the regression intercept, or is called y 40 00:03:12,590 --> 00:03:18,030 intercept. B one is the estimate of the regression of 41 00:03:18,030 --> 00:03:21,930 the slope, so this is the estimated slope b1 xi. 42 00:03:21,930 --> 00:03:26,270 Again, is the independent variable, so x1 it means 43 00:03:26,270 --> 00:03:28,630 the value of the independent variable for 44 00:03:28,630 --> 00:03:31,350 observation number one. Now this equation is 45 00:03:31,350 --> 00:03:34,530 called linear regression equation or regression 46 00:03:34,530 --> 00:03:37,230 model. It's a straight line because here, we are 47 00:03:37,230 --> 00:03:41,170 assuming that the relationship between x and y is 48 00:03:41,170 --> 00:03:43,490 linear. It could be non-linear, but we are 49 00:03:43,490 --> 00:03:48,760 focusing here on just linear regression. Now, the 50 00:03:48,760 --> 00:03:52,000 values for B0 and B1 are given by these equations, 51 00:03:52,920 --> 00:03:56,480 B1 equals RSY divided by SX. So, in order to 52 00:03:56,480 --> 00:04:01,040 determine the values of B0 and B1, we have to know 53 00:04:01,040 --> 00:04:07,760 first the value of R, the correlation coefficient. 54 00:04:16,640 --> 00:04:24,980 Sx and Sy, standard deviations of x and y, as well 55 00:04:24,980 --> 00:04:29,880 as the means of x and y. 56 00:04:32,920 --> 00:04:39,500 B1 equals R times Sy divided by Sx. B0 is just y 57 00:04:39,500 --> 00:04:43,600 bar minus b1 x bar, where Sx and Sy are the 58 00:04:43,600 --> 00:04:48,350 standard deviations of x and y. So this, how can 59 00:04:48,350 --> 00:04:53,190 we compute the values of B0 and B1? Now the 60 00:04:53,190 --> 00:04:59,350 question is, what's our interpretation about B0 61 00:04:59,350 --> 00:05:05,030 and B1? And B0, as we mentioned before, is the Y 62 00:05:05,030 --> 00:05:10,510 or the estimated mean value of Y when the value X 63 00:05:10,510 --> 00:05:10,910 is 0. 64 00:05:17,420 --> 00:05:22,860 So if X is 0, then Y hat equals B0. That means B0 65 00:05:22,860 --> 00:05:26,420 is the estimated mean value of Y when the value of 66 00:05:26,420 --> 00:05:32,280 X equals 0. B1, which is called the estimated 67 00:05:32,280 --> 00:05:36,880 change in the mean value of Y as a result of one 68 00:05:36,880 --> 00:05:42,360 unit change in X. That means the sign of B1, 69 00:05:48,180 --> 00:05:55,180 the direction of the relationship between X and Y. 70 00:06:03,020 --> 00:06:09,060 So the sine of B1 tells us the exact direction. It 71 00:06:09,060 --> 00:06:12,300 could be positive if the sine of B1 is positive, or 72 00:06:12,300 --> 00:06:17,040 negative. On the other side. So that's the meaning 73 00:06:17,040 --> 00:06:22,040 of B0 and B1. Now the first thing we have to do in 74 00:06:22,040 --> 00:06:23,980 order to determine if there exists linear 75 00:06:23,980 --> 00:06:26,800 relationship between X and Y, we have to draw 76 00:06:26,800 --> 00:06:30,620 a scatter plot, Y versus X. In this specific 77 00:06:30,620 --> 00:06:34,740 example, X is the square feet, size of the house 78 00:06:34,740 --> 00:06:38,760 is measured by square feet, and house selling 79 00:06:38,760 --> 00:06:43,220 price in thousand dollars. So we have to draw Y 80 00:06:43,220 --> 00:06:47,420 versus X. So house price versus size of the house. 81 00:06:48,140 --> 00:06:50,740 Now, by looking carefully at this scatter plot, 82 00:06:51,340 --> 00:06:54,200 even if it's a small sample size, but you can see 83 00:06:54,200 --> 00:06:57,160 that there exists a positive relationship between 84 00:06:57,160 --> 00:07:02,640 house price and size of the house. The points 85 00:07:03,750 --> 00:07:06,170 maybe they are close, a little bit to the straight 86 00:07:06,170 --> 00:07:08,370 line, it means there exists, maybe a strong 87 00:07:08,370 --> 00:07:11,350 relationship between X and Y. But you can tell the 88 00:07:11,350 --> 00:07:15,910 exact strength of the relationship by using the 89 00:07:15,910 --> 00:07:19,270 value of R. But here we can tell that there exists 90 00:07:19,270 --> 00:07:22,290 a positive relationship, and that relation could be 91 00:07:22,290 --> 00:07:23,250 strong. 92 00:07:25,730 --> 00:07:31,350 Now, simple calculations will give B1 and B0. 93 00:07:32,210 --> 00:07:37,510 Suppose we know the values of R, Sy, and Sx. R, if 94 00:07:37,510 --> 00:07:41,550 you remember last time, R was 0.762. It's moderate 95 00:07:41,550 --> 00:07:46,390 relationship between X and Y. Sy and Sx, 60 96 00:07:46,390 --> 00:07:52,350 divided by 4 is 117. That will give 0.109. So B0, 97 00:07:53,250 --> 00:07:59,430 in this case, is 0.10977. B1 98 00:08:02,960 --> 00:08:08,720 B0 equals Y bar minus B1 X bar. B1 is computed in 99 00:08:08,720 --> 00:08:12,680 the previous step, so plug that value here. In 100 00:08:12,680 --> 00:08:15,440 addition, we know the values of X bar and Y bar. 101 00:08:15,980 --> 00:08:19,320 Simple calculation will give the value of B0, 102 00:08:19,400 --> 00:08:25,340 which is about 98.25. After computing the values 103 00:08:25,340 --> 00:08:30,600 of B0 and B1, we can state the regression equation 104 00:08:30,600 --> 00:08:34,360 by house price. The estimated value of house 105 00:08:34,360 --> 00:08:39,960 price, hat in this equation means the estimated or 106 00:08:39,960 --> 00:08:43,860 the predicted value of the house price. Equals b0 107 00:08:43,860 --> 00:08:49,980 which is 98 plus b1, which is 0.10977 times square 108 00:08:49,980 --> 00:08:54,420 feet. Now here, by using this equation, we can 109 00:08:54,420 --> 00:08:58,280 tell number one, the direction of the relationship 110 00:08:58,280 --> 00:09:03,620 between x and y, how surprised and its size. Since 111 00:09:03,620 --> 00:09:05,900 the sign is positive, it means there exists 112 00:09:05,900 --> 00:09:09,000 a positive association or relationship between 113 00:09:09,000 --> 00:09:12,420 these two variables, number one. Number two, we 114 00:09:12,420 --> 00:09:17,060 can interpret carefully the meaning of the 115 00:09:17,060 --> 00:09:21,340 intercept. Now, as we mentioned before, y hat 116 00:09:21,340 --> 00:09:25,600 equals b zero only if x equals zero. Now, there is 117 00:09:25,600 --> 00:09:28,900 no sense about square feet of zero because we 118 00:09:28,900 --> 00:09:32,960 don't have a size of a house to be zero. But the 119 00:09:32,960 --> 00:09:37,880 slope here is 0.109; it has sense because, as the 120 00:09:37,880 --> 00:09:41,450 size of the house increases by one unit, it's 121 00:09:41,450 --> 00:09:46,290 selling price increased by this amount, 0.109. But 122 00:09:46,290 --> 00:09:48,990 here, you have to be careful to multiply this value 123 00:09:48,990 --> 00:09:52,610 by a thousand because the data is given in 124 00:09:52,610 --> 00:09:56,830 thousand dollars for Y. So, here, as the size of the 125 00:09:56,830 --> 00:10:00,590 house increased by one unit, by one foot, one square 126 00:10:00,590 --> 00:10:05,310 foot, its selling price increases by this amount, 0 127 00:10:05,310 --> 00:10:10,110 .10977. It should be multiplied by a thousand, so 128 00:10:10,110 --> 00:10:18,560 around $109.77. So that means, extra one square 129 00:10:18,560 --> 00:10:24,040 foot for the size of the house, it cost you around 130 00:10:24,040 --> 00:10:30,960 $100 or $110. So, that's the meaning of B1 and the 131 00:10:30,960 --> 00:10:35,060 sign actually of the slope. In addition to that, 132 00:10:35,140 --> 00:10:39,340 we can make some predictions about house price for 133 00:10:39,340 --> 00:10:42,900 any given value of the size of the house. That 134 00:10:42,900 --> 00:10:46,940 means, if you know that the house size equals 2,000 135 00:10:46,940 --> 00:10:50,580 square feet, so just plug this value here, and 136 00:10:50,580 --> 00:10:54,100 simple calculation will give the predicted value 137 00:10:54,100 --> 00:10:58,230 of the selling price of a house. That's the whole 138 00:10:58,230 --> 00:11:03,950 story for the simple linear regression. In other 139 00:11:03,950 --> 00:11:08,030 words, we have this equation, so the 140 00:11:08,030 --> 00:11:12,690 interpretation of B0 again. B0 is the estimated 141 00:11:12,690 --> 00:11:16,110 mean value of Y when the value of X is 0. That 142 00:11:16,110 --> 00:11:20,700 means if X is 0, in this range of the observed X 143 00:11:20,700 --> 00:11:24,540 values. That's the meaning of the B0. But again, 144 00:11:24,820 --> 00:11:27,700 because a house cannot have a square footage of 145 00:11:27,700 --> 00:11:31,680 zero, so B0 has no practical application. 146 00:11:34,740 --> 00:11:38,760 On the other hand, the interpretation for B1, B1 147 00:11:38,760 --> 00:11:43,920 equals 0.10977, that means B1 again estimates the 148 00:11:43,920 --> 00:11:46,880 change in the mean value of Y as a result of one 149 00:11:46,880 --> 00:11:51,160 unit increase in X. In other words, since B1 150 00:11:51,160 --> 00:11:55,680 equals 0.10977, that tells us that the mean value 151 00:11:55,680 --> 00:12:02,030 of a house increases by this amount, multiplied by 152 00:12:02,030 --> 00:12:05,730 1,000 on average for each additional one square 153 00:12:05,730 --> 00:12:09,690 foot of size. So that's the exact interpretation 154 00:12:09,690 --> 00:12:14,630 about P0 and P1. For the prediction, as I 155 00:12:14,630 --> 00:12:18,430 mentioned, since we have this equation, and our 156 00:12:18,430 --> 00:12:21,530 goal is to predict the price for a house with 2 157 00:12:21,530 --> 00:12:25,450 ,000 square feet, just plug this value here. 158 00:12:26,450 --> 00:12:31,130 Multiply this value by 0.1098, then add the result 159 00:12:31,130 --> 00:12:37,750 to 98.25. This will give 317.85. This value should be 160 00:12:37,750 --> 00:12:41,590 multiplied by 1000, so the predicted price for a 161 00:12:41,590 --> 00:12:49,050 house with 2,000 square feet is around 317,850 162 00:12:49,050 --> 00:12:54,910 dollars. That's for making the prediction for 163 00:12:54,910 --> 00:13:02,050 selling a price. The last section in chapter 12 164 00:13:02,050 --> 00:13:07,550 talks about the coefficient of determination R 165 00:13:07,550 --> 00:13:11,550 squared. The definition for the coefficient of 166 00:13:11,550 --> 00:13:16,190 determination is the portion of the total 167 00:13:16,190 --> 00:13:19,330 variation in the dependent variable that is 168 00:13:19,330 --> 00:13:21,730 explained by the variation in the independent 169 00:13:21,730 --> 00:13:25,130 variable. Since we have two variables X and Y. 170 00:13:29,510 --> 00:13:34,490 And the question is, what's the portion of the 171 00:13:34,490 --> 00:13:39,530 total variation that can be explained by X? So, the 172 00:13:39,530 --> 00:13:42,030 question is, what's the portion of the total 173 00:13:42,030 --> 00:13:46,070 variation in Y that is explained already by the 174 00:13:46,070 --> 00:13:54,450 variation in X? For example, suppose R² is 90%, 0 175 00:13:54,450 --> 00:13:59,770 .90. That means 90% in the variation of the 176 00:13:59,770 --> 00:14:05,700 selling price is explained by its size. That means 177 00:14:05,700 --> 00:14:12,580 the size of the house contributes about 90% to 178 00:14:12,580 --> 00:14:17,700 explain the variability of the selling price. So 179 00:14:17,700 --> 00:14:20,460 we would like to have R squared to be large 180 00:14:20,460 --> 00:14:26,620 enough. Now, R squared for simple regression only 181 00:14:26,620 --> 00:14:30,200 is given by this equation, correlation between X 182 00:14:30,200 --> 00:14:31,100 and Y squared. 183 00:14:34,090 --> 00:14:36,510 So, if we have the correlation between X and Y, and 184 00:14:36,510 --> 00:14:40,070 then you just square this value, that will give 185 00:14:40,070 --> 00:14:42,370 the correlation or the coefficient of 186 00:14:42,370 --> 00:14:45,730 determination. So simply, the determination 187 00:14:45,730 --> 00:14:49,510 coefficient is just the square of the correlation 188 00:14:49,510 --> 00:14:54,430 between X and Y. We know that R ranges between 189 00:14:54,430 --> 00:14:55,670 minus 1 and plus 1. 190 00:14:59,150 --> 00:15:05,590 So, R squared should be ranges between 0 and 1, 191 00:15:06,050 --> 00:15:09,830 because the minus sign will be cancelled, since we are 192 00:15:09,830 --> 00:15:12,77 223 00:17:28,410 --> 00:17:32,510 squared is 90%, it means some, not all, the 224 00:17:32,510 --> 00:17:35,830 variation Y is explained by the variation X. And 225 00:17:35,830 --> 00:17:38,590 the remaining percent in this case, which is 10%, 226 00:17:38,590 --> 00:17:42,790 this one due to, as I mentioned, maybe there 227 00:17:42,790 --> 00:17:46,490 exists some other variables that affect the 228 00:17:46,490 --> 00:17:52,020 selling price besides its size, maybe location of 229 00:17:52,020 --> 00:17:57,900 the house affects its selling price. So R squared 230 00:17:57,900 --> 00:18:02,640 is always between 0 and 1, it's always positive. R 231 00:18:02,640 --> 00:18:07,180 squared equals 0, that only happens if there is no 232 00:18:07,180 --> 00:18:12,620 linear relationship between Y and X. Since R is 0, 233 00:18:13,060 --> 00:18:17,240 then R squared equals 0. That means the value of Y 234 00:18:17,240 --> 00:18:20,870 does not depend on X. Because here, as X 235 00:18:20,870 --> 00:18:26,830 increases, Y stays nearly in the same position. It 236 00:18:26,830 --> 00:18:30,190 means as X increases, Y stays the same, constant. 237 00:18:31,010 --> 00:18:33,730 So that means there is no relationship or actually 238 00:18:33,730 --> 00:18:37,010 there is no linear relationship because it could 239 00:18:37,010 --> 00:18:40,710 be there exists non-linear relationship. But here 240 00:18:40,710 --> 00:18:44,980 we are. Just focusing on linear relationship 241 00:18:44,980 --> 00:18:50,020 between X and Y. So if R is zero, that means the 242 00:18:50,020 --> 00:18:52,400 value of Y does not depend on the value of X. So 243 00:18:52,400 --> 00:18:58,360 as X increases, Y is constant. Now for the 244 00:18:58,360 --> 00:19:03,620 previous example, R was 0.7621. To determine the 245 00:19:03,620 --> 00:19:06,760 coefficient of determination, One more time, 246 00:19:07,460 --> 00:19:11,760 square this value, that's only valid for simple 247 00:19:11,760 --> 00:19:14,980 linear regression. Otherwise, you cannot square 248 00:19:14,980 --> 00:19:17,580 the value of R in order to determine the 249 00:19:17,580 --> 00:19:20,820 coefficient of determination. So again, this is 250 00:19:20,820 --> 00:19:26,420 only true for 251 00:19:26,420 --> 00:19:29,980 simple linear regression. 252 00:19:35,460 --> 00:19:41,320 So R squared is 0.7621 squared will give 0.5808. 253 00:19:42,240 --> 00:19:46,120 Now, the meaning of this value, first you have to 254 00:19:46,120 --> 00:19:53,280 multiply this by 100. So 58.08% of the variation 255 00:19:53,280 --> 00:19:57,440 in house prices is explained by the variation in 256 00:19:57,440 --> 00:20:05,190 square feet. So 58, around 0.08% of the variation 257 00:20:05,190 --> 00:20:12,450 in size of the house, I'm sorry, in the price is 258 00:20:12,450 --> 00:20:16,510 explained by 259 00:20:16,510 --> 00:20:25,420 its size. So size by itself. Size only explains 260 00:20:25,420 --> 00:20:30,320 around 50-80% of the selling price of a house. Now 261 00:20:30,320 --> 00:20:35,000 the remaining percent which is around, this is the 262 00:20:35,000 --> 00:20:38,860 error, or the remaining percent, this one is due 263 00:20:38,860 --> 00:20:50,040 to other variables, other independent variables. 264 00:20:51,200 --> 00:20:53,820 That might affect the change of price. 265 00:21:04,840 --> 00:21:11,160 But since the size of the house explains 58%, that 266 00:21:11,160 --> 00:21:15,660 means it's a significant variable. Now, if we add 267 00:21:15,660 --> 00:21:19,250 more variables, to the regression equation for 268 00:21:19,250 --> 00:21:23,950 sure this value will be increased. So maybe 60 or 269 00:21:23,950 --> 00:21:28,510 65 or 67 and so on. But 60% or 50 is more enough 270 00:21:28,510 --> 00:21:31,870 sometimes. But R squared, as R squared increases, 271 00:21:32,090 --> 00:21:35,530 it means we have good fit of the model. That means 272 00:21:35,530 --> 00:21:41,230 the model is accurate to determine or to make some 273 00:21:41,230 --> 00:21:46,430 prediction. So that's for the coefficient of 274 00:21:46,430 --> 00:21:58,350 determination. Any question? So we covered simple 275 00:21:58,350 --> 00:22:01,790 linear regression model. We know now how can we 276 00:22:01,790 --> 00:22:06,390 compute the values of B0 and B1. We can state or 277 00:22:06,390 --> 00:22:10,550 write the regression equation, and we can do some 278 00:22:10,550 --> 00:22:14,370 interpretation about P0 and P1, making 279 00:22:14,370 --> 00:22:21,530 predictions, and make some comments about the 280 00:22:21,530 --> 00:22:27,390 coefficient of determination. That's all. So I'm 281 00:22:27,390 --> 00:22:31,910 going to stop now, and I will give some time to 282 00:22:31,910 --> 00:22:33,030 discuss some practice.