--------------------------------------------------------------------------------------------------------------
name: <unnamed>
log: C:\Users\Michael\Documents\newer web pages\soc_meth_proj3\fall_2016_logs\class6.log
log type: text
opened on: 12 Oct 2016, 10:12:46
. use "C:\Users\Michael\Desktop\cps_mar_2000_new_unchanged.dta", clear
. codebook occ1990, tab(1000)
--------------------------------------------------------------------------------------------------------------
occ1990 Occupation, 1990 basis
--------------------------------------------------------------------------------------------------------------
type: numeric (int)
label: occ1990lbl
range: [4,999] units: 1
unique values: 379 missing .: 0/133710
tabulation: Freq. Numeric Label
14 4 Chief executives and public
administrators
362 7 Financial managers
125 8 Human resources and labor
relations managers
450 13 Managers and specialists in
marketing, advertising, and
public relations
443 14 Managers in education and
related fields
374 15 Managers of medicine and health
occupations
747 17 Managers of food-serving and
lodging establishments
279 18 Managers of properties and real
estate
--Break--
r(1);
*Because there are so many occupations, it is easier in HW2 to generate the dummy variables by hand as follows. For a comparison between two occupations, you need one dummy variable. For a comparison among 3 occupations, you need two dummy variables. With k categories you will always have k-1 dummy variables, because the constant term absorbs the comparison, or first category.
. gen byte nurses=0
. replace nurses=1 if occ1990==95
(966 real changes made)
. gen byte lawyers=0
. replace lawyers=1 if occ1990==178
(441 real changes made)
. regress inctot nurses lawyers
Source | SS df MS Number of obs = 103226
-------------+------------------------------ F( 2,103223) = 1294.98
Model | 2.5972e+12 2 1.2986e+12 Prob > F = 0.0000
Residual | 1.0351e+14103223 1.0028e+09 R-squared = 0.0245
-------------+------------------------------ Adj R-squared = 0.0245
Total | 1.0611e+14103225 1.0279e+09 Root MSE = 31667
------------------------------------------------------------------------------
inctot | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
nurses | 15233.13 1023.69 14.88 0.000 13226.71 17239.55
lawyers | 73688.55 1511.213 48.76 0.000 70726.59 76650.51
_cons | 25554.04 99.24125 257.49 0.000 25359.52 25748.55
------------------------------------------------------------------------------
*If we don’t limit ourselves to only nurses, lawyers, and sociologists, the n is much larger, and the constant in the above model is the actual average inctot for everyone except the nurses and lawyers.
. regress inctot nurses lawyers if occ1990==178| occ1990==95| occ1990==125
Source | SS df MS Number of obs = 1413
-------------+------------------------------ F( 2, 1410) = 262.68
Model | 1.0359e+12 2 5.1795e+11 Prob > F = 0.0000
Residual | 2.7802e+12 1410 1.9718e+09 R-squared = 0.2715
-------------+------------------------------ Adj R-squared = 0.2704
Total | 3.8161e+12 1412 2.7026e+09 Root MSE = 44405
------------------------------------------------------------------------------
inctot | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
nurses | -3576.166 18184.46 -0.20 0.844 -39247.68 32095.35
lawyers | 54879.25 18251.16 3.01 0.003 19076.91 90681.59
_cons | 44363.33 18128.25 2.45 0.015 8802.086 79924.58
------------------------------------------------------------------------------
* If we limit ourselves to the 3 occupations above, notice that the constant is the actual income of sociologists, and the nurses and lawyers are compared to sociologists.
. table occ1990 if occ1990==178| occ1990==95| occ1990==125, contents(freq mean inctot)
--------------------------------------------------
Occupation, 1990 |
basis | Freq. mean(inctot)
----------------------+---------------------------
Registered nurses | 966 40787.1677
Sociology instructors | 6 44363.33333
Lawyers | 441 99242.58277
--------------------------------------------------
. display 40787-44363
-3576
. exit, clear