1 00:00:02,640 --> 00:00:04,520 - [Lecturer] Hello, and welcome to the video 2 00:00:04,520 --> 00:00:07,303 lecture on heteroscedasticity. 3 00:00:11,050 --> 00:00:13,530 I wanted to start with some learning expectations. 4 00:00:13,530 --> 00:00:17,780 So what I expect is for you to be able to 5 00:00:17,780 --> 00:00:22,150 first understand sort of what it means and why it matters, 6 00:00:22,150 --> 00:00:25,770 and what are the implications. 7 00:00:25,770 --> 00:00:29,280 Next, to learn some tests of how to test for it 8 00:00:29,280 --> 00:00:32,770 and then to name some potential solutions 9 00:00:32,770 --> 00:00:35,650 and how to solve it? 10 00:00:35,650 --> 00:00:39,460 What I don't expect is for you to be able to use data 11 00:00:39,460 --> 00:00:44,310 and create these solutions, especially in SPSS. 12 00:00:44,310 --> 00:00:48,480 Frankly SPSS is not particularly 13 00:00:48,480 --> 00:00:51,710 adept at dealing with these issues. 14 00:00:51,710 --> 00:00:56,300 But I do want you to be able to understand it, 15 00:00:56,300 --> 00:00:59,180 to test for it and to know what to do. 16 00:00:59,180 --> 00:01:01,510 And then, if your thesis 17 00:01:01,510 --> 00:01:05,630 or other research requires it, 18 00:01:05,630 --> 00:01:07,050 see me, see your advisor, 19 00:01:07,050 --> 00:01:11,020 you may have to use another software to do so, 20 00:01:11,020 --> 00:01:14,250 but I want you to be able to at least understand it 21 00:01:14,250 --> 00:01:15,883 and know how to deal with it. 22 00:01:19,540 --> 00:01:24,260 Recall back that, one the assumptions 23 00:01:24,260 --> 00:01:27,750 of what I've been calling well behaved data is not, 24 00:01:27,750 --> 00:01:30,020 is spherical errors. 25 00:01:30,020 --> 00:01:34,963 So that's one of the requirements for OLS is BLUE. 26 00:01:36,280 --> 00:01:40,780 Spherical error means that there is a uniform variance 27 00:01:40,780 --> 00:01:43,250 at the variance of the error term 28 00:01:43,250 --> 00:01:46,850 for every individual, regardless of the value of X 29 00:01:46,850 --> 00:01:49,600 is a constant, which we call sigma squared. 30 00:01:49,600 --> 00:01:53,890 And that the errors are not correlated with each other. 31 00:01:53,890 --> 00:01:56,210 That your error and my error 32 00:01:56,210 --> 00:01:58,780 and anybody else's error in the sample 33 00:01:59,860 --> 00:02:04,100 knowing the value of mine doesn't tell anything 34 00:02:04,100 --> 00:02:05,760 about the value of yours. 35 00:02:05,760 --> 00:02:08,760 That they sort of don't have anything to do with each other. 36 00:02:15,020 --> 00:02:19,600 One way of thinking about this mathematically is 37 00:02:20,700 --> 00:02:24,580 to think about the variance, covariance matrix. 38 00:02:24,580 --> 00:02:27,150 This is an N by N matrix. 39 00:02:27,150 --> 00:02:30,820 So N again is the size of your sample. 40 00:02:30,820 --> 00:02:34,900 The diagonals going from the top left 41 00:02:34,900 --> 00:02:38,430 to the bottom right, are the variance. 42 00:02:38,430 --> 00:02:42,260 So with well behaved data, those are sigma squared 43 00:02:42,260 --> 00:02:47,260 and every other value, other than that diagonal is a zero. 44 00:02:48,780 --> 00:02:52,000 So we can say that when we have spherical errors, 45 00:02:52,000 --> 00:02:57,000 the variance, covariance matrix which we call the G matrix, 46 00:02:57,000 --> 00:03:00,810 is sigma squared I, so it has sigma squared 47 00:03:00,810 --> 00:03:05,060 on each of these diagonals going from 48 00:03:05,060 --> 00:03:09,313 top left to bottom right, and zero's everywhere else. 49 00:03:10,580 --> 00:03:12,610 So looking at this G matrix, 50 00:03:12,610 --> 00:03:17,610 if the diagonals are a constant, we have homoscedasticity. 51 00:03:19,580 --> 00:03:20,413 That's good. 52 00:03:20,413 --> 00:03:21,780 That's well behaved data. 53 00:03:21,780 --> 00:03:24,370 OLS is BLUE, we don't have to deal with it. 54 00:03:24,370 --> 00:03:25,993 If it's not a constant, 55 00:03:27,510 --> 00:03:30,900 especially if it's a function of the regressors, 56 00:03:30,900 --> 00:03:33,200 if they change among respondents, 57 00:03:33,200 --> 00:03:37,790 then we have heteroscedasticity and we need to deal with it. 58 00:03:37,790 --> 00:03:42,790 And finally if the off diagonals, 59 00:03:44,740 --> 00:03:47,370 so looking at these three matrices 60 00:03:48,432 --> 00:03:51,630 on the left here, 61 00:03:51,630 --> 00:03:56,630 if there is anything other than zeros in the non diagonals, 62 00:03:58,490 --> 00:04:01,150 then we have what's called auto correlated errors. 63 00:04:01,150 --> 00:04:04,480 And in that, that is where your error 64 00:04:04,480 --> 00:04:08,190 and my error do depend on each other, 65 00:04:08,190 --> 00:04:13,190 that they do have a covariance not equal to zero, 66 00:04:13,620 --> 00:04:16,520 that they are correlated 67 00:04:16,520 --> 00:04:21,233 and will deal with that more down the road, in a few weeks. 68 00:04:26,860 --> 00:04:30,950 If the G matrix is not this sigma squared I, 69 00:04:30,950 --> 00:04:34,923 with a constant on the diagonals and zeros. 70 00:04:36,260 --> 00:04:39,530 Everything else, it's really not OLS anymore. 71 00:04:39,530 --> 00:04:42,860 It's GLS, it's generalized least squares, 72 00:04:42,860 --> 00:04:47,860 and we can come up with a better estimator than OLS. 73 00:04:48,110 --> 00:04:52,600 The good news is that even if you run OLS 74 00:04:52,600 --> 00:04:57,600 with heteroscedasticity and auto correlated errors, 75 00:04:58,370 --> 00:05:02,350 there will be no bias that the OLS estimator 76 00:05:02,350 --> 00:05:06,380 that we've come to use is unbiased, 77 00:05:06,380 --> 00:05:10,013 but there is some bad news, as you may imagine. 78 00:05:12,900 --> 00:05:15,460 The bad news has to do with two things, 79 00:05:15,460 --> 00:05:20,063 first inference, and next efficiency. 80 00:05:27,570 --> 00:05:29,300 The problem with inference 81 00:05:29,300 --> 00:05:33,810 is that the variance of the estimator of OLS, 82 00:05:33,810 --> 00:05:38,320 that formula that we learned is biased. 83 00:05:38,320 --> 00:05:39,710 The variance is biased, 84 00:05:39,710 --> 00:05:41,680 not the actual estimate is biased, 85 00:05:41,680 --> 00:05:46,080 but the variance 86 00:05:46,080 --> 00:05:50,550 and the standard error that you would get in a T-test 87 00:05:50,550 --> 00:05:53,470 in the denominator is biased. 88 00:05:53,470 --> 00:05:57,170 And therefore it's faulty inference that T-tests 89 00:05:57,170 --> 00:05:59,240 and F-tests no longer work. 90 00:05:59,240 --> 00:06:03,420 They no longer give you an accurate representation 91 00:06:03,420 --> 00:06:08,320 of any hypothesis test. 92 00:06:08,320 --> 00:06:12,550 So T-tests and F-tests no longer work 93 00:06:12,550 --> 00:06:15,237 when we have heteroscedasticity. 94 00:06:19,090 --> 00:06:22,280 The other problem is that OLS is no longer blue. 95 00:06:22,280 --> 00:06:25,020 It's not the minimum variance. 96 00:06:25,020 --> 00:06:29,530 And what we do, one of the ways that we fix it 97 00:06:29,530 --> 00:06:34,530 is we try to weigh those residuals with a larger weight, 98 00:06:35,540 --> 00:06:37,157 with a smaller variant 99 00:06:38,506 --> 00:06:41,010 to sort of weigh the outliers small, 100 00:06:41,010 --> 00:06:44,230 weigh the ones with a smaller variance 101 00:06:44,230 --> 00:06:45,730 with a bigger weight. 102 00:06:45,730 --> 00:06:48,500 Note that I said weigh at the beginning, 103 00:06:48,500 --> 00:06:51,463 that OLS weighs everything equally. 104 00:06:58,370 --> 00:06:59,303 So again, 105 00:07:01,930 --> 00:07:03,060 if you use OLS 106 00:07:03,060 --> 00:07:06,340 and the equal weight to every observation, 107 00:07:06,340 --> 00:07:08,340 you're gonna get a bias estimator. 108 00:07:08,340 --> 00:07:10,400 What you do is you weigh them, 109 00:07:10,400 --> 00:07:15,400 which creates a new estimator beta GLS, which is then BLUE. 110 00:07:16,810 --> 00:07:21,653 So there is a more estimator than OLS which is GLS. 111 00:07:29,660 --> 00:07:31,723 So it's important to test. 112 00:07:33,120 --> 00:07:35,910 And again, the reasons is that 113 00:07:35,910 --> 00:07:38,840 you want to be able to do sound inferences 114 00:07:38,840 --> 00:07:42,783 and you in some cases may want a more efficient estimator. 115 00:07:48,590 --> 00:07:51,300 A common approach is to just assume 116 00:07:51,300 --> 00:07:53,900 for now heteroscedasticity. 117 00:07:53,900 --> 00:07:57,260 We assume that we don't have auto correlated errors 118 00:07:57,260 --> 00:08:00,070 that the off diagonals are zero 119 00:08:00,070 --> 00:08:01,623 and we'll deal with this later. 120 00:08:02,820 --> 00:08:07,483 And I gave the example of, 121 00:08:08,420 --> 00:08:13,420 an example would be that as income increases the variance 122 00:08:15,165 --> 00:08:17,740 and an expenditure might also increase. 123 00:08:17,740 --> 00:08:20,240 That someone with a low income, 124 00:08:20,240 --> 00:08:24,690 say on, if we're looking at expenditure of food, 125 00:08:24,690 --> 00:08:27,520 that it doesn't change that much, 126 00:08:27,520 --> 00:08:30,120 that if you can imagine the regression line 127 00:08:32,260 --> 00:08:35,440 with food expenditure on the y-axis 128 00:08:35,440 --> 00:08:38,880 and income on the x-axis for low income folks. 129 00:08:38,880 --> 00:08:43,190 So probably hug the regression line pretty closely 130 00:08:43,190 --> 00:08:45,310 that the amount of money they spend on food 131 00:08:45,310 --> 00:08:46,250 won't change that much, 132 00:08:46,250 --> 00:08:49,463 but for a high income, it might change a great deal. 133 00:08:51,330 --> 00:08:56,220 Some weeks they're buying fancy food and go into restaurants 134 00:08:56,220 --> 00:08:59,683 and eating high off the hog, as we say. 135 00:09:00,567 --> 00:09:02,740 Some weeks or some month, 136 00:09:02,740 --> 00:09:07,730 maybe they made a huge run to the warehouse and stocked up 137 00:09:07,730 --> 00:09:11,590 and have a really well stocked pantry 138 00:09:11,590 --> 00:09:14,580 and don't buy anything that week. 139 00:09:14,580 --> 00:09:17,670 And you can see that maybe the residuals 140 00:09:17,670 --> 00:09:20,700 might be really far away from the line 141 00:09:20,700 --> 00:09:23,720 or the large residuals 142 00:09:23,720 --> 00:09:28,070 and the observations getting farther away from the lines. 143 00:09:28,070 --> 00:09:30,763 So it's important that we test for this. 144 00:09:36,130 --> 00:09:39,600 The first test is just to plot 145 00:09:39,600 --> 00:09:43,370 and is to calculate the residuals 146 00:09:44,440 --> 00:09:47,700 and to plot them versus X. 147 00:09:47,700 --> 00:09:51,190 So is there a relationship, 148 00:09:51,190 --> 00:09:52,413 sort of eyeballing? 149 00:09:53,471 --> 00:09:56,040 It if it's clear that they get bigger, 150 00:09:56,040 --> 00:09:59,290 as X gets bigger or smaller, as X gets bigger, 151 00:09:59,290 --> 00:10:01,800 that's a good test. 152 00:10:01,800 --> 00:10:06,310 And then there are more mathematical tests, 153 00:10:06,310 --> 00:10:10,440 the White tests, and there's a couple version of this 154 00:10:10,440 --> 00:10:12,960 and the Breusch-Pagan test. 155 00:10:12,960 --> 00:10:15,403 And I will talk about each one. 156 00:10:18,770 --> 00:10:21,543 Here are the tests for heteroscedasticity. 157 00:10:22,730 --> 00:10:27,560 So we assume that the first four assumptions hold, 158 00:10:27,560 --> 00:10:30,210 we have this linear model 159 00:10:30,210 --> 00:10:32,643 and our no hypothesis, 160 00:10:33,510 --> 00:10:36,770 with heteroscedasticity is that 161 00:10:36,770 --> 00:10:41,770 the variance of U, given X1 through XK equals a constant 162 00:10:42,760 --> 00:10:43,880 sigma squared. 163 00:10:43,880 --> 00:10:48,050 So if this no holds, we have heteroscedasticity, 164 00:10:48,050 --> 00:10:49,250 then everything is good. 165 00:10:53,160 --> 00:10:57,200 Another way of writing this is that the expected value 166 00:10:57,200 --> 00:11:02,200 of U squared, given X1 through XK equals sigma squared. 167 00:11:04,390 --> 00:11:06,410 And the intuition here is that 168 00:11:06,410 --> 00:11:09,410 the co-variants between U squared 169 00:11:09,410 --> 00:11:13,398 and all the Xs equals zero. 170 00:11:13,398 --> 00:11:15,340 You know what I may get a bold X, 171 00:11:15,340 --> 00:11:19,633 which implies all the Xs or the sort of vector of Xs. 172 00:11:24,030 --> 00:11:26,960 The first test may be the most simple test 173 00:11:26,960 --> 00:11:29,933 is the Breusch-Pagan test. 174 00:11:31,560 --> 00:11:36,560 Known for the, developed by former 175 00:11:36,680 --> 00:11:41,390 Pirates third baseman José Pagán 176 00:11:41,390 --> 00:11:44,023 who then got into econometrics. 177 00:11:45,540 --> 00:11:48,890 Actually that's, obviously not true, but anyway. 178 00:11:48,890 --> 00:11:52,840 So here we test if U squared 179 00:11:52,840 --> 00:11:57,420 is a simple linear function of the Xs. 180 00:11:57,420 --> 00:12:00,600 So we run the regular regression 181 00:12:00,600 --> 00:12:04,110 as you know how to do, you save everybody's U, 182 00:12:04,110 --> 00:12:05,920 which you know how to do and you square it. 183 00:12:05,920 --> 00:12:10,920 So you compute a new variable 184 00:12:12,985 --> 00:12:16,730 UI times UI for every individual. 185 00:12:16,730 --> 00:12:21,730 Then you take that and you do a regression of all of the Xs 186 00:12:24,910 --> 00:12:28,350 in your model, X1 through XK with 187 00:12:28,350 --> 00:12:31,650 U squared as the dependent. 188 00:12:31,650 --> 00:12:34,710 And you have a new here with the, 189 00:12:34,710 --> 00:12:38,040 now we have deltas instead of betas. 190 00:12:38,040 --> 00:12:40,950 Our no hypothesis is that 191 00:12:41,880 --> 00:12:45,683 the delta one equals delta two, equals ... 192 00:12:46,630 --> 00:12:48,410 equals delta K. 193 00:12:48,410 --> 00:12:50,623 And you look at the overall F stat. 194 00:12:51,480 --> 00:12:56,480 So think about what do we hope that we find here? 195 00:12:56,510 --> 00:12:58,063 so ponder that a second. 196 00:13:00,140 --> 00:13:04,760 And basically if we have homoscedasticity, 197 00:13:07,010 --> 00:13:10,280 we hope that these Xs have no effect. 198 00:13:10,280 --> 00:13:15,280 So we're hoping here for a very small all F stat. 199 00:13:15,377 --> 00:13:16,970 And if we do that's good, 200 00:13:16,970 --> 00:13:19,540 we have homoscedasticity as well. 201 00:13:19,540 --> 00:13:21,180 If we have a big F stat, 202 00:13:21,180 --> 00:13:23,430 it means that we have heteroscedasticity 203 00:13:23,430 --> 00:13:25,863 and we have to do something about it. 204 00:13:27,080 --> 00:13:31,313 So this Breush-Pagan is the simplest model. 205 00:13:33,980 --> 00:13:37,780 Next, we have the White test. 206 00:13:37,780 --> 00:13:41,780 Which is of course, named for Walter White 207 00:13:41,780 --> 00:13:44,680 famed high school chemistry 208 00:13:45,704 --> 00:13:50,704 teacher turned methamphetamine and gangster, 209 00:13:51,430 --> 00:13:56,300 and here it's very similar to the Breush-Pagan, 210 00:13:56,300 --> 00:14:01,300 except we square and do all the cross products of the Xs. 211 00:14:03,400 --> 00:14:06,770 So we take not only X1 through XK, 212 00:14:06,770 --> 00:14:08,203 but we have X1 squared, 213 00:14:08,203 --> 00:14:10,510 ..XK squared, 214 00:14:10,510 --> 00:14:13,620 and then multiply X1 times X2, 215 00:14:13,620 --> 00:14:17,173 X1 times X3, X2 times three et cetera. 216 00:14:19,390 --> 00:14:23,880 So if you have K, with regressors that's nine in this model, 217 00:14:23,880 --> 00:14:26,620 so each one squared, 218 00:14:26,620 --> 00:14:30,500 and then the three interactions. 219 00:14:30,500 --> 00:14:32,913 One and two, one and three, two and three. 220 00:14:33,820 --> 00:14:36,720 And then you do an LM test, 221 00:14:36,720 --> 00:14:40,740 likelihood test with 222 00:14:42,240 --> 00:14:44,950 the nine restrictions. 223 00:14:44,950 --> 00:14:49,950 Note that you will lose a lot of degrees of freedom here. 224 00:14:51,160 --> 00:14:54,520 The LM is the Lagrange multiplier test 225 00:14:54,520 --> 00:14:59,520 and note that the downside of this is, 226 00:14:59,939 --> 00:15:03,490 it's not just, you're gonna test 227 00:15:03,490 --> 00:15:06,610 for more than just a simple linear function of X. 228 00:15:06,610 --> 00:15:11,203 The downside is you will lose degrees of freedom. 229 00:15:13,379 --> 00:15:16,890 There's also a special case of the White test, 230 00:15:16,890 --> 00:15:20,437 named for the ageless wonder, 231 00:15:20,437 --> 00:15:24,010 Betty White of course, 232 00:15:24,010 --> 00:15:28,750 where you run a regression with U squared hat 233 00:15:28,750 --> 00:15:30,110 on the left side, 234 00:15:30,110 --> 00:15:32,690 but with Y and Y-hat squared, 235 00:15:32,690 --> 00:15:37,690 and you can kind of get all of these cross products anyway. 236 00:15:39,290 --> 00:15:42,350 So first you run the original model, 237 00:15:42,350 --> 00:15:44,480 the Y equals beta not plus 238 00:15:45,928 --> 00:15:50,250 beta 1XK plus ..beta K XK. 239 00:15:50,250 --> 00:15:54,850 And then you save the residuals and the Y-hats, 240 00:15:54,850 --> 00:15:57,040 and you square them 241 00:15:57,040 --> 00:16:00,170 and save them and regress, 242 00:16:00,170 --> 00:16:05,170 the UI-hat squared on Y-hat and Y-hat squared. 243 00:16:05,370 --> 00:16:10,370 And it must be the hat, not the original observations. 244 00:16:11,120 --> 00:16:14,060 And then you can run either 245 00:16:14,060 --> 00:16:18,540 a Lagrange multiplier or NF test. 246 00:16:18,540 --> 00:16:23,540 And again, in every case you don't want significance. 247 00:16:25,640 --> 00:16:30,640 You want it so that our U squared 248 00:16:31,310 --> 00:16:34,610 is not explain all by the Xs. 249 00:16:34,610 --> 00:16:38,520 That once you sort of run the regression once 250 00:16:38,520 --> 00:16:43,520 that you don't get any association there. 251 00:16:46,220 --> 00:16:51,220 Finally note that the White test also 252 00:16:51,360 --> 00:16:56,360 owes great debt to former NFL defensive linemen, 253 00:16:56,360 --> 00:16:59,393 the late great Reggie White, 254 00:17:00,330 --> 00:17:05,070 and note that it's important to run 255 00:17:05,070 --> 00:17:08,050 other specification tests first 256 00:17:08,050 --> 00:17:10,230 and sort of once you're pretty sure 257 00:17:10,230 --> 00:17:11,950 that you have the right model. 258 00:17:11,950 --> 00:17:14,210 If you wanna run those sort of, 259 00:17:14,210 --> 00:17:18,770 the kind of nested model tests that we have so far 260 00:17:18,770 --> 00:17:23,077 come up with the right model and then run these tests. 261 00:17:25,730 --> 00:17:29,063 Once we are satisfied that we have the right model. 262 00:17:30,680 --> 00:17:33,453 So that's a bit on how to test for it. 263 00:17:39,190 --> 00:17:40,440 Once we've done our tests. 264 00:17:40,440 --> 00:17:44,180 And if we find heteroscedasticity, what do we do about it? 265 00:17:44,180 --> 00:17:46,840 What's the cure for the illness? 266 00:17:46,840 --> 00:17:50,750 So there's three things that I wanna walk you through. 267 00:17:50,750 --> 00:17:55,750 The first is if the structure is unknown, 268 00:17:56,500 --> 00:18:01,480 then there's a way to recalculate the variance 269 00:18:01,480 --> 00:18:04,360 and the standard error of each beta. 270 00:18:04,360 --> 00:18:07,980 And we can use this in a T-test. 271 00:18:07,980 --> 00:18:12,550 And then if we want to have a more efficient estimator, 272 00:18:12,550 --> 00:18:14,350 there's both weighted least squares 273 00:18:14,350 --> 00:18:16,540 and generalized least squares. 274 00:18:16,540 --> 00:18:21,540 And one is for when we know the relationship between 275 00:18:22,900 --> 00:18:26,170 X and U squared. 276 00:18:26,170 --> 00:18:28,000 And when we don't. 277 00:18:28,000 --> 00:18:30,730 So the first one is when know the relationship, 278 00:18:32,038 --> 00:18:33,633 the second is when we do not. 279 00:18:38,840 --> 00:18:43,550 Again homoscedasticity, well behaved data, 280 00:18:43,550 --> 00:18:45,690 is the variance of U 281 00:18:45,690 --> 00:18:48,550 given X1 through XK equals a constant. 282 00:18:48,550 --> 00:18:51,130 If it's violated, we have heteroscedasticity 283 00:18:51,130 --> 00:18:53,900 and variance of U is a function. 284 00:18:53,900 --> 00:18:57,330 And we know again, there's no effect on biased, 285 00:18:57,330 --> 00:19:00,700 no effect on our squared or our bar squared, 286 00:19:00,700 --> 00:19:05,700 but the estimate of the variances have beta hat J, 287 00:19:06,720 --> 00:19:09,040 all of them are biased. 288 00:19:09,040 --> 00:19:14,040 So we need to come up with another way 289 00:19:15,360 --> 00:19:18,123 to calculate the standard error. 290 00:19:20,020 --> 00:19:23,970 Because if we just use OLS, 291 00:19:23,970 --> 00:19:26,350 we can no longer use T-tests. 292 00:19:26,350 --> 00:19:30,140 The T-stats, the confidence intervals are wrong. 293 00:19:30,140 --> 00:19:33,950 T-stats no longer have a T distribution. 294 00:19:33,950 --> 00:19:36,830 F-stats are not F distributed. 295 00:19:36,830 --> 00:19:41,830 And this is a case where even a really big end cannot save. 296 00:19:43,090 --> 00:19:47,980 OLS is not BLUE, it's not even efficient in large sample. 297 00:19:47,980 --> 00:19:51,530 So having a big N, doesn't save you year. 298 00:19:56,260 --> 00:19:58,540 The first thing I'll walk you through is 299 00:19:58,540 --> 00:20:03,540 how to recalculate the standard error. 300 00:20:03,640 --> 00:20:06,930 And again, this isn't something that I'm expecting 301 00:20:06,930 --> 00:20:09,090 you to know how to do, 302 00:20:09,090 --> 00:20:12,650 it isn't something you could do on the back of an envelope, 303 00:20:12,650 --> 00:20:14,710 but I wanna walk you through 304 00:20:14,710 --> 00:20:16,930 how you do it, just so you know, 305 00:20:16,930 --> 00:20:20,270 and then if you need to do this, 306 00:20:20,270 --> 00:20:24,190 you may wish to use another software package 307 00:20:24,190 --> 00:20:27,370 because SPSS, I guess it has a macros, 308 00:20:27,370 --> 00:20:29,940 but I haven't learned how to do that. 309 00:20:29,940 --> 00:20:34,940 So as before, let's just start with a K goals Y model, 310 00:20:36,110 --> 00:20:37,990 start with the simplest model. 311 00:20:37,990 --> 00:20:40,900 And now we know that if we test 312 00:20:40,900 --> 00:20:45,900 that the variance of UI is a function of X, 313 00:20:46,273 --> 00:20:47,870 that it's sigma squared on. 314 00:20:47,870 --> 00:20:51,393 Everybody has a different variance for their UI, 315 00:20:52,985 --> 00:20:55,585 and that's a bad thing, and we need to deal with it. 316 00:21:02,350 --> 00:21:07,290 So in this case, the variance would be 317 00:21:08,270 --> 00:21:13,240 the sum of X minus X bar squared, 318 00:21:13,240 --> 00:21:17,020 times sigma squared I, which is every individual's 319 00:21:17,020 --> 00:21:20,040 times SSTX squared. 320 00:21:20,040 --> 00:21:23,264 Where again, SSTX is the total, 321 00:21:23,264 --> 00:21:27,610 variation in X. 322 00:21:27,610 --> 00:21:30,870 So the general form is. 323 00:21:30,870 --> 00:21:34,500 So you could in theory, go and get 324 00:21:37,173 --> 00:21:42,173 each of these through SPSS and do the math by yourself. 325 00:21:43,120 --> 00:21:44,423 So in theory. 326 00:21:47,800 --> 00:21:50,837 So the way that you do this is 327 00:21:52,210 --> 00:21:57,210 run the regression, get the UI and save and square them. 328 00:21:57,890 --> 00:21:59,740 Get the X bar, 329 00:21:59,740 --> 00:22:04,540 subtract X from it, square it, sum it 330 00:22:06,140 --> 00:22:09,540 and then square that for the denominator 331 00:22:09,540 --> 00:22:11,900 and plug everything in. 332 00:22:11,900 --> 00:22:14,290 Again, it's something that you could do, 333 00:22:14,290 --> 00:22:17,433 but it would be rather tedious. 334 00:22:18,670 --> 00:22:20,930 For the K regressor case, 335 00:22:20,930 --> 00:22:23,050 it's a little bit more complicated. 336 00:22:23,050 --> 00:22:25,614 So here you need to do 337 00:22:25,614 --> 00:22:28,400 this weird R here, 338 00:22:28,400 --> 00:22:30,103 this funky R. 339 00:22:33,570 --> 00:22:38,150 IJ which is the residual 340 00:22:38,150 --> 00:22:43,150 for person I, of regressing XJ on all the other Xs 341 00:22:43,970 --> 00:22:46,970 and SSRJ squared, 342 00:22:46,970 --> 00:22:49,230 is the sum of squared residuals 343 00:22:49,230 --> 00:22:53,700 of regressing XJ on all of the Xs. 344 00:22:53,700 --> 00:22:57,670 So this would be a lot more complex. 345 00:22:57,670 --> 00:23:00,910 You would have to do it a whole bunch of times. 346 00:23:00,910 --> 00:23:05,390 I guess there is a macro that can do this in SPSS. 347 00:23:05,390 --> 00:23:09,123 But other software would probably be easier. 348 00:23:12,690 --> 00:23:17,320 So I'm just pulling this out of the textbook slides 349 00:23:18,600 --> 00:23:23,600 that this is how you could do it. 350 00:23:24,160 --> 00:23:27,150 So you see here, that's how you do it. 351 00:23:27,150 --> 00:23:30,310 And then this is called the White 352 00:23:30,310 --> 00:23:33,890 or Huber or Eicker errors. 353 00:23:33,890 --> 00:23:38,833 And if you use these as the variance, 354 00:23:41,360 --> 00:23:44,960 take the square root for the standard error, 355 00:23:44,960 --> 00:23:48,513 use that as the denominator of your T-test. 356 00:23:49,760 --> 00:23:54,760 And usually if you want to do an F-test for nested models, 357 00:23:57,320 --> 00:24:01,780 a more sophisticated software would have this available 358 00:24:01,780 --> 00:24:03,380 and could do it for you. 359 00:24:03,380 --> 00:24:08,380 And it's always nice when they do this for you of course. 360 00:24:08,480 --> 00:24:12,300 So again, the square root of this new way 361 00:24:12,300 --> 00:24:15,510 to calculate the variants 362 00:24:15,510 --> 00:24:20,160 is you take that the square root, 363 00:24:20,160 --> 00:24:22,810 and that is the standard error. 364 00:24:22,810 --> 00:24:26,280 Again, these are called the White, Huber, Eicker errors. 365 00:24:26,280 --> 00:24:28,770 I don't know why they have so many names, 366 00:24:28,770 --> 00:24:31,663 and I can't think of anybody any, 367 00:24:33,740 --> 00:24:36,710 clever associations with them, 368 00:24:36,710 --> 00:24:38,880 but again, 369 00:24:38,880 --> 00:24:42,043 it's hard to do an SPSS. 370 00:24:47,600 --> 00:24:49,680 Once you get those though, 371 00:24:49,680 --> 00:24:52,180 we recall that a T-stat is 372 00:24:52,180 --> 00:24:56,300 the hypothesis value so the beta hat 373 00:24:56,300 --> 00:24:58,110 divided by the standard error. 374 00:24:58,110 --> 00:24:59,483 So you could just use, 375 00:25:00,580 --> 00:25:04,540 this is pretty easy to do 376 00:25:04,540 --> 00:25:06,850 when you have homoscedasticity. 377 00:25:06,850 --> 00:25:09,073 SPSS automatically has it. 378 00:25:12,360 --> 00:25:14,970 But if you have heteroscedasticity, 379 00:25:14,970 --> 00:25:19,050 you can calculate these new kinds of errors. 380 00:25:19,050 --> 00:25:22,750 And in many cases 381 00:25:22,750 --> 00:25:24,300 it's good to do it both ways 382 00:25:24,300 --> 00:25:26,550 and report of what you come up with 383 00:25:26,550 --> 00:25:28,980 and let the reader decide, 384 00:25:28,980 --> 00:25:33,980 but always be clear about what you did 385 00:25:34,190 --> 00:25:36,360 and why and what the results were. 386 00:25:36,360 --> 00:25:39,100 And in many cases sort of let the reader 387 00:25:39,100 --> 00:25:42,593 decide for themselves what they think is best. 388 00:25:46,890 --> 00:25:48,040 So those sort of 389 00:25:49,030 --> 00:25:51,820 new forms of standard errors is what you can do. 390 00:25:51,820 --> 00:25:54,950 So you can do TNF tests. 391 00:25:54,950 --> 00:25:58,230 If you really want a more efficient estimator, 392 00:25:58,230 --> 00:26:02,450 then you can use what's called weighted least squares. 393 00:26:02,450 --> 00:26:07,450 And if you do you get good T-stats, good F-stats, 394 00:26:08,210 --> 00:26:11,513 and you can use those. 395 00:26:12,950 --> 00:26:14,810 And one thing that if you know, 396 00:26:14,810 --> 00:26:17,153 the functional form of your regressors 397 00:26:17,153 --> 00:26:21,450 then you can use what's called weighted least squares. 398 00:26:21,450 --> 00:26:24,940 And here where the variance of U 399 00:26:24,940 --> 00:26:28,870 given X is some function of X, H of X, 400 00:26:28,870 --> 00:26:31,975 and this would probably be guided by theory, 401 00:26:31,975 --> 00:26:35,920 previous studies, et cetera. (Matthew coughs) 402 00:26:35,920 --> 00:26:40,890 Note that HMX must be strictly greater than zero. 403 00:26:40,890 --> 00:26:44,410 So you know from previous studies 404 00:26:44,410 --> 00:26:47,600 that it's been shown that the variance 405 00:26:47,600 --> 00:26:50,923 is this specific function of X. 406 00:26:52,840 --> 00:26:57,180 The easiest case is when it's just a constant times XI. 407 00:26:57,180 --> 00:27:02,180 So I talked about how, as income increases, 408 00:27:02,380 --> 00:27:06,550 the variance might also increase 409 00:27:06,550 --> 00:27:10,310 of the expenditure on some good like food. 410 00:27:10,310 --> 00:27:15,080 So here we just divide through, 411 00:27:15,080 --> 00:27:20,080 divide by H of X, which is in this case divide by income, 412 00:27:22,240 --> 00:27:27,240 and then divide every term by that. 413 00:27:27,990 --> 00:27:31,650 So large income folks with higher variants, 414 00:27:31,650 --> 00:27:33,240 get a smaller weight here. 415 00:27:33,240 --> 00:27:37,153 Small income folks with smaller variants, 416 00:27:38,150 --> 00:27:39,110 get a larger weight. 417 00:27:39,110 --> 00:27:41,410 So you're over weighing those, 418 00:27:41,410 --> 00:27:42,900 that have a smaller variant, 419 00:27:42,900 --> 00:27:45,103 underwing those that have a larger one. 420 00:27:46,510 --> 00:27:48,580 There's some problems here, 421 00:27:48,580 --> 00:27:51,700 with the interpretation, 422 00:27:51,700 --> 00:27:54,950 but if this is the right functional form, 423 00:27:54,950 --> 00:27:56,560 this will be an efficient estimator 424 00:27:56,560 --> 00:27:58,373 and your TNF stats work. 425 00:28:03,020 --> 00:28:06,000 So weighted least squares assumes that we know 426 00:28:06,000 --> 00:28:07,450 the functional form. 427 00:28:07,450 --> 00:28:08,610 And if we don't, 428 00:28:08,610 --> 00:28:12,100 then we can use a very flexible functional form 429 00:28:12,100 --> 00:28:15,880 that sort of works for everything 430 00:28:15,880 --> 00:28:20,880 which is to use the exponential function, 431 00:28:20,970 --> 00:28:25,740 also guarantees that it's strictly greater than zero, 432 00:28:25,740 --> 00:28:30,733 and this is called feasible generalized least squares, FGLS. 433 00:28:36,870 --> 00:28:39,241 These are the how-tos of 434 00:28:39,241 --> 00:28:43,100 Feagles feasible generalized least squares 435 00:28:43,100 --> 00:28:47,900 named for former NF fell punter Jeff Feagles. 436 00:28:47,900 --> 00:28:49,660 So I know this is really mathy, 437 00:28:49,660 --> 00:28:54,660 and I wouldn't really worry about all that much of it. 438 00:28:54,980 --> 00:28:59,353 So you start with the equation of, 439 00:29:03,670 --> 00:29:08,610 U squared as a function of your regressors, 440 00:29:08,610 --> 00:29:13,410 you take the log and then you get the fitted values. 441 00:29:13,410 --> 00:29:16,970 So sort of the Y-hats of this, 442 00:29:16,970 --> 00:29:21,700 the UI-hat squared of once you 443 00:29:24,660 --> 00:29:26,173 run this regress, 444 00:29:29,050 --> 00:29:33,340 and then you rename that the G of I, 445 00:29:33,340 --> 00:29:36,410 and you take the exponential function 446 00:29:36,410 --> 00:29:38,440 and rename that H of I, 447 00:29:38,440 --> 00:29:43,440 and then you weigh each term with one over H-hat of I. 448 00:29:51,130 --> 00:29:54,330 Again, so you run a regression 449 00:29:54,330 --> 00:29:57,690 of your main model, save the residuals, 450 00:29:57,690 --> 00:30:02,180 square and take their log, regress that, on our Xs 451 00:30:02,180 --> 00:30:05,000 to get our fitted values G-hat, 452 00:30:05,000 --> 00:30:08,430 take the exponent of that and call that H-hat 453 00:30:08,430 --> 00:30:13,430 and then weigh every observation with one over H-hat I. 454 00:30:13,770 --> 00:30:15,323 So this is very mathy, 455 00:30:19,010 --> 00:30:21,120 but what you see is 456 00:30:21,120 --> 00:30:26,120 if there's a big U squared that 457 00:30:26,190 --> 00:30:28,930 you will give them a smaller weight. 458 00:30:28,930 --> 00:30:32,490 And if it's a small one, you'll get a big one. 459 00:30:32,490 --> 00:30:35,810 So you're sort of over weighing less 460 00:30:37,220 --> 00:30:41,333 precise estimates and under weighing more precise ones. 461 00:30:45,830 --> 00:30:48,530 In general, 462 00:30:48,530 --> 00:30:52,660 if you have heteroscedasticity, 463 00:30:52,660 --> 00:30:54,910 weighted least squares is more efficient 464 00:30:56,940 --> 00:30:59,910 and in many cases, 465 00:30:59,910 --> 00:31:04,270 it's good to do it both ways and see why. 466 00:31:04,270 --> 00:31:07,760 Sometimes it may be due to misspecification 467 00:31:07,760 --> 00:31:09,540 instead of heteroscedasticity. 468 00:31:09,540 --> 00:31:10,810 So always make sure that you do 469 00:31:10,810 --> 00:31:12,853 your specification test first. 470 00:31:13,860 --> 00:31:17,310 If there's strong heteroscedasticity, 471 00:31:17,310 --> 00:31:22,310 those are robust estimators that we learned about are good. 472 00:31:24,870 --> 00:31:27,423 And last slide, the recap. 473 00:31:29,100 --> 00:31:34,090 So if you have heteroscedasticity, there's no bias, 474 00:31:34,090 --> 00:31:38,000 but OLS is no longer BLUE, the error terms are bias. 475 00:31:38,000 --> 00:31:40,920 The variance of the hat is biased, 476 00:31:40,920 --> 00:31:44,790 and so the (indistinct) T-test don't work. 477 00:31:44,790 --> 00:31:47,670 We learned about the tests, the Breush Pagan 478 00:31:47,670 --> 00:31:49,070 and the White tests. 479 00:31:49,070 --> 00:31:52,560 Of how to test for it, and then three solutions 480 00:31:52,560 --> 00:31:56,220 so you could do these robust to standard errors, 481 00:31:56,220 --> 00:31:58,220 if you're concerned about inference. 482 00:31:58,220 --> 00:32:01,270 And if you want a more efficient estimator, 483 00:32:01,270 --> 00:32:04,130 if the functional form is known, 484 00:32:04,130 --> 00:32:06,480 you can use weighted least squares. 485 00:32:06,480 --> 00:32:07,840 And if it's unknown, 486 00:32:07,840 --> 00:32:12,750 you can use Feagles feasible generalized least squares. 487 00:32:12,750 --> 00:32:14,263 And that's it thank you.