------------------------------------------------------------------------------------------
name: <unnamed>
log: C:\Users\Michael\Documents\newer web pages\soc_meth_proj3\soc_180B_win2013\cl
> ass7.log
log type: text
opened on: 31 Jan 2013, 13:34:46
. use "C:\Users\Michael\Documents\current class files\intro soc methods\cps_mar_2000_new with additional vars.dta", clear
. regress yrsed male if age>=25 & age<=34
Source | SS df MS Number of obs = 18538
-------------+------------------------------ F( 1, 18536) = 32.68
Model | 276.742433 1 276.742433 Prob > F = 0.0000
Residual | 156979.922 18536 8.46892111 R-squared = 0.0018
-------------+------------------------------ Adj R-squared = 0.0017
Total | 157256.664 18537 8.48339343 Root MSE = 2.9101
------------------------------------------------------------------------------
yrsed | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | -.2444469 .0427623 -5.72 0.000 -.3282649 -.1606289
_cons | 13.55657 .0298401 454.31 0.000 13.49808 13.61506
------------------------------------------------------------------------------
. tabulate sex male
| male
Sex | 0 1 | Total
-----------+----------------------+----------
Male | 0 64,791 | 64,791
Female | 68,919 0 | 68,919
-----------+----------------------+----------
Total | 68,919 64,791 | 133,710
. tabulate sex female
| female
Sex | 0 1 | Total
-----------+----------------------+----------
Male | 64,791 0 | 64,791
Female | 0 68,919 | 68,919
-----------+----------------------+----------
Total | 64,791 68,919 | 133,710
. regress yrsed female if age>=25 & age<=34
Source | SS df MS Number of obs = 18538
-------------+------------------------------ F( 1, 18536) = 32.68
Model | 276.742433 1 276.742433 Prob > F = 0.0000
Residual | 156979.922 18536 8.46892111 R-squared = 0.0018
-------------+------------------------------ Adj R-squared = 0.0017
Total | 157256.664 18537 8.48339343 Root MSE = 2.9101
------------------------------------------------------------------------------
yrsed | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
female | .2444469 .0427623 5.72 0.000 .1606289 .3282649
_cons | 13.31212 .0306297 434.62 0.000 13.25208 13.37216
------------------------------------------------------------------------------
. regress yrsed male if age>=25 & age<=34
Source | SS df MS Number of obs = 18538
-------------+------------------------------ F( 1, 18536) = 32.68
Model | 276.742433 1 276.742433 Prob > F = 0.0000
Residual | 156979.922 18536 8.46892111 R-squared = 0.0018
-------------+------------------------------ Adj R-squared = 0.0017
Total | 157256.664 18537 8.48339343 Root MSE = 2.9101
------------------------------------------------------------------------------
yrsed | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | -.2444469 .0427623 -5.72 0.000 -.3282649 -.1606289
_cons | 13.55657 .0298401 454.31 0.000 13.49808 13.61506
------------------------------------------------------------------------------
* When we run the regressions with male compared to female, or female compared to male, what changes and what stays the same? The coefficient changes sign, and the constant change, so when the dummy variable is male the constant is female ed, and when the dummy variable is female the constant is male ed. The coefficient of the gender coefficient changes sign, the standard error stays the same, and the T-statistic changes sign. The R-squared (a measure of model fit) is the same in both of the above two models because the model is exactly the same, just the comparison category is different.
. 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
--------------------------------------------------
. ttest inctot if occ1990==178 | occ1990==95, by(occ1990)
Two-sample t test with equal variances
------------------------------------------------------------------------------
Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
Register | 966 40787.17 738.1285 22941.43 39338.65 42235.69
Lawyers | 441 99242.58 3421.936 71860.66 92517.21 105968
---------+--------------------------------------------------------------------
combined | 1407 59109.01 1388.629 52087.47 56385.01 61833.02
---------+--------------------------------------------------------------------
diff | -58455.42 2556.381 -63470.15 -53440.68
------------------------------------------------------------------------------
diff = mean(Register) - mean(Lawyers) t = -22.8665
Ho: diff = 0 degrees of freedom = 1405
Ha: diff < 0 Ha: diff != 0 Ha: diff > 0
Pr(T < t) = 0.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 1.0000
* equal variance ttest for nurses compared to lawyers.
. regress inctot lawyers if occ1990==178 | occ1990==95
Source | SS df MS Number of obs = 1407
-------------+------------------------------ F( 1, 1405) = 522.88
Model | 1.0346e+12 1 1.0346e+12 Prob > F = 0.0000
Residual | 2.7800e+12 1405 1.9787e+09 R-squared = 0.2712
-------------+------------------------------ Adj R-squared = 0.2707
Total | 3.8146e+12 1406 2.7131e+09 Root MSE = 44482
------------------------------------------------------------------------------
inctot | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
lawyers | 58455.42 2556.381 22.87 0.000 53440.68 63470.15
_cons | 40787.17 1431.192 28.50 0.000 37979.66 43594.67
------------------------------------------------------------------------------
* OLS regression for the same comparison. Notice how it’s the same?
. regress inctot nurses if occ1990==178 | occ1990==95
Source | SS df MS Number of obs = 1407
-------------+------------------------------ F( 1, 1405) = 522.88
Model | 1.0346e+12 1 1.0346e+12 Prob > F = 0.0000
Residual | 2.7800e+12 1405 1.9787e+09 R-squared = 0.2712
-------------+------------------------------ Adj R-squared = 0.2707
Total | 3.8146e+12 1406 2.7131e+09 Root MSE = 44482
------------------------------------------------------------------------------
inctot | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
nurses | -58455.42 2556.381 -22.87 0.000 -63470.15 -53440.68
_cons | 99242.58 2118.201 46.85 0.000 95087.41 103397.8
------------------------------------------------------------------------------
* nurses compared to lawyers.
. regress inctot nurses if occ1990==178 | occ1990==95 |occ1990==125
Source | SS df MS Number of obs = 1413
-------------+------------------------------ F( 1, 1411) = 513.39
Model | 1.0181e+12 1 1.0181e+12 Prob > F = 0.0000
Residual | 2.7981e+12 1411 1.9830e+09 R-squared = 0.2668
-------------+------------------------------ Adj R-squared = 0.2663
Total | 3.8161e+12 1412 2.7026e+09 Root MSE = 44531
------------------------------------------------------------------------------
inctot | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
nurses | -57718.78 2547.384 -22.66 0.000 -62715.85 -52721.71
_cons | 98505.95 2106.259 46.77 0.000 94374.21 102637.7
------------------------------------------------------------------------------
*nurses compared to the average of (lawyers and sociologists).
. regress inctot nurses sociologists 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 | -58455.42 2551.942 -22.91 0.000 -63461.43 -53449.4
sociologists | -54879.25 18251.16 -3.01 0.003 -90681.59 -19076.91
_cons | 99242.58 2114.522 46.93 0.000 95094.63 103390.5
------------------------------------------------------------------------------
* Here we have nurses and sociologists each compared to lawyers, but note: the std error and T-statistic is a little different here from the nurse-lawyer comparison we have above. Why? Well, adding the sociologists into the mix changes the everyone’s income variance in an equal variance test, so even the nurse-lawyer comparison is changed a little from the comparison we are used to, the one below.
. regress inctot nurses if occ1990==178 | occ1990==95
Source | SS df MS Number of obs = 1407
-------------+------------------------------ F( 1, 1405) = 522.88
Model | 1.0346e+12 1 1.0346e+12 Prob > F = 0.0000
Residual | 2.7800e+12 1405 1.9787e+09 R-squared = 0.2712
-------------+------------------------------ Adj R-squared = 0.2707
Total | 3.8146e+12 1406 2.7131e+09 Root MSE = 44482
------------------------------------------------------------------------------
inctot | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
nurses | -58455.42 2556.381 -22.87 0.000 -63470.15 -53440.68
_cons | 99242.58 2118.201 46.85 0.000 95087.41 103397.8
------------------------------------------------------------------------------
. regress inctot nurses if occ1990==178 | occ1990==95 |occ1990==125
Source | SS df MS Number of obs = 1413
-------------+------------------------------ F( 1, 1411) = 513.39
Model | 1.0181e+12 1 1.0181e+12 Prob > F = 0.0000
Residual | 2.7981e+12 1411 1.9830e+09 R-squared = 0.2668
-------------+------------------------------ Adj R-squared = 0.2663
Total | 3.8161e+12 1412 2.7026e+09 Root MSE = 44531
------------------------------------------------------------------------------
inctot | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
nurses | -57718.78 2547.384 -22.66 0.000 -62715.85 -52721.71
_cons | 98505.95 2106.259 46.77 0.000 94374.21 102637.7
------------------------------------------------------------------------------
* above, nurses compared to the average of (sociologists and lawyers)
. regress inctot nurses
Source | SS df MS Number of obs = 103226
-------------+------------------------------ F( 1,103224) = 207.52
Model | 2.1289e+11 1 2.1289e+11 Prob > F = 0.0000
Residual | 1.0590e+14103224 1.0259e+09 R-squared = 0.0020
-------------+------------------------------ Adj R-squared = 0.0020
Total | 1.0611e+14103225 1.0279e+09 Root MSE = 32029
------------------------------------------------------------------------------
inctot | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
nurses | 14915.35 1035.387 14.41 0.000 12886 16944.69
_cons | 25871.82 100.1605 258.30 0.000 25675.51 26068.13
------------------------------------------------------------------------------
* nurses compared to all non-nurses
. log close
name: <unnamed>
log: C:\Users\Michael\Documents\newer web pages\soc_meth_proj3\soc_180B_win2013\cl
> ass7.log
log type: text
closed on: 31 Jan 2013, 15:54:08
------------------------------------------------------------------------------------------