You are on page 1of 8

ch3_wages

October 6, 2021

1 Chapter 3
1.1 3.6 Illustration: Explaining Individual Wages
We start by reading the “bwages” dataset into Stata.

[1]: use bwages, clear

Next we add labels to the variables

[2]: label var wage "before-tax hourly wage rate, in euros per hour"
label var male "1 if male, 0 if female"
label define malelab 1 male 0 female
label values male malelab
label var educ "education level"
label var exper "experience in years"
label define edulab 1 "primary school" 2 "lower vocational training" 3␣
,→"intermediate level"

label define edulab 4 "higher vocational training" 5 "university level", add


label values educ edulab

[3]: describe

Contains data from bwages.dta


obs: 1,472
vars: 7 14 May 2004 16:35
--------------------------------------------------------------------------------
storage display value
variable name type format label variable label
--------------------------------------------------------------------------------
wage float %9.0g before-tax hourly wage rate, in
euros per hour
lnwage float %9.0g
educ float %26.0g edulab education level
exper float %9.0g experience in years
lnexper float %9.0g
lneduc float %9.0g
male float %9.0g malelab 1 if male, 0 if female

1
--------------------------------------------------------------------------------
Sorted by:
Note: Dataset has changed since last saved.
And now we can use some “magics” to look at the data. Magics are commands provided by the
stata_kernel for jupyter. They are not Stata commands. Magics always start with “%”. For more
on Magics check here.

[4]: %head

+------------------------------------------------------------------+
1. | wage | lnwage | educ | exper | lnexper | lneduc |
| 7.780208 | 2.051583 | primary school | 23 | 3.178054 | 0 |
|------------------------------------------------------------------|
| male |
| male |
+------------------------------------------------------------------+

+------------------------------------------------------------------+
2. | wage | lnwage | educ | exper | lnexper | lneduc |
| 4.818504 | 1.572464 | primary school | 15 | 2.772589 | 0 |
|------------------------------------------------------------------|
| male |
| female |
+------------------------------------------------------------------+

+------------------------------------------------------------------+
3. | wage | lnwage | educ | exper | lnexper | lneduc |
| 10.56364 | 2.357418 | primary school | 31 | 3.465736 | 0 |
|------------------------------------------------------------------|
| male |
| male |
+------------------------------------------------------------------+

+------------------------------------------------------------------+
4. | wage | lnwage | educ | exper | lnexper | lneduc |
| 7.04243 | 1.951953 | primary school | 32 | 3.496508 | 0 |
|------------------------------------------------------------------|
| male |
| male |
+------------------------------------------------------------------+

+------------------------------------------------------------------+
5. | wage | lnwage | educ | exper | lnexper | lneduc |
| 7.887521 | 2.065282 | primary school | 9 | 2.302585 | 0 |
|------------------------------------------------------------------|
| male |
| male |
+------------------------------------------------------------------+

2
+------------------------------------------------------------------+
6. | wage | lnwage | educ | exper | lnexper | lneduc |
| 8.200056 | 2.104141 | primary school | 15 | 2.772589 | 0 |
|------------------------------------------------------------------|
| male |
| female |
+------------------------------------------------------------------+

+------------------------------------------------------------------+
7. | wage | lnwage | educ | exper | lnexper | lneduc |
| 8.214291 | 2.105875 | primary school | 26 | 3.295837 | 0 |
|------------------------------------------------------------------|
| male |
| male |
+------------------------------------------------------------------+

+------------------------------------------------------------------+
8. | wage | lnwage | educ | exper | lnexper | lneduc |
| 10.37832 | 2.339719 | primary school | 23 | 3.178054 | 0 |
|------------------------------------------------------------------|
| male |
| male |
+------------------------------------------------------------------+

+------------------------------------------------------------------+
9. | wage | lnwage | educ | exper | lnexper | lneduc |
| 10.95489 | 2.393786 | primary school | 13 | 2.639057 | 0 |
|------------------------------------------------------------------|
| male |
| male |
+------------------------------------------------------------------+

+------------------------------------------------------------------+
10. | wage | lnwage | educ | exper | lnexper | lneduc |
| 7.211448 | 1.97567 | primary school | 22 | 3.135494 | 0 |
|------------------------------------------------------------------|
| male |
| male |
+------------------------------------------------------------------+

Next we obtain the results in table 3.6

[5]: tabstat wage educ exper, stat(mean sd) by(male) nototal

3
Summary statistics: mean, sd
by categories of: male (1 if male, 0 if female)

male | wage educ exper


-------+------------------------------
female | 10.26154 3.587219 15.2038
| 3.808585 1.086521 9.704987
-------+------------------------------
male | 11.56223 3.243001 18.52296
| 4.753789 1.257386 10.25104
--------------------------------------
and to obtain Table 3.7 we do

[6]: regress wage male educ exper

Source | SS df MS Number of obs = 1,472


-------------+---------------------------------- F(3, 1468) = 281.98
Model | 10651.6554 3 3550.55181 Prob > F = 0.0000
Residual | 18484.5373 1,468 12.5916467 R-squared = 0.3656
-------------+---------------------------------- Adj R-squared = 0.3643
Total | 29136.1928 1,471 19.8070651 Root MSE = 3.5485

------------------------------------------------------------------------------
wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | 1.346144 .1927364 6.98 0.000 .9680761 1.724212
educ | 1.98609 .0806396 24.63 0.000 1.827909 2.144271
exper | .1922751 .0095831 20.06 0.000 .1734771 .2110731
_cons | .2136922 .386895 0.55 0.581 -.5452338 .9726183
------------------------------------------------------------------------------
In table 3.8 we add exper2 as an additional regressor.

[7]: regress wage male educ c.exper##c.exper

Source | SS df MS Number of obs = 1,472


-------------+---------------------------------- F(4, 1467) = 223.20
Model | 11023.4381 4 2755.85953 Prob > F = 0.0000
Residual | 18112.7546 1,467 12.3467993 R-squared = 0.3783
-------------+---------------------------------- Adj R-squared = 0.3766
Total | 29136.1928 1,471 19.8070651 Root MSE = 3.5138

------------------------------------------------------------------------------
wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | 1.333693 .1908668 6.99 0.000 .9592925 1.708094
educ | 1.988127 .0798526 24.90 0.000 1.831489 2.144764

4
exper | .3579993 .0316566 11.31 0.000 .2959024 .4200963
|
c.exper#|
c.exper | -.0043692 .0007962 -5.49 0.000 -.005931 -.0028073
|
_cons | -.8924851 .4329127 -2.06 0.039 -1.741679 -.0432912
------------------------------------------------------------------------------
and Stata has a command that will automatically produce Figure 3.1:

[8]: rvfplot
30
20
Residuals
10
0
-10

0 5 10 15 20
Fitted values

We now proceed to estimation of the model in Table 3.9. The dependent variable is now the
logarithm of wage.

[9]: regress lnwage male lneduc c.lnexper##c.lnexper

Source | SS df MS Number of obs = 1,472


-------------+---------------------------------- F(4, 1467) = 223.13
Model | 73.1312577 4 18.2828144 Prob > F = 0.0000
Residual | 120.204562 1,467 .081939033 R-squared = 0.3783
-------------+---------------------------------- Adj R-squared = 0.3766
Total | 193.33582 1,471 .131431557 Root MSE = .28625

5
------------------------------------------------------------------------------
lnwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | .1179433 .0155711 7.57 0.000 .0873993 .1484874
lneduc | .4421763 .0181921 24.31 0.000 .4064911 .4778616
lnexper | .1098205 .0543838 2.02 0.044 .0031421 .2164988
|
c.lnexper#|
c.lnexper | .0260073 .0114762 2.27 0.024 .0034958 .0485188
|
_cons | 1.262706 .0663418 19.03 0.000 1.132571 1.39284
------------------------------------------------------------------------------
and we replicate Figure 3.2

[10]: rvfplot
1
0
Residuals
-1
-2

1.5 2 2.5 3
Fitted values

And next we implement the test on (3.41)

[11]: test lnexper c.lnexper#c.lnexper

( 1) lnexper = 0

6
( 2) c.lnexper#c.lnexper = 0

F( 2, 1467) = 234.09
Prob > F = 0.0000
To replicate Table 3.11 we do

[12]: regress lnwage male ib1.educ lnexper

Source | SS df MS Number of obs = 1,472


-------------+---------------------------------- F(6, 1465) = 161.14
Model | 76.8667701 6 12.8111284 Prob > F = 0.0000
Residual | 116.46905 1,465 .079501058 R-squared = 0.3976
-------------+---------------------------------- Adj R-squared = 0.3951
Total | 193.33582 1,471 .131431557 Root MSE = .28196

-------------------------------------------------------------------------------
lnwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
--------------+----------------------------------------------------------------
male | .1176238 .0154565 7.61 0.000 .0873046 .147943
|
educ |
lower voca.. | .1436364 .0333578 4.31 0.000 .0782023 .2090705
intermedia.. | .3048744 .0320225 9.52 0.000 .2420596 .3676892
higher voc.. | .4742768 .0330129 14.37 0.000 .4095192 .5390344
university.. | .6391026 .0332227 19.24 0.000 .5739335 .7042718
|
lnexper | .2302227 .010559 21.80 0.000 .2095104 .250935
_cons | 1.271888 .0448344 28.37 0.000 1.183942 1.359835
-------------------------------------------------------------------------------
Next we estimate the regression in Table 3.12

[13]: regress lnwage i.male##ib1.educ i.male##c.lnexper

Source | SS df MS Number of obs = 1,472


-------------+---------------------------------- F(11, 1460) = 89.69
Model | 77.9624965 11 7.08749968 Prob > F = 0.0000
Residual | 115.373323 1,460 .079022824 R-squared = 0.4032
-------------+---------------------------------- Adj R-squared = 0.3988
Total | 193.33582 1,471 .131431557 Root MSE = .28111

-------------------------------------------------------------------------------
lnwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
--------------+----------------------------------------------------------------
male |
male | .1537538 .0952221 1.61 0.107 -.0330329 .3405406
|

7
educ |
lower voca.. | .224107 .0675788 3.32 0.001 .0915451 .3566689
intermedia.. | .4331904 .06323 6.85 0.000 .3091591 .5572217
higher voc.. | .6019133 .0627983 9.58 0.000 .4787287 .7250979
university.. | .7549128 .0646697 11.67 0.000 .6280575 .8817682
|
male#educ |
male #|
lower voca.. | -.0965098 .0776958 -1.24 0.214 -.2489171 .0558975
male #|
intermedia.. | -.1667745 .0733953 -2.27 0.023 -.310746 -.022803
male #|
higher voc.. | -.1723635 .0744036 -2.32 0.021 -.3183129 -.0264141
male #|
university.. | -.1461569 .0755141 -1.94 0.053 -.2942846 .0019708
|
lnexper | .207439 .0165491 12.53 0.000 .1749765 .2399015
|
male#|
c.lnexper |
male | .040632 .0214915 1.89 0.059 -.0015256 .0827896
|
_cons | 1.215836 .0776769 15.65 0.000 1.063466 1.368206
-------------------------------------------------------------------------------
And we test if all interactions with male are identical to 0

[14]: test 1.male#2.educ 1.male#3.educ 1.male#4.educ 1.male#5.educ 1.male#c.lnexper

( 1) 1.male#2.educ = 0
( 2) 1.male#3.educ = 0
( 3) 1.male#4.educ = 0
( 4) 1.male#5.educ = 0
( 5) 1.male#c.lnexper = 0

F( 5, 1460) = 2.77
Prob > F = 0.0168

You might also like