-----------------------------------------------------------------------------------
name: <unnamed>
log: C:\Documents and Settings\Michael Rosenfeld\My Documents\newer web pag
> es\soc_meth_proj3\fall_2010_s381_logs\class12.log
log type: text
opened on: 28 Oct 2010, 13:37:00
. use "C:\Documents and Settings\Michael Rosenfeld\Desktop\cps_mar_2000_new.dta", c
> lear
. tabulate disabwrk
Work disability | Freq. Percent Cum.
-----------------------------------+-----------------------------------
NIU | 30,484 22.80 22.80
No disability that affects work | 93,260 69.75 92.55
Disability limits or prevents work | 9,966 7.45 100.00
-----------------------------------+-----------------------------------
Total | 133,710 100.00
. codebook disabwrk
-----------------------------------------------------------------------------------
disabwrk Work disability
-----------------------------------------------------------------------------------
type: numeric (byte)
label: disabwrklbl
range: [0,2] units: 1
unique values: 3 missing .: 0/133710
tabulation: Freq. Numeric Label
30484 0 NIU
93260 1 No disability that affects work
9966 2 Disability limits or prevents
work
. gen byte disability=0 if disabwrk~=0
(30484 missing values generated)
. replace disability=1 if disabwrk==2
(9966 real changes made)
. tabulate disabwrk disability
| disability
Work disability | 0 1 | Total
----------------------+----------------------+----------
No disability that af | 93,260 0 | 93,260
Disability limits or | 0 9,966 | 9,966
----------------------+----------------------+----------
Total | 93,260 9,966 | 103,226
*generating a new dichotomous disability variable.
. regress disability i.sex i.race i.metro yrsed age age_sq if age>25 & age<65
Source | SS df MS Number of obs = 67639
-------------+------------------------------ F( 11, 67627) = 327.29
Model | 264.125019 11 24.0113653 Prob > F = 0.0000
Residual | 4961.35028 67627 .073363454 R-squared = 0.0505
-------------+------------------------------ Adj R-squared = 0.0504
Total | 5225.4753 67638 .077256502 Root MSE = .27086
------------------------------------------------------------------------------
disability | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
2.sex | -.0001482 .0020852 -0.07 0.943 -.0042351 .0039388
|
race |
200 | .0526776 .0036395 14.47 0.000 .0455442 .059811
300 | .0248199 .0093662 2.65 0.008 .0064622 .0431776
650 | -.0144049 .005611 -2.57 0.010 -.0254025 -.0034072
|
metro |
1 | -.0182697 .0196259 -0.93 0.352 -.0567365 .0201971
2 | -.02261 .0196241 -1.15 0.249 -.0610732 .0158533
3 | -.0388436 .0195692 -1.98 0.047 -.0771991 -.000488
4 | -.0213151 .0196876 -1.08 0.279 -.0599027 .0172726
|
yrsed | -.0125924 .0003485 -36.14 0.000 -.0132754 -.0119094
age | -.0032133 .0008696 -3.70 0.000 -.0049177 -.001509
age_sq | .000082 9.79e-06 8.37 0.000 .0000628 .0001012
_cons | .2531735 .0271089 9.34 0.000 .2000401 .3063068
------------------------------------------------------------------------------
. predict m2
(option xb assumed; fitted values)
(30484 missing values generated)
. summarize m2
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
m2 | 103226 .1120133 .1027941 -.0457735 .657851
. label define disability 0 "not disabled" 1 "disabled"
. label var disability
*actual class started here.
. regress disability i.sex i.race i.metro yrsed age age_sq if age>25 & age<65
Source | SS df MS Number of obs = 67639
-------------+------------------------------ F( 11, 67627) = 327.29
Model | 264.125019 11 24.0113653 Prob > F = 0.0000
Residual | 4961.35028 67627 .073363454 R-squared = 0.0505
-------------+------------------------------ Adj R-squared = 0.0504
Total | 5225.4753 67638 .077256502 Root MSE = .27086
------------------------------------------------------------------------------
disability | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
2.sex | -.0001482 .0020852 -0.07 0.943 -.0042351 .0039388
|
race |
200 | .0526776 .0036395 14.47 0.000 .0455442 .059811
300 | .0248199 .0093662 2.65 0.008 .0064622 .0431776
650 | -.0144049 .005611 -2.57 0.010 -.0254025 -.0034072
|
metro |
1 | -.0182697 .0196259 -0.93 0.352 -.0567365 .0201971
2 | -.02261 .0196241 -1.15 0.249 -.0610732 .0158533
3 | -.0388436 .0195692 -1.98 0.047 -.0771991 -.000488
4 | -.0213151 .0196876 -1.08 0.279 -.0599027 .0172726
|
yrsed | -.0125924 .0003485 -36.14 0.000 -.0132754 -.0119094
age | -.0032133 .0008696 -3.70 0.000 -.0049177 -.001509
age_sq | .000082 9.79e-06 8.37 0.000 .0000628 .0001012
_cons | .2531735 .0271089 9.34 0.000 .2000401 .3063068
------------------------------------------------------------------------------
. predict dis_ols
(option xb assumed; fitted values)
(30484 missing values generated)
. summarize dis_ols
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
dis_ols | 103226 .1120133 .1027941 -.0457735 .657851
*Hey! Using OLS we get some predicted values that are out of range! Probabilities less than zero don't compute…
. logistic disability i.sex i.race i.metro yrsed age age_sq if age>25 & age<65
Logistic regression Number of obs = 67639
LR chi2(11) = 3165.03
Prob > chi2 = 0.0000
Log likelihood = -17987.159 Pseudo R2 = 0.0809
------------------------------------------------------------------------------
disability | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
2.sex | .9946927 .0283998 -0.19 0.852 .9405589 1.051942
|
race |
200 | 1.832577 .0774789 14.33 0.000 1.686843 1.990902
300 | 1.379887 .1548628 2.87 0.004 1.107425 1.719383
650 | .6733486 .065552 -4.06 0.000 .5563826 .8149039
|
metro |
1 | .8163698 .1921921 -0.86 0.389 .5146294 1.295028
2 | .7479814 .1762709 -1.23 0.218 .4712971 1.187099
3 | .6029641 .1417226 -2.15 0.031 .380384 .9557859
4 | .7755657 .1834042 -1.07 0.282 .4878971 1.232846
|
yrsed | .8679395 .0035814 -34.32 0.000 .8609485 .8749873
age | 1.068404 .0136164 5.19 0.000 1.042047 1.095427
age_sq | .999849 .0001364 -1.11 0.268 .9995818 1.000116
------------------------------------------------------------------------------
. predict dis_log
(option pr assumed; Pr(disability))
(30484 missing values generated)
. summarize dis_log
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
dis_log | 103226 .1083794 .1182868 .0064729 .8916753
* But with our friend logistic regression, all predicted probabilities must be between zero and one.
. logistic disability i.sex i.race i.metro yrsed age age_sq if age>25 & age<65, coef
Logistic regression Number of obs = 67639
LR chi2(11) = 3165.03
Prob > chi2 = 0.0000
Log likelihood = -17987.159 Pseudo R2 = 0.0809
------------------------------------------------------------------------------
disability | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
2.sex | -.0053214 .0285513 -0.19 0.852 -.061281 .0506382
|
race |
200 | .6057231 .0422787 14.33 0.000 .5228584 .6885878
300 | .3220015 .1122286 2.87 0.004 .1020374 .5419655
650 | -.3954921 .0973523 -4.06 0.000 -.5862991 -.204685
|
metro |
1 | -.2028878 .2354229 -0.86 0.389 -.6643082 .2585326
2 | -.2903771 .2356622 -1.23 0.218 -.7522665 .1715123
3 | -.5058976 .2350432 -2.15 0.031 -.9665739 -.0452213
4 | -.2541626 .2364779 -1.07 0.282 -.7176508 .2093257
|
yrsed | -.1416333 .0041263 -34.32 0.000 -.1497206 -.1335459
age | .0661656 .0127446 5.19 0.000 .0411866 .0911445
age_sq | -.000151 .0001364 -1.11 0.268 -.0004183 .0001163
_cons | -2.982072 .3718045 -8.02 0.000 -3.710795 -2.253349
------------------------------------------------------------------------------
* Logistic regression either can generate coefficients (which take a normal distribution), or else exponentiated coefficients which are odds ratios, and which are constrained to be positive.
. log close
name: <unnamed>
log: C:\Documents and Settings\Michael Rosenfeld\My Documents\newer web pages\soc
> _meth_proj3\fall_2010_s381_logs\class12.log
log type: text
closed on: 28 Oct 2010, 15:33:32
-----------------------------------------------------------------------------------------