Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Bootstrapping with ML


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Bootstrapping with ML
Date   Mon, 22 Aug 2005 16:56:05 -0500

I believe you need to set it up as an ado file

Suppose your ml file is :

program mylogit_lf
             args lnf Xb
             replace `lnf' = -ln(1+exp(-`Xb')) if $ML_y1==1
             replace `lnf' = -`Xb' - ln(1+exp(-`Xb')) if $ML_y1==0
end

Rather than typing:
. ml model lf mylogit_lf (foreign=mpg weight)

. ml max

You create an ado file out of this that can be used with -bootstrap- :

program  mylogit
	syntax varlist
	gettoken y rhs : varlist
	ml model lf mylogit_lf (`y'=`rhs')
	ml max
end


In the end you will have two program -mylogit- which will call -mylogit_lf-

Now you can use -bootstrap-


. bootstrap _b: mylogit fore mpg weight
(running mylogit on estimation sample)

Bootstrap replications (50)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50

<snip>

Hope this helps,
Scott



> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Robert Town
> Sent: Monday, August 22, 2005 4:31 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Bootstrapping with ML
> 
> I am posting another message about the same subject as below with
> additional information. Sorry for the additional posting on the same
> subject. However, I heard from a friend on this list that I should be
> more specific with the type of error message that I am getting.
> 
> With Stata 8.2, the command
> 
>  >>  bs "ml maximize" "_b[patient][age]"
> 
> gives the following error message
> 
>  >> invalid syntax
>  >> error in statistic: _b[patient][age]
>  >> r(198);
> 
> 
> With Stata 9.0, the command
> 
>  >> bootstrap: ml maximize
> 
> gives the following error message.
> 
>  >> variable maximize not found
>  >> an error occurred when bootstrap executed mlogit
>  >> r(111);
> 
> If anybody knows how to bootstrap maximum likelihood, I would really
> appreciate hearing from you.
> 
> 
> My earlier message:
> 
> > I used the Stata maximum likelihood (ml) routine to maximize a
> > linear-form (lf) likelihood function that I wrote, using Stata 9.0
> > SE. The standard errors that Stata is reporting look off, so I am
> > trying to bootstrap the maximum likelihood routine to obtain more
> > robust standard errors.
> >
> > I am not sure how to bootstrap the maximum likelihood routine. I tried
> > "bs _b : ml maximize" but this gives an error message.
> >
> > Does anyone have any experience bootstrapping the maximum likelihood
> > routine for either Stata 8 or Stata 9? (I know that the bootstrap
> > routine changed from 8 to 9, which is why I mention this.) If so, I
> > would appreciate knowing how to do this.
> >
> 
> Thanks again for your help
> ---
> 
> Robert Town
> Associate Professor
> University of Minnesota
> School of Public Health
> Mayo Mail Code 729
> 420 Delaware St. SE
> Minneapolis, MN 55455
> 
> 612-626-4683 (phone)
> 612-624-2196 (fax)
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index