Home  >>  Archives  >>  Volume 11 Number 2  >>  st0229

The Stata Journal
Volume 11 Number 2: pp. 299-304



Subscribe to the Stata Journal
cover

Generating random samples from user-defined distributions

Katarína Lukácsy
Central European University
Budapest, Hungary
[email protected]
Abstract.  Generating random samples in Stata is very straightforward if the distribution drawn from is uniform or normal. With any other distribution, an inverse method can be used; but even in this case, the user is limited to the built-in functions. For any other distribution functions, their inverse must be derived analytically or numerical methods must be used if analytical derivation of the inverse function is tedious or impossible. In this article, I introduce a command that generates a random sample from any user-specified distribution function using numeric methods that make this command very generic.
Terms of use     View this article (PDF)

View all articles by this author: Katarína Lukácsy

View all articles with these keywords: rsample, random sample, user-defined distribution function, inverse method, Monte Carlo exercise

Download citation: BibTeX  RIS

Download citation and abstract: BibTeX  RIS