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]

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: Problem with bsample and simulate when estimating a mixed logit model |

Date |
Thu, 25 Nov 2010 12:46:31 +0000 |

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 n.j.cox@durham.ac.uk 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/

**Follow-Ups**:**RE: st: Problem with bsample and simulate when estimating a mixed logit model***From:*Garry Anderson <g.anderson@unimelb.edu.au>

**References**:**st: Problem with bsample and simulate when estimating a mixed logit model***From:*Poirier Julie <Julie.Poirier@ensae.fr>

**Re: st: Problem with bsample and simulate when estimating a mixed logit model***From:*Arne Risa Hole <arnehole@gmail.com>

**RE: st: Problem with bsample and simulate when estimating a mixed logit model***From:*Poirier Julie <Julie.Poirier@ensae.fr>

**RE: st: Problem with bsample and simulate when estimating a mixed logit model***From:*Nick Cox <n.j.cox@durham.ac.uk>

**RE: st: Problem with bsample and simulate when estimating a mixed logit model***From:*Poirier Julie <Julie.Poirier@ensae.fr>

- Prev by Date:
**RE: st: Problem with bsample and simulate when estimating a mixed logit model** - Next by Date:
**st: How can I test difference between groups?** - Previous by thread:
**RE: st: Problem with bsample and simulate when estimating a mixed logit model** - Next by thread:
**RE: st: Problem with bsample and simulate when estimating a mixed logit model** - Index(es):