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

Subject |
RE: st: halton sequence |

Date |
Fri, 6 Aug 2004 22:04:41 +0100 |

Here's my stab at it based on that valuable information. halton, gen(h2) halton, gen(h3) q(3) halton, gen(h3_15) q(3) n(15) *! 1.0.0 NJC 6 August 2004 *! based on Gauss program by Daniel Feenberg and Jonathan Skinner *! to generate n numbers you need at least n + 1 observations program halton version 8 syntax , GENerate(str) [ Q(int 2) N(str)] if "`n'" == "" local n = _N - 1 else if (`n' + 1) > _N error 2001 confirm new var `generate' local g "`generate'" tempname y x local np1 = `n' + 1 qui { gen double `g' = 0 forval i = 2/`np1' { scalar `y' = 1/`q' scalar `x' = 1 - `g'[`i' - 1] while `x' <= (`y' + 1e-11) { scalar `y' = `y' / `q' } replace `g' = /// `g'[`i' - 1] + (`q' + 1) * `y' - 1 in `i' } replace `g' = `g'[_n + 1] in 1/`n' replace `g' = . in `np1' } end Nick n.j.cox@durham.ac.uk > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Daniel > Feenberg > Sent: 06 August 2004 20:25 > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: halton sequence > > > I have actually co-authored a paper using Halton sequences, > but we used > Gauss to generate them (I didn't know any Stata at the time). The full > source for our generator is in Appendix B of the paper ( > http://www.nber.org/papers/w4147 ), and looking at it I don't > see why it > couldn't be done in Stata. However my Gauss is now weak, and I may > not be understanding my own code. > > Halton's paper describes the sequences in a number-theoretic way which > looks like something only a LISP interpreter could do, but there is an > alternative floating point generater that Halton also > describes (and which > is referenced in our paper). We coded it in about a dozen > lines of Gauss. > If you are trying to do LISP in Stata, that would be a problem. > > We did find much faster convergence with Halton sequences. I > hope you will > give them a try. > > Daniel Feenberg > > On Fri, 6 Aug 2004, Alfonso Miranda Caso Luengo wrote: > > > Dear all, > > > > Let me expand a little on my last e-mail. In the last few > years Maximum Simulated likelihood has been proposed as a > good alternative for estimating models where various random > effects are present so that maximum likelihood estimation > requires multivariate integration. Though Gauss-Hermite > integration is possible with, say, four or less random > effects, integration by simulation seems to be a promising > alternative. Integration by simulation can be based on random > draws from a uniform. However, it has been suggested in the > literature that using Halton draws (which are systematic and > cover better the 0-1 interval) is better. For these reasons I > would like to use Halton draws to write a simulated maximum > likelihood routine. > > > > I have found however that this is not an easy task in > Stata, as most Halton generators currently available are > written in low level language on the basis of programming > facilities that we do not have in Stata. I am sure there is a > Stata way to do it, I just cannot imagine an efficient way > (all my ideas crash with the length limits of macros and > matrices in 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/

- Prev by Date:
**Re: st: halton sequence** - Next by Date:
**st: New package -cochran- on SSC** - Previous by thread:
**Re: st: halton sequence** - Next by thread:
**RE: st: halton sequence** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |