Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: simulating datasets with certain characteristics


From   "John Novak" <jnovak@lbusd.k12.ca.us>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: simulating datasets with certain characteristics
Date   Tue, 25 Apr 2006 07:36:29 -0700

drawnorm will do it.  Suppose you wanted 100 observations of each, with
a specified mean and correlation structure.  You could use:

matrix means = (10, 30)
matrix stdev = (5, 9)
matrix cor = (1.0, 0.4 \ 0.4 1.0)
drawnorm measure1 measure2, n(100) m(means) corr(cor) sds(stdev)

This will sample 100 observations on measure1 and measure2 with means
(approximately) 10 and 30, a correlation of approximately 0.4, and
standard deviations of 5 and 9, respectively.

John Novak

>>> jat@northwestern.edu 04/25/06 7:27 AM >>>
Can anyone provide pointers on how to use Stata to simulate a dataset
with
predetermined correlational structure? For instance, say I wanted
MEASURE1
to correlate with MEASURE2 at around r = .4?


*
*   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/
*
*   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/



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