Chapter 12. M-Estimation, Nonlinear Regression, and

Quantile Regression

Examples

-----------------------------------------------------------------------------------------------
      name:  SN
       log:  myReplications\iiexample12.smcl
  log type:  smcl
 opened on:   5 May 2020, 22:51:14

. **********************************************
. * Solomon Negash - Examples
. * Wooldridge (2010). Economic Analysis of Cross-Section and Panel Data. 2nd ed.  
. * STATA Program, version 16.1. 

. * Chapter 12 - M-Estimation, Nonlinear Regression, and Quantile Regression
. ********************************************
. // Example 12.1 Quantile Regression for Financial Wealth

. bcuse 401ksubs, clear

Contains data from http://fmwww.bc.edu/ec-p/data/wooldridge/401ksubs.dta
  obs:         9,275                          
 vars:            11                          25 Jul 2002 16:03
-----------------------------------------------------------------------------------------------
              storage   display    value
variable name   type    format     label      variable label
-----------------------------------------------------------------------------------------------
e401k           byte    %9.0g                 =1 if eligble for 401(k)
inc             float   %9.0g                 annual income, $1000s
marr            byte    %9.0g                 =1 if married
male            byte    %9.0g                 =1 if male respondent
age             byte    %9.0g                 in years
fsize           byte    %9.0g                 family size
nettfa          float   %9.0g                 net total fin. assets, $1000
p401k           byte    %9.0g                 =1 if participate in 401(k)
pira            byte    %9.0g                 =1 if have IRA
incsq           float   %9.0g                 inc^2
agesq           int     %9.0g                 age^2
-----------------------------------------------------------------------------------------------
Sorted by: 
. keep if fsize==1
(7,258 observations deleted)

. eststo OLSr:    qui reg  nettfa inc age agesq e401k, r

. eststo q10iid: qui qreg nettfa inc age agesq e401k, quantile(.10) vce(iid,  res)

. eststo q25iid: qui qreg nettfa inc age agesq e401k, quantile(.25) vce(iid,  ker(bi))

. eststo LADiid: qui qreg nettfa inc age agesq e401k, vce(iid,  ker(epan2))

. eststo q75iid: qui qreg nettfa inc age agesq e401k, quantile(.75) vce(iid,  ker(bi))

. eststo q90iid: qui qreg nettfa inc age agesq e401k, quantile(.90) vce(iid,  ker(bi))

. estout OLSr q10iid q25iid LADiid q75iid q90iid, cells(b(nostar fmt(4)) se(par fmt(4))) /// 
 stats( N, fmt(%9.0g) labels(N)) ti("Table 12.1 Mean and Quantile Regression for Net Total Financial Wealth")

Table 12.1 Mean and Quantile Regression for Net Total Financial Wealth
------------------------------------------------------------------------------------------
                     OLSr       q10iid       q25iid       LADiid       q75iid       q90iid
                     b/se         b/se         b/se         b/se         b/se         b/se
------------------------------------------------------------------------------------------
inc                0.7826      -0.0179       0.0713       0.3239       0.7977       1.2911
                 (0.1041)     (0.0174)     (0.0076)     (0.0117)     (0.0227)     (0.0402)
age               -1.5677      -0.0663       0.0336      -0.2444      -1.3856      -3.5787
                 (1.0758)     (0.2177)     (0.0949)     (0.1467)     (0.2837)     (0.5023)
agesq              0.0284       0.0024       0.0004       0.0048       0.0242       0.0605
                 (0.0138)     (0.0026)     (0.0011)     (0.0017)     (0.0033)     (0.0059)
e401k              6.8366       0.9494       1.2810       2.5977       4.4600       6.0015
                 (2.1733)     (0.6029)     (0.2628)     (0.4064)     (0.7856)     (1.3911)
_cons              2.5336      -5.2280      -4.3728      -3.5728       7.5390      37.2684
                (19.2613)     (4.3255)     (1.8857)     (2.9156)     (5.6366)     (9.9804)
------------------------------------------------------------------------------------------
N                    2017         2017         2017         2017         2017         2017
------------------------------------------------------------------------------------------

. eststo clear 


. log close 
      name:  SN
       log:  myReplications\iiexample12.smcl
  log type:  smcl
 opened on:   5 May 2020, 22:51:14
-----------------------------------------------------------------------------------------------