Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

Re: st: differences of mean

 From Maarten Buis <[email protected]> To [email protected] Subject Re: st: differences of mean Date Tue, 27 Mar 2012 14:02:08 +0200

```On Tue, Mar 27, 2012 at 1:41 PM, Chiara Mussida wrote:
> I have to calculate the difference of mean log wages of men and women.
> How should I get my variable diff= mean(lwage men) - mean(lwage
> women)? Total difference and/or difference by occupation.

That is just a straightforward regression. You can make your live a
bit easier by excluding the baseline category for occupation, see:
M.L. Buis (forthcoming) "Stata tip 106: With or without reference",
The Stata Journal, 12(1).
<http://www.maartenbuis.nl/publications/ref_cat.html>. Moreover, you
probably do not want to work with log(wage) but with wage itself.

*------------------ begin example -------------------
sysuse nlsw88, clear

// race = 2 refers to black, 3 refers to other
// so variable white will have values:
// 1 white
// 0 black
// . other or missing
gen white = race == 1 if race < 3

gen lnw = ln(wage)

// overall difference in log(wage)
reg lnw i.white

// difference in log(wage) within occupations
reg lnw ibn.occupation ibn.occupation#i.white, ///
nocons

// ==================================================
// It is probably more meaningful to work with wage
// rather than log(wage)
// ==================================================

// differences in wage (not log(wage))
reg wage ibn.occupation ibn.occupation#i.white, ///
nocons vce(robust)

// ratio of wage (not log(wage))
glm wage ibn.occupation ibn.occupation#i.white, ///
*------------------- end example --------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------
*
*   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/
```