Chapter 5 - Examples
-------------------------------------------------------------------------------------
name: SN
log: ~Wooldridge\intro-econx\iexample5.smcl
log type: smcl
opened on: 6 Jan 2019, 23:50:42
. **********************************************
. * Solomon Negash - Replicating Examples
. * Wooldridge (2016). Introductory Econometrics: A Modern Approach. 6th ed.
. * STATA Program, version 15.1.
. * Chapter 5 - Multiple Regression Analysis: OLS Asymptotics
. * Computer Exercises (Examples)
. ******************** SETUP *********************
*Example5.1. N/A
.
*Example5.2. Birth weight equaiton, Standar Errors.
. u bwght.dta, clear
. egen id=seq()
. sum id
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
id | 1,388 694.5 400.8254 1 1388
. eststo: qui reg lbwght cigs lfaminc if id<=694
(est1 stored)
. eststo: qui reg lbwght cigs lfaminc
(est2 stored)
. estout *, cells(b(star fmt(3)) se(par fmt(5))) stats(r2_a N, fmt(%9.3f %9.0g) label
> s(R-squared)) varlabels(_cons Constant)
--------------------------------------------
est1 est2
b/se b/se
--------------------------------------------
cigs -0.005*** -0.004***
(0.00133) (0.00086)
lfaminc 0.019* 0.016**
(0.00819) (0.00558)
Constant 4.706*** 4.719***
(0.02705) (0.01824)
--------------------------------------------
R-squared 0.027 0.024
N 694 1388
--------------------------------------------
. est clear
*Example5.3 Economic model of crime
. u crime1.dta, clear
. *Test using F-statistic
. reg narr86 pcnv avgsen tottime ptime86 qemp86
Source | SS df MS Number of obs = 2,725
-------------+---------------------------------- F(5, 2719) = 24.29
Model | 85.9532425 5 17.1906485 Prob > F = 0.0000
Residual | 1924.39391 2,719 .707757967 R-squared = 0.0428
-------------+---------------------------------- Adj R-squared = 0.0410
Total | 2010.34716 2,724 .738012906 Root MSE = .84128
------------------------------------------------------------------------------
narr86 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
pcnv | -.1512246 .040855 -3.70 0.000 -.2313346 -.0711145
avgsen | -.0070487 .0124122 -0.57 0.570 -.031387 .0172897
tottime | .0120953 .0095768 1.26 0.207 -.0066833 .030874
ptime86 | -.0392585 .0089166 -4.40 0.000 -.0567425 -.0217745
qemp86 | -.1030909 .0103972 -9.92 0.000 -.1234782 -.0827037
_cons | .7060607 .0331524 21.30 0.000 .6410542 .7710671
------------------------------------------------------------------------------
. test avgsen tottime
( 1) avgsen = 0
( 2) tottime = 0
F( 2, 2719) = 2.03
Prob > F = 0.1310
. *Test using LM statistic
. reg narr86 pcnv ptime86 qemp86
Source | SS df MS Number of obs = 2,725
-------------+---------------------------------- F(3, 2721) = 39.10
Model | 83.0741941 3 27.691398 Prob > F = 0.0000
Residual | 1927.27296 2,721 .708295833 R-squared = 0.0413
-------------+---------------------------------- Adj R-squared = 0.0403
Total | 2010.34716 2,724 .738012906 Root MSE = .8416
------------------------------------------------------------------------------
narr86 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
pcnv | -.1499274 .0408653 -3.67 0.000 -.2300576 -.0697973
ptime86 | -.0344199 .008591 -4.01 0.000 -.0512655 -.0175744
qemp86 | -.104113 .0103877 -10.02 0.000 -.1244816 -.0837445
_cons | .7117715 .0330066 21.56 0.000 .647051 .776492
------------------------------------------------------------------------------
. predict ur, residual //residuals from the restricted model
. reg ur pcnv avgsen tottime ptime86 qemp86
Source | SS df MS Number of obs = 2,725
-------------+---------------------------------- F(5, 2719) = 0.81
Model | 2.87904835 5 .575809669 Prob > F = 0.5398
Residual | 1924.39392 2,719 .707757969 R-squared = 0.0015
-------------+---------------------------------- Adj R-squared = -0.0003
Total | 1927.27297 2,724 .707515773 Root MSE = .84128
------------------------------------------------------------------------------
ur | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
pcnv | -.0012971 .040855 -0.03 0.975 -.0814072 .0788129
avgsen | -.0070487 .0124122 -0.57 0.570 -.031387 .0172897
tottime | .0120953 .0095768 1.26 0.207 -.0066833 .030874
ptime86 | -.0048386 .0089166 -0.54 0.587 -.0223226 .0126454
qemp86 | .0010221 .0103972 0.10 0.922 -.0193652 .0214093
_cons | -.0057108 .0331524 -0.17 0.863 -.0707173 .0592956
------------------------------------------------------------------------------
. display as text "N * Rsq = " as result 2725*0.0015
N * Rsq = 4.0875
. log close
name: SN
log: ~Wooldridge\intro-econx\iexample5.smcl
log type: smcl
closed on: 6 Jan 2019, 23:50:42
-------------------------------------------------------------------------------------