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 at the end of May, and its replacement, statalist.org 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" <ariel.linden@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
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
commands:

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

Ariel



Date: Tue, 27 Mar 2012 14:02:08 +0200
From: Maarten Buis <maartenlbuis@gmail.com>
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).
<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, ///
    nocons link(log) vce(robust)
*------------------- 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/


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