# Re: st:better way to calculate XfBm after -oaxaca- for mael and female

 From "Ben Jann" To statalist@hsphsun2.harvard.edu Subject Re: st:better way to calculate XfBm after -oaxaca- for mael and female Date Tue, 4 Nov 2008 22:42:09 +0100

```I am not sure whether I correctly understand the question, but I think
XfBf and XfBm (where X stands for the vector of means, B for the
coefficients vector, and f/m for female/male) can be easily computed,
e.g. as follows:

. use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta
. oaxaca lnwage educ exper tenure, by(female)
. display [Differential]_b[Prediction_2]
. display [Differential]_b[Prediction_2] + [Decomposition]_b[Coefficients]

or

. matrix b = e(b)
. display b[1,2]
. display b[1,2] + b[1,5]

(i.e. XfBf is the mean prediction for group 2,  XfBm is the mean
prediction plus the Coefficients component.)

Depending on the type of decomposition and if -detail- is specified
you have to adjust the labels/column numbers in the example.

ben

On Tue, Nov 4, 2008 at 10:08 PM, Mandy fu <mandy.fu1@gmail.com> wrote:
> Hi all,
> After -oaxaca- for wages of male and female, I want to calculate XfBf
> (predicted wage of female)and XfBm(How much would a female earn if she
> was treated exactly the same as a male in labor market). Where , Xf
> means the factors affecting wages of female; Bm means the coeffcients
> of factors affecting male wage.
> I use the following way to do the calculation. But I need to figure
> out what numbers should be selected fromt he matrix to get XfBm . So
> it takes quite a while to do all teh work when there are lots of
> oaxaca decompositions to do.
> So , I was wondering if anyone could give me some idea if there's any
> easier way to do this. Sorry for bring up the details. It'll be
> helpful if you give some hints of where I could revise.
> Thanks for yur help!
> --------------------------------after oaxaca compute XfBf, XfBm. ( m:
> male ; f:female)
> .oaxaca lnwage x1-x17, by (female) weight(1)
> .matrix b=e(b)
> .matrix b0=e(b0)
> .matrix list b
> .matrix list b0
> *b is a matrix [1,40]
> *b [1 predict_male, 1 predict_female, 1 difference,17 explained,
> total_explained, 17 unexplained,1constant, 1 total_unexplained]
> *b0 is a matrix 1*72.
> *b0 [17 coefficents_male, 1 constant,17 coeffcients_female,1 constant,
> 17 X values_male ,1 constant,17 X values_female,1 constant]
> *select the second number in b as XfBf:
> .matrix XfBf=b [1,. . ., 1 . . 2]
> *select the number 1-18 in b0 as Bm.
> .matrix Bm=b0[1 . . . , 1 . . 18]
> *select the number 55-72 in b0 as Xf.
> .matrix Xf=b0[1 . . . , 55 . . 72]
> *calculate Xf*Bm.
> .matrix XfBm=Xf*Bm'
> .svmat XfBm
> display XfBm
> --------------------------------------------------------------------------
> Thanks!
> Mandy
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```