Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: st: differences of mean

From   "Ariel Linden, DrPH" <>
To   <>
Subject   Re: Re: st: differences of mean
Date   Wed, 28 Mar 2012 10:27:17 -0400

In addition to Maarten's code below, you could add the following two

margins r.white@occupation,  mcompare(bon)
marginsplot, xlabel(, angle(forty_five))

These will give you (a) the difference between white/non-white at each
occupation, Bonferroni adjusted for multiple comparisons, and (b) a plot of
these differences with the adjusted 95% confidence intervals


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

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).
<>. 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, ///

// ==================================================
// 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, ///
    nocons link(log) vce(robust)
*------------------- end example --------------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

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

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index