Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: 2 Heckman regressions and Oaxaca decomposition


From   "log goho" <[email protected]>
To   [email protected]
Subject   st: 2 Heckman regressions and Oaxaca decomposition
Date   Thu, 05 Feb 2004 11:23:40 -0500

1. When I tried Ben suggestion, stata doesn't find the variable LBDA.
I have an error message saying that LDBA not found


here is the code

heckman lwage varname... if alien==0, select (varnames ) twostep mills(lambda)
regress lwage varname... lambda if alien==0
decompose, save (high)
regress lwage if alien==1
decompose, save(low)

decompose, lambda(lbda)
ERROR MESSAGE

2. I tried to write a code to solve this Heckman and Oaxaca decomposition, but I have a problem with the constant which does not appears.

I will appreciate any help to solve this code.

HERE IS THE CODE AFTER THE FIRST HECKMAN REGRESSION

heckman .....

predict yhat_i
matrix Rw_i=e(b) /* coefficients of regression equation */
matrix Vregw_i=e(V) /* var-cov matrix of regression coefficients */
/*local m_i=colsof(Rw_i)*/ /* number of regressors of regression equation */
local m_i=27 /* number of regressors, including the constant */
matrix Rwd_i=Rw_i[1,1..`m_i']
local names : colnames Rwd_i
matrix Xw_i=J(1,`m_i', 1)
mat Xwa_i=J(1,`m_i', 1)

tokenize `names'
local i 1 /* counter for regressors */
while "`1'"~=""{
qui su `1' if alien==0
local mean`i'=r(mean)
mat Xw_i[1,`i']=`mean`i'' /* store mean value of charact. in matrix Xm */
qui su `1' if alien==0
local mean`i'=r(mean)
mat Xwa_i[1,`i']=`mean`i'' /* store mean value of charact. in matrix Xma */ local i=`i'+1
macro shift
}

i HAVE AN ERROR MESSAGE HERE SAYING THAT THE VARIABLE _CONS IS NOT FOUND


HERE IS THE CODE AFTER THE SECOND HECKMAN

heckman....

predict yhat_f
matrix Rw_f=e(b) /* coefficients of regression equation */
local m_f=27 /* number of regressors including the constant */
matrix Rwd_f=Rw_f[1,1..`m_f']
local names : colnames Rwd_f
matrix Xw_f=J(1,`m_f', 1)
mat Xwa_f=J(1,`m_f', 1)

tokenize `names'
local i 1 /* counter for regressors */
while "`1'"~=""{
qui su `1' if alien==1
local mean`i'=r(mean)
mat Xw_f[1,`i']=`mean`i'' /* store mean value of charact. in matrix Xm */
qui su `1' if alien==1
local mean`i'=r(mean)
mat Xwa_f[1,`i']=`mean`i'' /* store mean value of charact. in matrix Xma */ local i=`i'+1
macro shift
}

HERE THE MATRIX CALCULATION

/*Decomposition 1*/
matrix C1=Rwd_i*diag(Xwa_i-Xwa_f) /*Effect of diff. in average charact between /*

matrix R1=Xwa_f*diag(Rwd_i-Rwd_f) /* Discrimination effect: Ivoirians-aliens*/

/*Decomposition 2*/
matrix C2=Rwd_f*diag(Xwa_i-Xwa_f) /*Effect of diff. in average charact between /*

matrix R2=Xwa_i*diag(Rwd_i-Rwd_f) /* Discrimination effect: Ivoirians-aliens*/

mat a=(C1\R1\C2\R2)
mat list a






From: "Jann, Ben" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: st: RE: Heckmanregression and Oaxaca dcomposition
Date: Wed, 4 Feb 2004 10:21:35 +0100

GG wrote:
> I am trying to do a oaxaca decomposition after a
> Heckment selection regression. When using the
> DECOMPOSE or DECOMP codes, I received an error
> message when I want to do the decomposition.

The problem is that the two programs do not explicitly support
multi-equation models. However, you may apply the decomposition to
heckman models if the regression equation is estimated seperately:

1. Use the two-step method to estimate the model and save the inverse
mills-ratio (lambda).
2. Use OLS to reestimate the regression equation including lambda and
save the model.

Example: regression of wages (w) on education (e) and experience (x and
x2) by sex (1=female, 2=male); standard model for male, heckman model
for female

 . heckman w e x x2  if sex==1, select(...) twostep mills(lambda)
 . regress w e x x2 lambda if sex==1
 . decompose, save(low)
 . regress w e x x2 if sex==2
 . decompose, save(high)
 . decompose, lambda(lbda)

I am planing to update -decompose- to Stata 8 and add support for
multi-equation models (and fix a couple of bugs [and probably add some
new ones...]). It might take a while, however.

Ben


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
_________________________________________________________________
Let the new MSN Premium Internet Software make the most of your high-speed experience. http://join.msn.com/?pgmarket=en-us&page=byoa/prem&ST=1

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index