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   Garry Anderson <[email protected]>
To   [email protected]
Subject   RE: st: Problem with bsample and simulate when estimating a mixed logit model
Date   Fri, 26 Nov 2010 00:49:30 +1100

Hi Julia,
 
1) Also delete the carriage return/line feed character after two of the three occurences of /// so that the bootstrap command and associated mixlogit command are on one line. The following bootstrap command on one line works with my Stata 11.1.
 
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)

 
2) Did you receive the message
. bootstrap wtp=(-_b[seasonal]/_b[price]), 
wtp=(-_b[seasonal]/_b[price]) command not found
r(111);

If so, this indicates the /// cariage return/line feed is still present.
 
Garry
 
 
 

________________________________

From: [email protected] on behalf of Poirier Julie
Sent: Fri 26/11/10 00:34
To: '[email protected]'
Subject: RE: st: Problem with bsample and simulate when estimating a mixed logit model



Hi Gary,

I tried but Stata still returns me the same error message!

Julie  


De : [email protected] [mailto:[email protected]] De la part de Garry Anderson
Envoyé : jeudi 25 novembre 2010 13:58
À : [email protected]
Objet : RE: st: Problem with bsample and simulate when estimating a mixed logit model

Hi Julie,
 
Try removing the 3 occurrences of ///
 
Garry
 

________________________________________
From: [email protected] on behalf of Nick Cox
Sent: Thu 25/11/10 23:46
To: '[email protected]'
Subject: RE: st: Problem with bsample and simulate when estimating a mixed logit model
The syntax you typed is not using the -wtp- program, just creating a variable called -wtp- and bootstrapping -mixlogit-.

I hope someone else can tell you why it didn't work.

Nick
[email protected]

Poirier Julie

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.

Nick Cox

Did you install -wtp-?

Complete syntax please: What did you type, exactly?

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/


<<winmail.dat>>



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