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]

Re: st: bootstrapping question


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: bootstrapping question
Date   Thu, 12 Sep 2013 09:19:41 +0200

On Thu, Sep 12, 2013 at 3:25 AM, Shuaizhang Feng wrote:
> Dear Maarten: Thanks for the reply and the example. I went through the
> example you gave but in the end the command
>
> mlogit marst, base(0) rrr vce(bootstrap, reps(100))
>
> did not seem to produce the desired result.   here is the results given:
<snip>
> ------------------------------------------------------------------------------
>              |   Observed   Bootstrap                         Normal-based
>        marst |        RRR   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
> never_marr~d |  (base outcome)
> -------------+----------------------------------------------------------------
> divorced_o~d |
> -------------+----------------------------------------------------------------
> married      |
> ------------------------------------------------------------------------------

This means you are using an older version of Stata; Stata 11 or less.
It is definately OK to ask questions about older versions of Stata,
but you need to tell us. I cannot see your computer (I don't work at
the NSA or the GCHQ), so I have to guess which version you are using,
and it is convention on this list that if you do not say which version
you are using we will assume that you use the latest version (13).

Anyhow, for older versions of Stata you can use the trick discussed
here: http://www.maartenbuis.nl/example_faq/index.html#baseline
Applying that trick to my example gives you:

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

// lets compute that odds manually:
sum married
tempname m_married
scalar `m_married' = r(mean)
sum never_married
di as txt "manually computed odds: " ///
   as result `m_married'/r(mean)

// use mlogit to compute those odds:
gen byte marst = !never_married + married  ///
    if !missing(never_married, married)
label variable marst "marital status"
label define marst 0 "never married"       ///
                   1 "divorced or widowed" ///
                   2 "married"
label value marst marst

// create a "constant"
gen byte baseline = 1

mlogit marst baseline, base(0) rrr nocons

// do the bootstrap
mlogit marst baseline, base(0) rrr nocons vce(bootstrap, reps(100))
*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )


> I am also interested getting the standard errors of
> mean(x1)/mean(x1+x2) as well as mean(x1+x2).

The latter is simple, if x1 is never_married and x2 is married than x1
+ x2 represents those that are not divorced or widowed, and the mean
of that is just a proportion. Below is an example of how to bootstrap
that, but you can also look at -help ci- for other options.

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

gen byte not_divorced = married + never_married
reg not_divorced, vce(bootstrap, reps(100))
*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )

I am blanking on the first one, maybe someone else on this list has a good idea?

-- Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index