Bookmark and Share

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


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

st: Stata list example - use of the margins command


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   st: Stata list example - use of the margins command
Date   Thu, 8 Dec 2011 10:20:58 +0100

--- Peter Baade wrote me privately:
> I noticed that you posted the following example on the Stata list in May this year. <http://www.stata.com/statalist/archive/2011-05/msg00776.html>
>
> I was wondering if I could ask you one question

You can, but convention on Statalist is that these questions are asked
on the list rather than privately. If you found something strange than
odds are that others will also find that to be the case, and would
thus appreciate an answer as well. It also has advantages for you,
because it regularly happens that others participate in the discussion
contributing another point of view or pointing out mistakes or
ommisions in my answer. This is discussed in the Statalist FAQ:
<http://www.stata.com/support/faqs/res/statalist.html#private> So I
forwarded this messages to statalist.

> when you used the “di” command below, could I use the nlcom command to get confidence intervals? I’ve used this and get very wide intervals, inconsistent with the p-value.

Below is an adaptation of the example you refer to, replacing -di-
with -nlcom-. The p-value in -nlcom- is in this case useless as it
tests the hypothesis that the odds ratio is 0 rather than the
meaningfull hypothesis that the odds ratio is 1.

You can also see the confidence interval produced by -nlcom- is
somewhat different from the confidence interval produced by -logit-
even though the coefficient and the standard error match exactly. The
reason for that is explained here:
<http://www.stata.com/support/faqs/stat/2deltameth.html>

*------------------------ begin example ------------------------------------
sysuse nlsw88, clear
gen byte high_occ = occupation < 3 if occupation < .
gen byte black = race == 2 if race < .
drop if race == 3
gen byte baseline = 1

sum ttl_exp
gen c_ttl_exp = ttl_exp - r(mean)

// fix at average ttl_exp (12.5 years)

logit high_occ black##collgrad c_ttl_exp baseline, or nocons

margins, over(black collgrad) expression(exp(xb())) ///
         at(c_ttl_exp = 0) post

nlcom (_b[1.black#1.collgrad] / _b[0.black#1.collgrad] ) / ///
      (_b[1.black#0.collgrad] / _b[0.black#0.collgrad])
*-------------------------- 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index