/* This is a data set concerning CEO salaries that is taken from the data files of the textbook "Introductory Econometrics: A Modern Approach" by Jeffrey M. Wooldridge (3rd ed. Thomson, 2006). The purpose here is to show how a multiple least squares coefficient estimate can alternatively be derived by regressing the residuals of two previous equations on each other while dropping the intercept. This result is referred to as the Frisch-Waugh Theorem. */ data ceo; input salary age college grad comten ceoten sales profits mktval lsalary lsales lmktval comtensq ceotensq profmarg; datalines; 1161 49 1 1 9 2 6200 966 23200 7.057037 8.732305 10.05191 81 4 15.58065 600 43 1 1 10 10 283 48 1100 6.39693 5.645447 7.003066 100 100 16.96113 379 51 1 1 9 3 169 40 1100 5.937536 5.129899 7.003066 81 9 23.66864 651 55 1 0 22 22 1100 -54 1000 6.478509 7.003066 6.907755 484 484 -4.909091 497 44 1 1 8 6 351 28 387 6.20859 5.860786 5.958425 64 36 7.977208 1067 64 1 1 7 7 19000 614 3900 6.972606 9.852194 8.268732 49 49 3.231579 945 59 1 0 35 10 536 24 623 6.851185 6.284134 6.434546 1225 100 4.477612 1261 63 1 1 32 8 4800 191 2100 7.13966 8.476371 7.649693 1024 64 3.979167 503 47 1 1 4 4 610 7 454 6.22059 6.413459 6.118097 16 16 1.147541 1094 64 1 1 39 5 2900 230 3900 6.997596 7.972466 8.268732 1521 25 7.931035 601 54 1 1 26 7 1200 34 533 6.398595 7.090077 6.278522 676 49 2.833333 355 66 1 0 39 8 560 8 477 5.872118 6.327937 6.167517 1521 64 1.428571 1200 72 1 0 37 37 796 35 678 7.090077 6.679599 6.519147 1369 1369 4.396985 697 51 1 0 25 1 8200 234 5700 6.546785 9.011889 8.648221 625 1 2.853658 1041 63 1 1 21 11 4300 91 1400 6.947937 8.36637 7.244227 441 121 2.116279 245 44 1 1 7 7 135 24 558 5.501258 4.905275 6.324359 49 49 17.77778 817 68 1 0 38 4 1300 55 847 6.705639 7.17012 6.741701 1444 16 4.230769 1675 71 0 0 31 12 674 115 1200 7.423568 6.51323 7.090077 961 144 17.06231 971 72 1 1 33 24 1400 69 609 6.878326 7.244227 6.411819 1089 576 4.928571 609 58 1 0 36 1 1100 69 880 6.411819 7.003066 6.779922 1296 1 6.272727 470 60 1 1 20 6 2300 210 2200 6.152733 7.740664 7.696213 400 36 9.130435 867 59 1 0 36 14 884 81 1500 6.765039 6.784457 7.313221 1296 196 9.162896 752 54 1 0 32 4 1600 193 3200 6.622736 7.377759 8.070906 1024 16 12.0625 246 51 1 0 8 8 78 13 458 5.505332 4.356709 6.126869 64 64 16.66667 825 56 1 1 4 4 10700 295 5900 6.715384 9.277999 8.682708 16 16 2.757009 358 50 1 1 23 4 99 25 2300 5.880533 4.59512 7.740664 529 16 25.25253 1162 58 1 0 24 6 3800 226 1800 7.057898 8.242756 7.495542 576 36 5.947369 270 43 1 0 15 2 150 28 713 5.598422 5.010635 6.569481 225 4 18.66667 829 56 1 0 14 8 2200 184 1500 6.72022 7.696213 7.313221 196 64 8.363636 300 77 0 0 45 26 6900 483 4700 5.703783 8.839276 8.455317 2025 676 7 1627 62 1 1 13 4 8300 596 9100 7.394493 9.024011 9.11603 169 16 7.180723 1237 63 1 1 37 9 4600 108 6200 7.120444 8.433811 8.732305 1369 81 2.347826 540 61 1 1 37 1 5200 549 5600 6.291569 8.556414 8.630522 1369 1 10.55769 1798 66 1 1 21 14 24300 338 12500 7.49443 10.09823 9.433484 441 196 1.390947 474 40 1 0 18 1 2700 117 2000 6.161207 7.901007 7.600903 324 1 4.333333 1336 60 1 1 21 13 4500 562 4300 7.197435 8.411833 8.36637 441 169 12.48889 541 51 1 0 30 4 1400 82 1200 6.293419 7.244227 7.090077 900 16 5.857143 129 66 1 1 4 4 59 28 412 4.859812 4.077538 6.021023 16 16 47.45763 1700 54 1 1 21 5 6800 1200 20400 7.438384 8.824677 9.92329 441 25 17.64706 1750 66 1 1 31 24 16200 1400 17900 7.467371 9.692766 9.792556 961 576 8.641975 624 61 1 1 21 13 1100 109 934 6.436151 7.003066 6.839477 441 169 9.909091 791 66 1 0 14 8 2300 -60 487 6.673298 7.740664 6.188264 196 64 -2.608696 1487 51 1 0 3 3 22200 182 2800 7.304516 10.00785 7.937375 9 9 0.8198198 2021 56 1 0 34 3 51300 2700 42900 7.611348 10.84545 10.66663 1156 9 5.263158 1550 47 1 1 19 3 1100 120 4900 7.34601 7.003066 8.49699 361 9 10.90909 401 64 1 0 44 8 571 57 670 5.993961 6.347389 6.507277 1936 64 9.982487 1295 62 1 0 8 8 10700 1300 16400 7.166266 9.277999 9.705036 64 64 12.14953 449 56 1 0 31 1 661 37 538 6.107023 6.493754 6.287858 961 1 5.597579 456 56 1 1 9 3 381 34 6700 6.122493 5.9428 8.809863 81 9 8.923884 1142 53 1 1 30 1 28000 1900 26300 7.040536 10.23996 10.17732 900 1 6.785714 577 64 1 0 26 2 3000 287 5700 6.357842 8.006368 8.648221 676 4 9.566667 600 56 1 1 18 7 11700 -40 4000 6.39693 9.367344 8.294049 324 49 -0.3418804 649 44 1 1 4 4 336 17 475 6.475433 5.817111 6.163315 16 16 5.059524 822 60 1 0 22 20 896 77 752 6.71174 6.79794 6.622736 484 400 8.59375 1080 52 1 0 18 5 388 55 1600 6.984716 5.961005 7.377759 324 25 14.17526 1738 54 0 0 34 12 10700 842 15400 7.46049 9.277999 9.642123 1156 144 7.869159 581 54 1 0 19 19 408 23 403 6.364751 6.011267 5.998937 361 361 5.637255 912 54 1 0 9 9 2600 239 2400 6.81564 7.863267 7.783224 81 81 9.192307 650 69 1 0 37 13 261 40 817 6.476973 5.56452 6.705639 1369 169 15.32567 2199 52 1 1 8 8 5600 475 6300 7.695758 8.630522 8.748305 64 64 8.482142 609 53 1 1 15 15 567 34 498 6.411819 6.340359 6.2106 225 225 5.996473 1946 73 1 0 25 21 7800 484 8000 7.573531 8.961879 8.987197 625 441 6.205128 552 52 1 0 30 1 2800 308 3500 6.313548 7.937375 8.160519 900 1 11 481 59 1 1 26 4 611 90 667 6.175867 6.415097 6.50279 676 16 14.72995 526 45 1 0 8 7 2400 106 2000 6.265301 7.783224 7.600903 64 49 4.416667 471 60 1 0 3 2 160 7 425 6.154858 5.075174 6.052089 9 4 4.375 630 56 1 0 29 1 1700 -55 420 6.44572 7.438384 6.040255 841 1 -3.235294 622 57 1 0 35 4 2500 143 1200 6.43294 7.824046 7.090077 1225 16 5.72 999 52 1 0 28 17 159 21 398 6.906755 5.068904 5.986452 784 289 13.20755 585 60 1 1 36 10 1700 33 449 6.371612 7.438384 6.107023 1296 100 1.941176 1107 57 1 0 17 6 2200 149 1100 7.009409 7.696213 7.003066 289 36 6.772727 1099 59 1 0 34 10 8600 182 1800 7.002156 9.059518 7.495542 1156 100 2.116279 425 86 1 1 13 13 36 11 644 6.052089 3.583519 6.467699 169 169 30.55556 2792 40 1 0 11 11 534 35 888 7.934514 6.280396 6.788972 121 121 6.554307 350 54 1 0 31 4 1000 46 812 5.857933 6.907755 6.699501 961 16 4.6 363 58 1 1 36 6 717 80 880 5.894403 6.575076 6.779922 1296 36 11.1576 2265 63 1 1 35 6 18000 1700 18800 7.72533 9.798127 9.841612 1225 36 9.444445 377 45 1 0 7 5 238 57 1200 5.932245 5.47227 7.090077 49 25 23.94958 879 63 1 1 21 9 1700 212 4900 6.778785 7.438384 8.49699 441 81 12.47059 720 49 1 0 12 12 672 23 1400 6.579251 6.510258 7.244227 144 144 3.422619 950 63 1 0 27 14 2600 6 1500 6.856462 7.863267 7.313221 729 196 0.2307692 1143 67 0 0 23 3 1800 56 918 7.041412 7.495542 6.822197 529 9 3.111111 1064 58 1 0 27 3 3500 195 2600 6.96979 8.160519 7.863267 729 9 5.571429 1253 60 1 1 36 5 2600 142 3700 7.133296 7.863267 8.216088 1296 25 5.461538 462 58 1 1 23 0 1400 50 769 6.135565 7.244227 6.645091 529 0 3.571429 174 69 1 0 13 13 29 6 390 5.159055 3.367296 5.966147 169 169 20.68966 474 63 1 0 41 4 2200 175 2600 6.161207 7.696213 7.863267 1681 16 7.954545 1248 48 1 1 21 7 3500 423 7300 7.129298 8.160519 8.89563 441 49 12.08571 1101 62 1 1 32 3 954 96 1200 7.003974 6.860664 7.090077 1024 9 10.06289 348 43 1 1 12 10 586 79 1400 5.852202 6.37332 7.244227 144 100 13.48123 650 55 1 1 28 5 5700 -438 817 6.476973 8.648221 6.705639 784 25 -7.68421 875 58 1 1 32 10 5300 308 2200 6.774224 8.575462 7.696213 1024 100 5.811321 1600 61 1 0 4 1 12300 877 9400 7.377759 9.417355 9.148465 16 1 7.130081 1500 55 1 1 30 4 7900 665 4800 7.313221 8.974618 8.476371 900 16 8.417722 323 39 1 1 15 3 637 63 517 5.777652 6.456769 6.248043 225 9 9.89011 459 59 1 0 33 3 785 40 1400 6.12905 6.665684 7.244227 1089 9 5.095541 925 56 1 1 26 12 3300 67 2200 6.829794 8.101678 7.696213 676 144 2.030303 375 46 1 1 4 4 599 20 501 5.926926 6.395262 6.216606 16 16 3.338898 447 53 1 0 4 1 143 16 527 6.102559 4.962845 6.2672 16 1 11.18881 1340 55 1 0 13 10 1400 131 2900 7.200425 7.244227 7.972466 169 100 9.357142 1749 57 1 1 26 11 8100 40 10000 7.466799 8.999619 9.21034 676 121 0.4938272 491 43 1 1 21 2 561 54 521 6.196444 6.329721 6.25575 441 4 9.625669 5299 64 1 0 42 13 2400 119 1500 8.575274 7.783224 7.313221 1764 169 4.958333 431 58 1 1 33 3 815 36 550 6.066108 6.703188 6.309918 1089 9 4.417178 729 50 1 1 15 3 2000 182 2600 6.591674 7.600903 7.863267 225 9 9.1 1284 54 1 1 32 3 12300 1300 19600 7.157735 9.417355 9.883285 1024 9 10.56911 1373 57 1 0 36 8 14300 1600 23600 7.224753 9.568015 10.069 1296 64 11.18881 989 40 1 0 18 5 439 30 582 6.896694 6.084499 6.36647 324 25 6.833713 515 52 1 1 27 1 1100 51 889 6.244167 7.003066 6.790097 729 1 4.636364 1301 50 1 1 19 15 1800 130 1600 7.170888 7.495542 7.377759 361 225 7.222222 834 58 1 0 35 1 4400 63 890 6.726233 8.389359 6.791222 1225 1 1.431818 849 46 1 1 24 24 538 36 473 6.744059 6.287858 6.159095 576 576 6.69145 100 61 1 1 26 26 2700 394 10100 4.60517 7.901007 9.220291 676 676 14.59259 679 62 1 0 40 6 4900 -463 1400 6.520621 8.49699 7.244227 1600 36 -9.448979 567 56 1 0 31 10 597 65 1700 6.340359 6.391917 7.438384 961 100 10.88777 559 54 1 0 22 2 2100 13 686 6.326149 7.649693 6.530878 484 4 0.6190476 704 52 1 1 6 6 50 8 903 6.556778 3.912023 6.805723 36 36 16 308 45 1 1 14 14 210 39 1900 5.7301 5.347107 7.549609 196 196 18.57143 1392 48 1 1 6 6 4800 51 1100 7.238497 8.476371 7.003066 36 36 1.0625 389 55 1 0 29 4 478 38 420 5.963579 6.169611 6.040255 841 16 7.949791 790 69 1 0 45 37 1200 140 3200 6.672033 7.090077 8.070906 2025 1369 11.66667 396 80 1 0 58 28 513 53 963 5.981414 6.240276 6.870053 3364 784 10.33138 398 54 1 0 4 4 633 69 1800 5.986452 6.45047 7.495542 16 16 10.90047 707 46 1 1 6 1 130 26 1200 6.561031 4.867535 7.090077 36 1 20 984 60 1 0 7 4 1500 135 1700 6.891626 7.313221 7.438384 49 16 9 410 55 1 0 36 20 501 34 590 6.016157 6.216606 6.380123 1296 400 6.786427 1095 60 1 1 33 5 27600 1400 17100 6.998509 10.22557 9.746834 1089 25 5.072464 694 61 1 1 35 19 4200 75 1000 6.542472 8.34284 6.907755 1225 361 1.785714 834 61 1 1 32 0 7600 364 5300 6.726233 8.935904 8.575462 1024 0 4.789474 1630 39 1 1 8 8 227 27 822 7.396335 5.42495 6.71174 64 64 11.89427 493 55 1 1 4 1 1300 80 834 6.200509 7.17012 6.726233 16 1 6.153846 625 57 0 0 36 9 1400 87 979 6.437752 7.244227 6.886532 1296 81 6.214286 483 52 1 1 18 14 1000 35 548 6.180017 6.907755 6.306275 324 196 3.5 733 60 1 0 8 8 347 18 778 6.597146 5.849325 6.656726 64 64 5.18732 2102 67 1 1 41 20 10300 1700 45400 7.650645 9.2399 10.72327 1681 400 16.50485 853 58 1 0 34 34 818 33 411 6.74876 6.706862 6.018593 1156 1156 4.03423 345 54 1 1 33 0 994 56 781 5.843544 6.901737 6.660575 1089 0 5.633803 800 57 1 1 12 9 1800 32 479 6.684612 7.495542 6.1717 144 81 1.777778 764 55 1 1 31 16 1100 145 2100 6.638568 7.003066 7.649693 961 256 13.18182 806 59 1 1 3 3 3000 257 3900 6.692084 8.006368 8.268732 9 9 8.566667 310 40 1 0 18 1 2400 60 1300 5.736572 7.783224 7.17012 324 1 2.5 1119 61 1 0 34 9 2500 71 1200 7.020191 7.824046 7.090077 1156 81 2.84 1287 59 1 1 4 3 4700 222 2700 7.160069 8.455317 7.901007 16 9 4.723404 1170 57 1 1 9 3 1900 208 5600 7.064759 7.549609 8.630522 81 9 10.94737 880 62 1 0 36 12 5300 229 4000 6.779922 8.575462 8.294049 1296 144 4.320755 1091 33 1 0 9 9 181 36 1300 6.99485 5.198497 7.17012 81 81 19.8895 1100 65 1 0 18 6 563 -271 544 7.003066 6.33328 6.298949 324 36 -48.13499 650 53 1 1 5 4 1482 40 557 6.476973 7.301148 6.322565 25 16 2.699055 607 38 1 1 7 3 231 38 599 6.408529 5.442418 6.395262 49 9 16.45022 1133 63 1 0 9 9 870 37 686 7.032624 6.768493 6.530878 81 81 4.252873 393 58 1 1 36 6 285 40 956 5.97381 5.652489 6.862758 1296 36 14.03509 605 53 1 0 16 4 422 30 505 6.405229 6.045005 6.224558 256 16 7.109005 1444 59 1 1 2 2 6204 401 10700 7.275172 8.732949 9.277999 4 4 6.463572 1033 62 1 1 30 1 5400 478 7300 6.940222 8.594154 8.89563 900 1 8.851851 1142 50 1 1 11 3 2600 166 2200 7.040536 7.863267 7.696213 121 9 6.384615 537 46 1 1 20 20 1200 17 669 6.285998 7.090077 6.505784 400 400 1.416667 693 42 1 0 17 12 1400 206 3000 6.54103 7.244227 8.006368 289 144 14.71429 439 57 1 1 26 12 2600 280 3800 6.084499 7.863267 8.242756 676 144 10.76923 358 64 1 0 43 11 584 45 423 5.880533 6.369901 6.047372 1849 121 7.70548 1276 64 1 0 41 17 635 52 1300 7.151485 6.453625 7.17012 1681 289 8.188976 873 41 1 1 2 2 149 21 567 6.771935 5.003946 6.340359 4 4 14.09396 537 57 1 1 35 1 11400 210 4800 6.285998 9.341369 8.476371 1225 1 1.842105 713 57 1 1 12 2 1600 55 1300 6.569481 7.377759 7.17012 144 4 3.4375 1350 68 1 1 5 5 3300 92 2100 7.20786 8.101678 7.649693 25 25 2.787879 1268 47 1 0 20 4 1100 47 2500 7.145196 7.003066 7.824046 400 16 4.272727 465 64 1 1 31 3 2400 326 2400 6.142037 7.783224 7.783224 961 9 13.58333 693 46 1 1 7 3 2200 44 533 6.54103 7.696213 6.278522 49 9 2 369 49 1 1 4 1 65 -132 1200 5.910797 4.174387 7.090077 16 1 -203.0769 381 54 1 0 30 2 2700 386 4500 5.9428 7.901007 8.411833 900 4 14.2963 467 49 1 1 13 0 513 49 534 6.146329 6.240276 6.280396 169 0 9.551657 559 57 1 1 34 16 605 56 653 6.326149 6.405229 6.481577 1156 256 9.256198 218 57 1 1 33 5 504 41 421 5.384495 6.222576 6.042633 1089 25 8.134921 264 63 1 0 42 3 334 43 480 5.575949 5.811141 6.173786 1764 9 12.87425 185 58 1 0 39 1 766 49 560 5.220356 6.641182 6.327937 1521 1 6.396867 387 71 1 1 32 13 432 28 477 5.958425 6.068426 6.167517 1024 169 6.481482 2220 63 1 1 18 18 277 -80 540 7.705263 5.624018 6.291569 324 324 -28.88087 445 69 1 0 23 0 249 31 828 6.098074 5.517453 6.719013 529 0 12.4498 ; proc sort data=ceo; by descending salary; run; proc print data=ceo; run; proc means data=ceo; var salary age ceoten; run; proc corr data=ceo; var salary ceoten; run; proc tabulate data = ceo; class college; table college; title 'Comparison of Number of college versus non-college ceos'; run; proc tabulate data = ceo; class college; var salary; table college, salary*mean ; title 'Comparison of Ave. Salaries of college versus non-college ceos'; run; /* Here we try out several regressions to determine a good regression equation. */ title 'Various Regressions involving CEO salary'; proc reg data=ceo; model salary = ceoten comten profits; model salary = ceoten profits; model salary = ceoten profmarg; model salary = ceoten profits age grad college; model salary = ceoten ceotensq profits; test ceoten, ceotensq; run; /* We settle on the equation with salary as a function of ceoten, ceotensq, and profits. */ /* Now we use the Frisch-Waugh Theorem to derive the least squares estimate of the coefficient on the ceoten variable and its standard error and t-statistic. */ /* Here are the two regressions that obtain the independent part of ceoten after controlling for ceotensq and profits (residu) and the independent part of salary after controlling for ceotensq and profits (residv). Then we regress residv on residu while supprssing the intercept and in so doing get the least squares coefficient estimate for ceoten in the original multiple regression. Note the equivalence of the coefficient estimate for the variable ceoten, and its standard error of the estimate, and t-statistic (up to minute rounding error.) */ title 'Obtaining the independent parts of the ceoten and salary variables'; proc reg data=ceo; model ceoten = ceotensq profits; output out = result1 r=residu; model salary = ceotensq profits; output out = result2 r = residv; data together; merge result1 result2; title 'The Frisch-Waugh Result: The least squares estimate for the ceoten variable'; proc reg data = together; model residv = residu/noint; run;