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: Problem with bsample and simulate when estimating a mixed logit model


From   Poirier Julie <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: Problem with bsample and simulate when estimating a mixed logit model
Date   Thu, 25 Nov 2010 13:36:45 +0100

I typed:

bootstrap wtp=(-_b[seasonal]/_b[price]), ///
cluster(pid) idcluster(newpid) group(gid) reps(10): /// mixlogit y price contract local wknown tod, ///
group(gid) id(newpid) rand(seasonal)

as Arne told me in the message below.

Julie 

-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la part de Nick Cox
Envoyé : jeudi 25 novembre 2010 13:34
À : '[email protected]'
Objet : RE: st: Problem with bsample and simulate when estimating a mixed logit model

Did you install -wtp-? 

Complete syntax please: What did you type, exactly? 

Nick 
[email protected] 

Poirier Julie

In the bootstrap command, the wtp=(-_b[seasonal]/_b[price]) does not work. Stata tells me "command not found"!
Have you any idea about why it does not work?

Arne Risa Hole

Why not just use -bootstrap-, e.g.:

use traindata.dta
bootstrap wtp=(-_b[seasonal]/_b[price]), ///
cluster(pid) idcluster(newpid) group(gid) reps(10): ///
mixlogit y price contract local wknown tod, ///
group(gid) id(newpid) rand(seasonal)

traindata.dta is described in
http://www.stata-journal.com/article.html?article=st0133.

Alternatively you can use the -wtp- module (available from SSC) to
obtain parametric (as opposed to non-parametric) bootstrap CIs. This
is a more practical approach given the time it normally takes to
estimate a mixed logit model.

Poirier Julie,

> I have some problems running bootstrap with STATA's -bsample- command.
>
> I am using the following version of stata:
>
> Stata/MP 10.1 for Windows
> Born 18 Aug 2009
>
> I have some choice experiments data and I want to estimate willingness-to-pay through the estimation of a mixed logit model.
> I am currently using the -mixlogit- module (mixlogit 1.2.2 18Oct2010, written by Arne Risa Hole) to estimate my choice model and it works pretty well. I obtained parameters estimates and I computed my willingness-to-pay from these parameters estimates using the  -nlcom- command. Because I want to improve my work and obtain the distribution of my willingness to pay with the bootstrap method.
>
> Because the statistic I want to bootstrap does not work with the bootstrap command, I need to write my own bootstrap program. To do so, I am using the -bsample- command together with the -simulate- command. I want to draw 99 bootstrap replications from my sample, and the sampling is stratified by the groupe variable. The willingness to pay are given by wtplitto, wtptouq, wtpdives, wtpvie.
>
> My stata program is the following:
>
> program define myboot, rclass
>  1. preserve
>  2. bsample, strata(group)
>  3. mixlogit  choix statusquo contribution, group( group) rand( litto touq dives vie)
>  4. return scalar wtplitto=-_b[litto]/_b[contribution]
>  5. return scalar wtptouq=-_b[touq]/_b[contribution]
>  6. return scalar wtpdives=-_b[dives]/_b[contribution]
>  7. return scalar wtpvie=-_b[vie]/_b[contribution]
>  8. return scalar wtpv=r(wtpvie)
>  9. return scalar wtpd=r(wtpdives)
>  10. return scalar wtpt=r(wtptouq)
>  11. return scalar wtpl=r(wtplitto)
>  12. restore
>  13. end
>
> . matrix wtp=( r(wtpvie), r(wtpdives), r(wtptouq), r(wtplitto))
>
> . simulate wtpv=r(wtpvie) wtpd=r(wtpdives) wtpt=r(wtptouq) wtpl=r(wtplitto), reps(99) seed(12) : myboot
>
> When running the command, stata doesn't manage to do the boostrap replications and it seems that it makes an infinite number of iterations. Indeed, when I add the option -iterate()- in the mixlogit syntax in order to specify the maximum number of iterations for each bootstrap replications, then Stata gives me some results for the -simulate- command, but the boostrap results I obtain using the -bstat- command (for example the bootstrap standard errors associated with my willingness to pay estimates)  are quite the same as those I obtained using the -nlcom- command. So the bootstrap doesn't help me in that case!

*
*   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/

*
*   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