Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "David Radwin" <dradwin@mprinc.com> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: Questions for random data generation and value label |
Date | Mon, 11 Mar 2013 10:16:46 -0700 (PDT) |
Mark, Are you thinking of -drawnorm-? David -- David Radwin Senior Research Associate MPR Associates, Inc. 2150 Shattuck Ave., Suite 800 Berkeley, CA 94704 Phone: 510-849-4942 Fax: 510-849-0794 www.mprinc.com > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- > statalist@hsphsun2.harvard.edu] On Behalf Of Yu Xue > Sent: Monday, March 11, 2013 9:50 AM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: Questions for random data generation and value label > > Thanks Maarten! > > What I want is Normal Distribution. Is there a way to randomly > generate a variable with specific mean, SD, and range, > > Thanks!! > Mark > > On Mon, Mar 11, 2013 at 10:35 AM, Maarten Buis <maartenlbuis@gmail.com> > wrote: > > On Mon, Mar 11, 2013 at 4:20 PM, Yu Xue wrote: > >> I already checked "-help random_number_functions-", but I still can > >> not find the answer to my question. > >> > >> I knew that I can use a formula similar like this: > >> Var=a+int((b-a+1)*runiform()), to keep a specific range in [a,b] > >> and use another formula: Var=invnorm(uniform())*SD+mean, to keep > >> specific Standard deviation and mean. > >> But I do not know how to generate a "Var" with all specific range, SD, > and mean. > >> Please note that I do not generate a sample data from the actual data, > >> what I want to generate is synthetic data (totally fake data). > > > > What distribution do you want to draw your new variable from? Do you > > want it to be normally (Gaussian) distributed, gamma distributed, beta > > distribed, Fisk distributed, Laplace distributed, ... The number of > > choices is huge, but without choosing your distribution you cannot > > draw your random numbers. > > > > -- Maarten > > > > > > --------------------------------- > > Maarten L. Buis > > WZB > > Reichpietschufer 50 > > 10785 Berlin > > Germany > > > > http://www.maartenbuis.nl > > --------------------------------- * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/