--------------------------------------------------------------------------------------------------
name: <unnamed>
log: C:\Users\mexmi\Documents\newer web pages\soc_meth_proj3\Soc180B_spr2019_logs\class10_
> log.log
log type: text
opened on: 2 May 2019, 13:27:44
. use "C:\Users\mexmi\Desktop\cps_mar_2000_new.dta", clear
. *class starts here
*In class we talked about how to fill in the big regression table in HW3, Q1.
* First you need to create variables for Vietnam veteran and age squared.
. gen age_sq=age^2
. codebook vetlast
--------------------------------------------------------------------------------------------------
vetlast Veteran's most recent period of service
--------------------------------------------------------------------------------------------------
type: numeric (byte)
label: vetlastlbl
range: [0,9] units: 1
unique values: 6 missing .: 0/133710
tabulation: Freq. Numeric Label
30904 0 NIU
91149 1 No service
2428 4 World War II
1716 6 Korean War
3683 8 Vietnam Era
3830 9 Other service
. gen vietnam_vet=0
. replace vietnam_vet=1 if vetlast==8
(3683 real changes made)
. label define vietnam_vet_lbl 0 "not Vietnam vet" 1 "Vietnam vet"
* You don’t need the labels for Vietnam vet, but I find them helpful.
. label val vietnam_vet vietnam_vet_lbl
. tabulate vetlast vietnam_vet
Veteran's most recent | vietnam_vet
period of service | not Vietn Vietnam v | Total
----------------------+----------------------+----------
NIU | 30,904 0 | 30,904
No service | 91,149 0 | 91,149
World War II | 2,428 0 | 2,428
Korean War | 1,716 0 | 1,716
Vietnam Era | 0 3,683 | 3,683
Other service | 3,830 0 | 3,830
----------------------+----------------------+----------
Total | 130,027 3,683 | 133,710
* When you make a new variable, always tabulate it against the old variable, just to make sure you have coded it correctly. It looks alright here!
* Now I am going to generate the regression equation for model 5, HW3, Q1:
. regress incwage vietnam_vet age age_sq i.sex yrsed if age>=25 & age<=64 [aweight= perwt_rounded]
(sum of wgt is 1.4261e+08)
Source | SS df MS Number of obs = 69305
-------------+------------------------------ F( 5, 69299) = 3127.96
Model | 1.3427e+13 5 2.6853e+12 Prob > F = 0.0000
Residual | 5.9492e+13 69299 858488914 R-squared = 0.1841
-------------+------------------------------ Adj R-squared = 0.1841
Total | 7.2919e+13 69304 1.0522e+09 Root MSE = 29300
------------------------------------------------------------------------------
incwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
vietnam_vet | 1035.18 532.7493 1.94 0.052 -9.007979 2079.367
age | 2848.096 87.34381 32.61 0.000 2676.902 3019.29
age_sq | -31.92762 .9924702 -32.17 0.000 -33.87286 -29.98238
|
sex |
Female | -16607.58 228.9415 -72.54 0.000 -17056.3 -16158.85
yrsed | 3540.933 38.50133 91.97 0.000 3465.47 3616.395
_cons | -71687.23 1898.127 -37.77 0.000 -75407.55 -67966.9
------------------------------------------------------------------------------
* icnwage is the dependent variable, or outcome variable, and it comes after “regress” in every model.
* You should use the above syntax for M5, and then reduce the predictor variable set to generate M4, M3, M2, and M1, thusly:
M4: regress incwage vietnam_vet age age_sq i.sex if age>=25 & age<=64 [aweight= perwt_rounded]
M3: regress incwage vietnam_vet age i.sex if age>=25 & age<=64 [aweight= perwt_rounded]
M2: regress incwage vietnam_vet i.sex if age>=25 & age<=64 [aweight= perwt_rounded]
M1: regress incwage vietnam_vet if age>=25 & age<=64 [aweight= perwt_rounded]
Note that the age filter (the “if age>=25 & age<=64” part is the same in every model. And note that the [aweight= perwt_rounded] is always present as well. The number of observations, n, is =69305 across all models M1-M5 if you have entered the commands correctly.
. log close
name: <unnamed>
log: C:\Users\mexmi\Documents\newer web pages\soc_meth_proj3\Soc180B_spr2019_logs\class10_
> log.log
log type: text
closed on: 2 May 2019, 16:21:55
--------------------------------------------------------------------------------------------------