------------------------------------------------------------------------------------
name: <unnamed>
log: C:\Users\Michael\Documents\newer web pages\soc_meth_proj3\fall_2012_381
> _logs\fifty_state_log.log
log type: text
opened on: 1 Nov 2012, 12:47:42
. twoway (scatter incwage NH_White_proportion, mlabel(statefip)) (lfit incwage NH_White_proportion)
*above is the scatter plot of NH white proportion (which runs from zero to 1 maximum) and average income, with the best fit line and the state names labeled. And below is the regression that corresponds to that line.
. regress incwage NH_White_proportion
Source | SS df MS Number of obs = 51
-------------+------------------------------ F( 1, 49) = 2.14
Model | 18878316.5 1 18878316.5 Prob > F = 0.1500
Residual | 432407199 49 8824636.71 R-squared = 0.0418
-------------+------------------------------ Adj R-squared = 0.0223
Total | 451285515 50 9025710.3 Root MSE = 2970.6
------------------------------------------------------------------------------
incwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
NH_White_p~n | -3761.36 2571.649 -1.46 0.150 -8929.282 1406.562
_cons | 22161.23 2004.928 11.05 0.000 18132.18 26190.29
------------------------------------------------------------------------------
. summarize NH_White_proportion
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
NH_White_p~n | 51 .7626632 .1633623 .2354178 .9835737
* now generate the dfbetas, the predicted values, the residuals, and take their absolute value.
. dfbeta
_dfbeta_1: dfbeta(NH_White_proportion)
. predict M1_predicted
(option xb assumed; fitted values)
. gen residual=incwage- M1_predicted
. gen abs_residual=abs(residual)
. gen abs_dfebas=abs( _dfbeta_1)
. gsort -abs_residual
. list statefip abs_residual residual abs_dfebas _dfbeta_1
+--------------------------------------------------------------------+
| statefip abs_re~l residual abs_df~s _dfbeta_1 |
|--------------------------------------------------------------------|
1. | Connecticut 5617.314 5617.314 .0487289 .0487289 |
2. | New Jersey 5432.736 5432.736 .1172426 -.1172426 |
3. | New Mexico 5139.932 -5139.932 .5375599 .5375599 |
4. | Montana 5024.921 -5024.921 .2145686 -.2145686 |
5. | Mississippi 5009.293 -5009.293 .2366829 .2366829 |
|--------------------------------------------------------------------|
6. | Maryland 4840.275 4840.275 .1743481 -.1743481 |
7. | West Virginia 4798.199 -4798.199 .2921322 -.2921322 |
8. | Massachusetts 4666.598 4666.598 .098265 .098265 |
9. | Arkansas 4460.403 -4460.403 .0185422 -.0185422 |
10. | Colorado 4390.833 4390.833 .0056333 .0056333 |
|--------------------------------------------------------------------|
11. | North Dakota 4204.203 -4204.203 .192666 -.192666 |
12. | Minnesota 4187.81 4187.81 .1740437 .1740437 |
13. | Alaska 3780.312 3780.312 .0506594 -.0506594 |
14. | Louisiana 3555.554 -3555.554 .1484154 .1484154 |
15. | Alabama 3416.563 -3416.563 .0482474 .0482474 |
|--------------------------------------------------------------------|
16. | District of Columbia 3381.999 3381.999 .5903278 -.5903278 |
17. | Michigan 3208.876 3208.876 .0356351 .0356351 |
18. | New Hampshire 3021.199 3021.199 .1813799 .1813799 |
19. | South Dakota 2937.162 -2937.162 .1303558 -.1303558 |
20. | Virginia 2706.413 2706.413 .0332524 -.0332524 |
|--------------------------------------------------------------------|
21. | Illinois 2687.422 2687.422 .04929 -.04929 |
22. | Washington 2536.313 2536.313 .0665131 .0665131 |
23. | Oklahoma 2383.868 -2383.868 .0102179 -.0102179 |
24. | Idaho 2289.952 -2289.952 .070259 -.070259 |
25. | Kentucky 2257.391 -2257.391 .075205 -.075205 |
|--------------------------------------------------------------------|
26. | Wisconsin 2079.558 2079.558 .0656909 .0656909 |
27. | South Carolina 1986.75 -1986.75 .022419 .022419 |
28. | Delaware 1970.206 1970.206 .0329438 -.0329438 |
29. | Wyoming 1860.133 -1860.133 .0957266 -.0957266 |
30. | Florida 1833.188 -1833.188 .0603009 .0603009 |
|--------------------------------------------------------------------|
31. | Arizona 1755.73 -1755.73 .062599 .062599 |
32. | Hawaii 1728.106 -1728.106 .3419163 .3419163 |
33. | Rhode Island 1562.148 1562.148 .0499289 .0499289 |
34. | Missouri 1460.693 1460.693 .0429018 .0429018 |
35. | Nebraska 1231.4 -1231.4 .0429309 -.0429309 |
|--------------------------------------------------------------------|
36. | Ohio 1017.316 1017.316 .024228 .024228 |
37. | Kansas 1001.302 -1001.302 .021283 -.021283 |
38. | New York 998.9494 998.9494 .0335865 -.0335865 |
39. | Georgia 939.2884 -939.2884 .0433774 .0433774 |
40. | Texas 873.475 -873.475 .0654734 .0654734 |
|--------------------------------------------------------------------|
41. | Utah 544.7642 -544.7642 .0203697 -.0203697 |
42. | Maine 536.482 -536.482 .0362305 -.0362305 |
43. | Nevada 347.9611 347.9611 .0080656 -.0080656 |
44. | Vermont 328.0741 -328.0741 .0203959 -.0203959 |
45. | California 294.7873 294.7873 .0240138 -.0240138 |
|--------------------------------------------------------------------|
46. | Oregon 241.7805 241.7805 .0072873 .0072873 |
47. | Pennsylvania 230.294 -230.294 .0063625 -.0063625 |
48. | Indiana 165.3883 -165.3883 .0053708 -.0053708 |
49. | Tennessee 89.31062 89.31062 .0009869 .0009869 |
50. | North Carolina 46.82497 -46.82497 .0009033 .0009033 |
|--------------------------------------------------------------------|
51. | Iowa 17.83441 17.83441 .0008664 .0008664 |
|
|
*biggest residual is connecticut.
. gsort - abs_dfebas
. list statefip abs_dfebas _dfbeta_1 abs_residual residual
+--------------------------------------------------------------------+
| statefip abs_df~s _dfbeta_1 abs_re~l residual |
|--------------------------------------------------------------------|
1. | District of Columbia .5903278 -.5903278 3381.999 3381.999 |
2. | New Mexico .5375599 .5375599 5139.932 -5139.932 |
3. | Hawaii .3419163 .3419163 1728.106 -1728.106 |
4. | West Virginia .2921322 -.2921322 4798.199 -4798.199 |
5. | Mississippi .2366829 .2366829 5009.293 -5009.293 |
|--------------------------------------------------------------------|
6. | Montana .2145686 -.2145686 5024.921 -5024.921 |
7. | North Dakota .192666 -.192666 4204.203 -4204.203 |
8. | New Hampshire .1813799 .1813799 3021.199 3021.199 |
9. | Maryland .1743481 -.1743481 4840.275 4840.275 |
10. | Minnesota .1740437 .1740437 4187.81 4187.81 |
|--------------------------------------------------------------------|
11. | Louisiana .1484154 .1484154 3555.554 -3555.554 |
12. | South Dakota .1303558 -.1303558 2937.162 -2937.162 |
13. | New Jersey .1172426 -.1172426 5432.736 5432.736 |
14. | Massachusetts .098265 .098265 4666.598 4666.598 |
15. | Wyoming .0957266 -.0957266 1860.133 -1860.133 |
|--------------------------------------------------------------------|
16. | Kentucky .075205 -.075205 2257.391 -2257.391 |
17. | Idaho .070259 -.070259 2289.952 -2289.952 |
18. | Washington .0665131 .0665131 2536.313 2536.313 |
19. | Wisconsin .0656909 .0656909 2079.558 2079.558 |
20. | Texas .0654734 .0654734 873.475 -873.475 |
|--------------------------------------------------------------------|
21. | Arizona .062599 .062599 1755.73 -1755.73 |
22. | Florida .0603009 .0603009 1833.188 -1833.188 |
23. | Alaska .0506594 -.0506594 3780.312 3780.312 |
24. | Rhode Island .0499289 .0499289 1562.148 1562.148 |
25. | Illinois .04929 -.04929 2687.422 2687.422 |
|--------------------------------------------------------------------|
26. | Connecticut .0487289 .0487289 5617.314 5617.314 |
27. | Alabama .0482474 .0482474 3416.563 -3416.563 |
28. | Georgia .0433774 .0433774 939.2884 -939.2884 |
29. | Nebraska .0429309 -.0429309 1231.4 -1231.4 |
30. | Missouri .0429018 .0429018 1460.693 1460.693 |
|--------------------------------------------------------------------|
31. | Maine .0362305 -.0362305 536.482 -536.482 |
32. | Michigan .0356351 .0356351 3208.876 3208.876 |
33. | New York .0335865 -.0335865 998.9494 998.9494 |
34. | Virginia .0332524 -.0332524 2706.413 2706.413 |
35. | Delaware .0329438 -.0329438 1970.206 1970.206 |
|--------------------------------------------------------------------|
36. | Ohio .024228 .024228 1017.316 1017.316 |
37. | California .0240138 -.0240138 294.7873 294.7873 |
38. | South Carolina .022419 .022419 1986.75 -1986.75 |
39. | Kansas .021283 -.021283 1001.302 -1001.302 |
40. | Vermont .0203959 -.0203959 328.0741 -328.0741 |
|--------------------------------------------------------------------|
41. | Utah .0203697 -.0203697 544.7642 -544.7642 |
42. | Arkansas .0185422 -.0185422 4460.403 -4460.403 |
43. | Oklahoma .0102179 -.0102179 2383.868 -2383.868 |
44. | Nevada .0080656 -.0080656 347.9611 347.9611 |
45. | Oregon .0072873 .0072873 241.7805 241.7805 |
|--------------------------------------------------------------------|
46. | Pennsylvania .0063625 -.0063625 230.294 -230.294 |
47. | Colorado .0056333 .0056333 4390.833 4390.833 |
48. | Indiana .0053708 -.0053708 165.3883 -165.3883 |
49. | Tennessee .0009869 .0009869 89.31062 89.31062 |
50. | North Carolina .0009033 .0009033 46.82497 -46.82497 |
|--------------------------------------------------------------------|
51. | Iowa .0008664 .0008664 17.83441 17.83441 |
+--------------------------------------------------------------------+
*most influential point on the slope of the line is DC.
. regress incwage NH_White_proportion
Source | SS df MS Number of obs = 51
-------------+------------------------------ F( 1, 49) = 2.14
Model | 18878316.5 1 18878316.5 Prob > F = 0.1500
Residual | 432407199 49 8824636.71 R-squared = 0.0418
-------------+------------------------------ Adj R-squared = 0.0223
Total | 451285515 50 9025710.3 Root MSE = 2970.6
------------------------------------------------------------------------------
incwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
NH_White_p~n | -3761.36 2571.649 -1.46 0.150 -8929.282 1406.562
_cons | 22161.23 2004.928 11.05 0.000 18132.18 26190.29
------------------------------------------------------------------------------
. * A student asked a terrific question: what units are the dfbetas in? The answer, according to the Stata manual, is that the dfbetas are in the units of the std error of the slope, which in this case is 2571. The dfbetas tell you how many standard errors the slope would be moved if that one point were excluded. So district of Columbia had a dfbeta of -.5903, meaning slope is made .5903*2571 lower by the presence of DC. Let's see if this is true.
. display 2571.649* .5903278
1518.1159
* Now let's run the regression without DC
. codebook statefip, tab(100)
-----------------------------------------------------------------------------------------------------------
statefip State (FIPS code)
-----------------------------------------------------------------------------------------------------------
type: numeric (byte)
label: statefiplbl
range: [1,56] units: 1
unique values: 51 missing .: 0/51
tabulation: Freq. Numeric Label
1 1 Alabama
1 2 Alaska
1 4 Arizona
1 5 Arkansas
1 6 California
1 8 Colorado
1 9 Connecticut
1 10 Delaware
1 11 District of Columbia
1 12 Florida
1 13 Georgia
1 15 Hawaii
1 16 Idaho
1 17 Illinois
1 18 Indiana
1 19 Iowa
1 20 Kansas
1 21 Kentucky
1 22 Louisiana
1 23 Maine
1 24 Maryland
1 25 Massachusetts
1 26 Michigan
1 27 Minnesota
1 28 Mississippi
1 29 Missouri
1 30 Montana
1 31 Nebraska
1 32 Nevada
1 33 New Hampshire
1 34 New Jersey
1 35 New Mexico
1 36 New York
1 37 North Carolina
1 38 North Dakota
1 39 Ohio
1 40 Oklahoma
1 41 Oregon
1 42 Pennsylvania
1 44 Rhode Island
1 45 South Carolina
1 46 South Dakota
1 47 Tennessee
1 48 Texas
1 49 Utah
1 50 Vermont
1 51 Virginia
1 53 Washington
1 54 West Virginia
1 55 Wisconsin
1 56 Wyoming
. *DC is statefip==11
. regress incwage NH_White_proportion if statefip~=11
Source | SS df MS Number of obs = 50
-------------+------------------------------ F( 1, 48) = 0.64
Model | 5576993.22 1 5576993.22 Prob > F = 0.4276
Residual | 418239982 48 8713332.96 R-squared = 0.0132
-------------+------------------------------ Adj R-squared = -0.0074
Total | 423816975 49 8649326.02 Root MSE = 2951.8
------------------------------------------------------------------------------
incwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
NH_White_p~n | -2252.848 2815.944 -0.80 0.428 -7914.684 3408.987
_cons | 20928.61 2214.384 9.45 0.000 16476.29 25380.93
------------------------------------------------------------------------------
. *Compare the two slopes:
. display 3761.36-2252.848
1508.512
. *And that is our DC dfbeta (almost but not exactly; I am not sure where the discrepancy comes from).
. log close
name: <unnamed>
log: C:\Users\Michael\Documents\newer web pages\soc_meth_proj3\fall_2012_381_logs\fifty_state_log.l
> og
log type: text
closed on: 1 Nov 2012, 15:55:48
-----------------------------------------------------------------------------------------------------------