------------------------------------------------------------------------------------------------------------------------------------------------ log: D:\Stata10\mylogjan.log log type: text opened on: 8 Jan 2016, 13:39:43 . use "C:\Users\110g093\Documents\WAGE2.DTA", clear . save "C:\Users\110g093\Documents\mydata_wage2.dta" file C:\Users\110g093\Documents\mydata_wage2.dta saved . describe Contains data from C:\Users\110g093\Documents\mydata_wage2.dta obs: 935 vars: 17 8 Jan 2016 14:01 size: 24,310 (99.8% of memory free) ------------------------------------------------------------------------------------------------------------------------------------------------ storage display value variable name type format label variable label ------------------------------------------------------------------------------------------------------------------------------------------------ wage int %9.0g monthly earnings hours byte %9.0g average weekly hours IQ int %9.0g IQ score KWW byte %9.0g knowledge of world work score educ byte %9.0g years of education exper byte %9.0g years of work experience tenure byte %9.0g years with current employer age byte %9.0g age in years married byte %9.0g =1 if married black byte %9.0g =1 if black south byte %9.0g =1 if live in south urban byte %9.0g =1 if live in SMSA sibs byte %9.0g number of siblings brthord byte %9.0g birth order meduc byte %9.0g mother's education feduc byte %9.0g father's education lwage float %9.0g natural log of wage ------------------------------------------------------------------------------------------------------------------------------------------------ Sorted by: . summarize wage hours IQ KWW educ exper tenure age married black south urban sibs brthord meduc feduc lwage Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- wage | 935 957.9455 404.3608 115 3078 hours | 935 43.92941 7.224256 20 80 IQ | 935 101.2824 15.05264 50 145 KWW | 935 35.74439 7.638788 12 56 educ | 935 13.46845 2.196654 9 18 -------------+-------------------------------------------------------- exper | 935 11.56364 4.374586 1 23 tenure | 935 7.234225 5.075206 0 22 age | 935 33.08021 3.107803 28 38 married | 935 .8930481 .3092174 0 1 black | 935 .1283422 .3346495 0 1 -------------+-------------------------------------------------------- south | 935 .3411765 .4743582 0 1 urban | 935 .7176471 .4503851 0 1 sibs | 935 2.941176 2.306254 0 14 brthord | 852 2.276995 1.595613 1 10 meduc | 857 10.68261 2.849756 0 18 -------------+-------------------------------------------------------- feduc | 741 10.21727 3.3007 0 18 lwage | 935 6.779004 .4211439 4.744932 8.032035 . * generate a new variable . gen wagesq= wage*wage . sum wage wagesq Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- wage | 935 957.9455 404.3608 115 3078 wagesq | 935 1080992 1014528 13225 9474084 . tabulate educ years of | education | Freq. Percent Cum. ------------+----------------------------------- 9 | 10 1.07 1.07 10 | 35 3.74 4.81 11 | 43 4.60 9.41 12 | 393 42.03 51.44 13 | 85 9.09 60.53 14 | 77 8.24 68.77 15 | 45 4.81 73.58 16 | 150 16.04 89.63 17 | 40 4.28 93.90 18 | 57 6.10 100.00 ------------+----------------------------------- Total | 935 100.00 . tabulate educ black years of | =1 if black education | 0 1 | Total -----------+----------------------+---------- 9 | 6 4 | 10 10 | 26 9 | 35 11 | 34 9 | 43 12 | 330 63 | 393 13 | 77 8 | 85 14 | 66 11 | 77 15 | 40 5 | 45 16 | 141 9 | 150 17 | 39 1 | 40 18 | 56 1 | 57 -----------+----------------------+---------- Total | 815 120 | 935 . by married, sort: summarize wage ------------------------------------------------------------------------------------------------------------------------------------------------ -> married = 0 Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- wage | 100 798.44 343.2095 310 1899 ------------------------------------------------------------------------------------------------------------------------------------------------ -> married = 1 Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- wage | 835 977.0479 407.0803 115 3078 . tab meduc feduc mother's | father's education education | 0 2 3 4 5 6 7 8 9 10 | Total -----------+--------------------------------------------------------------------------------------------------------------+---------- 0 | 0 1 0 0 1 0 0 0 0 1 | 3 1 | 0 0 0 1 0 0 0 0 0 0 | 1 2 | 0 0 0 0 1 0 0 3 0 1 | 5 3 | 0 1 1 3 0 0 2 0 0 0 | 7 4 | 0 0 0 0 0 1 0 0 0 1 | 3 5 | 0 0 0 1 2 1 0 1 0 0 | 7 6 | 1 3 0 0 1 4 2 4 3 1 | 21 7 | 0 0 1 2 2 5 7 3 1 1 | 23 8 | 0 2 4 4 4 9 8 43 4 7 | 103 9 | 0 0 1 1 2 1 1 8 3 6 | 38 10 | 0 0 1 0 1 6 2 9 3 12 | 54 11 | 0 1 0 1 3 2 1 7 5 5 | 47 12 | 0 0 0 3 3 9 12 38 16 37 | 311 13 | 0 0 0 0 0 0 0 1 0 0 | 19 14 | 0 0 0 0 1 0 0 1 1 3 | 26 15 | 0 0 0 0 0 0 0 1 1 0 | 6 16 | 0 0 0 1 0 0 0 1 1 0 | 39 17 | 0 0 0 0 0 0 0 0 0 0 | 6 18 | 0 0 0 0 0 0 0 0 0 0 | 3 -----------+--------------------------------------------------------------------------------------------------------------+---------- Total | 1 8 8 17 21 38 35 120 38 75 | 722 mother's | father's education education | 11 12 13 14 15 16 17 18 | Total -----------+----------------------------------------------------------------------------------------+---------- 0 | 0 0 0 0 0 0 0 0 | 3 1 | 0 0 0 0 0 0 0 0 | 1 2 | 0 0 0 0 0 0 0 0 | 5 3 | 0 0 0 0 0 0 0 0 | 7 4 | 0 0 0 1 0 0 0 0 | 3 5 | 2 0 0 0 0 0 0 0 | 7 6 | 1 1 0 0 0 0 0 0 | 21 7 | 0 1 0 0 0 0 0 0 | 23 8 | 1 14 0 2 0 0 0 1 | 103 9 | 3 12 0 0 0 0 0 0 | 38 10 | 5 11 2 1 0 1 0 0 | 54 11 | 7 12 2 1 0 0 0 0 | 47 12 | 18 130 7 13 2 15 2 6 | 311 13 | 0 7 3 2 0 6 0 0 | 19 14 | 1 11 0 3 1 0 2 2 | 26 15 | 0 2 0 0 2 0 0 0 | 6 16 | 0 9 2 4 1 15 2 3 | 39 17 | 0 1 1 1 0 1 0 2 | 6 18 | 0 0 0 0 1 0 0 2 | 3 -----------+----------------------------------------------------------------------------------------+---------- Total | 38 211 17 28 7 38 6 16 | 722 . tabulate brthord educ, row column +-------------------+ | Key | |-------------------| | frequency | | row percentage | | column percentage | +-------------------+ birth | years of education order | 9 10 11 12 13 14 15 16 17 18 | Total -----------+--------------------------------------------------------------------------------------------------------------+---------- 1 | 3 10 9 123 31 29 24 67 25 25 | 346 | 0.87 2.89 2.60 35.55 8.96 8.38 6.94 19.36 7.23 7.23 | 100.00 | 37.50 31.25 24.32 34.55 40.79 40.85 60.00 47.18 65.79 48.08 | 40.61 -----------+--------------------------------------------------------------------------------------------------------------+---------- 2 | 1 9 7 106 20 20 8 46 7 15 | 239 | 0.42 3.77 2.93 44.35 8.37 8.37 3.35 19.25 2.93 6.28 | 100.00 | 12.50 28.13 18.92 29.78 26.32 28.17 20.00 32.39 18.42 28.85 | 28.05 -----------+--------------------------------------------------------------------------------------------------------------+---------- 3 | 2 3 7 61 13 11 4 13 5 7 | 126 | 1.59 2.38 5.56 48.41 10.32 8.73 3.17 10.32 3.97 5.56 | 100.00 | 25.00 9.38 18.92 17.13 17.11 15.49 10.00 9.15 13.16 13.46 | 14.79 -----------+--------------------------------------------------------------------------------------------------------------+---------- 4 | 0 2 5 25 3 7 4 9 0 2 | 57 | 0.00 3.51 8.77 43.86 5.26 12.28 7.02 15.79 0.00 3.51 | 100.00 | 0.00 6.25 13.51 7.02 3.95 9.86 10.00 6.34 0.00 3.85 | 6.69 -----------+--------------------------------------------------------------------------------------------------------------+---------- 5 | 0 3 4 17 3 1 0 4 1 2 | 35 | 0.00 8.57 11.43 48.57 8.57 2.86 0.00 11.43 2.86 5.71 | 100.00 | 0.00 9.38 10.81 4.78 3.95 1.41 0.00 2.82 2.63 3.85 | 4.11 -----------+--------------------------------------------------------------------------------------------------------------+---------- 6 | 1 2 4 14 3 1 0 3 0 0 | 28 | 3.57 7.14 14.29 50.00 10.71 3.57 0.00 10.71 0.00 0.00 | 100.00 | 12.50 6.25 10.81 3.93 3.95 1.41 0.00 2.11 0.00 0.00 | 3.29 -----------+--------------------------------------------------------------------------------------------------------------+---------- 7 | 1 1 1 4 2 1 0 0 0 0 | 10 | 10.00 10.00 10.00 40.00 20.00 10.00 0.00 0.00 0.00 0.00 | 100.00 | 12.50 3.13 2.70 1.12 2.63 1.41 0.00 0.00 0.00 0.00 | 1.17 -----------+--------------------------------------------------------------------------------------------------------------+---------- 8 | 0 0 0 3 0 1 0 0 0 1 | 5 | 0.00 0.00 0.00 60.00 0.00 20.00 0.00 0.00 0.00 20.00 | 100.00 | 0.00 0.00 0.00 0.84 0.00 1.41 0.00 0.00 0.00 1.92 | 0.59 -----------+--------------------------------------------------------------------------------------------------------------+---------- 9 | 0 2 0 1 0 0 0 0 0 0 | 3 | 0.00 66.67 0.00 33.33 0.00 0.00 0.00 0.00 0.00 0.00 | 100.00 | 0.00 6.25 0.00 0.28 0.00 0.00 0.00 0.00 0.00 0.00 | 0.35 -----------+--------------------------------------------------------------------------------------------------------------+---------- 10 | 0 0 0 2 1 0 0 0 0 0 | 3 | 0.00 0.00 0.00 66.67 33.33 0.00 0.00 0.00 0.00 0.00 | 100.00 | 0.00 0.00 0.00 0.56 1.32 0.00 0.00 0.00 0.00 0.00 | 0.35 -----------+--------------------------------------------------------------------------------------------------------------+---------- Total | 8 32 37 356 76 71 40 142 38 52 | 852 | 0.94 3.76 4.34 41.78 8.92 8.33 4.69 16.67 4.46 6.10 | 100.00 | 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 | 100.00 . reg wage brthord educ meduc feduc Source | SS df MS Number of obs = 663 -------------+------------------------------ F( 4, 658) = 24.86 Model | 14361275.3 4 3590318.82 Prob > F = 0.0000 Residual | 95035290 658 144430.532 R-squared = 0.1313 -------------+------------------------------ Adj R-squared = 0.1260 Total | 109396565 662 165251.609 Root MSE = 380.04 ------------------------------------------------------------------------------ wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- brthord | -17.39304 10.41052 -1.67 0.095 -37.83489 3.048808 educ | 45.52927 7.422202 6.13 0.000 30.95521 60.10332 meduc | 10.63462 6.599973 1.61 0.108 -2.324928 23.59417 feduc | 11.16278 5.742168 1.94 0.052 -.1123995 22.43797 _cons | 173.6779 105.6371 1.64 0.101 -33.74857 381.1044 ------------------------------------------------------------------------------ . * generate new dummy variables . tab educ, generate(educ_dummy) years of | education | Freq. Percent Cum. ------------+----------------------------------- 9 | 10 1.07 1.07 10 | 35 3.74 4.81 11 | 43 4.60 9.41 12 | 393 42.03 51.44 13 | 85 9.09 60.53 14 | 77 8.24 68.77 15 | 45 4.81 73.58 16 | 150 16.04 89.63 17 | 40 4.28 93.90 18 | 57 6.10 100.00 ------------+----------------------------------- Total | 935 100.00 . sum educ* Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- educ | 935 13.46845 2.196654 9 18 educ_dummy1 | 935 .0106952 .1029181 0 1 educ_dummy2 | 935 .0374332 .1899223 0 1 educ_dummy3 | 935 .0459893 .209574 0 1 educ_dummy4 | 935 .4203209 .4938746 0 1 -------------+-------------------------------------------------------- educ_dummy5 | 935 .0909091 .2876336 0 1 educ_dummy6 | 935 .0823529 .2750488 0 1 educ_dummy7 | 935 .0481283 .2141519 0 1 educ_dummy8 | 935 .1604278 .3671988 0 1 educ_dummy9 | 935 .0427807 .2024707 0 1 -------------+-------------------------------------------------------- educ_dummy10 | 935 .0609626 .2393897 0 1 . * estimate a regression model and use the output . reg wage brthord educ meduc feduc Source | SS df MS Number of obs = 663 -------------+------------------------------ F( 4, 658) = 24.86 Model | 14361275.3 4 3590318.82 Prob > F = 0.0000 Residual | 95035290 658 144430.532 R-squared = 0.1313 -------------+------------------------------ Adj R-squared = 0.1260 Total | 109396565 662 165251.609 Root MSE = 380.04 ------------------------------------------------------------------------------ wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- brthord | -17.39304 10.41052 -1.67 0.095 -37.83489 3.048808 educ | 45.52927 7.422202 6.13 0.000 30.95521 60.10332 meduc | 10.63462 6.599973 1.61 0.108 -2.324928 23.59417 feduc | 11.16278 5.742168 1.94 0.052 -.1123995 22.43797 _cons | 173.6779 105.6371 1.64 0.101 -33.74857 381.1044 ------------------------------------------------------------------------------ . ereturn list scalars: e(N) = 663 e(df_m) = 4 e(df_r) = 658 e(F) = 24.85844768133692 e(r2) = .1312772046123346 e(rmse) = 380.0401715437021 e(mss) = 14361275.29194266 e(rss) = 95035290.04742394 e(r2_a) = .1259962149747197 e(ll) = -4876.650398623932 e(ll_0) = -4923.302790514009 macros: e(cmdline) : "regress wage brthord educ meduc feduc" e(title) : "Linear regression" e(vce) : "ols" e(depvar) : "wage" e(cmd) : "regress" e(properties) : "b V" e(predict) : "regres_p" e(model) : "ols" e(estat_cmd) : "regress_estat" matrices: e(b) : 1 x 5 e(V) : 5 x 5 functions: e(sample) . matrix list e(b) e(b)[1,5] brthord educ meduc feduc _cons y1 -17.393043 45.529265 10.634619 11.162783 173.67793 . display _b[_cons] 173.67793 . display _b[_educ] [_educ] not found r(111); . display _b[educ] 45.529265 . generate yeni= _b[educ]*educ . edit - preserve . log close log: D:\Stata10\mylogjan.log log type: text closed on: 8 Jan 2016, 14:37:58 ------------------------------------------------------------------------------------------------------------------------------------------------