Statalist The Stata Listserver


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

st: RE: simulating datasets with certain characteristics


From   "Bauldry, Shawn" <Sbauldry@ppv.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: simulating datasets with certain characteristics
Date   Tue, 25 Apr 2006 10:50:13 -0400

There are probably many ways to do this, but "corr2data" is probably the
simplest.  The following should do what you want.


set obs 500

mat C = 	(1.0, 0.4 \ ///
		 0.4, 1.0)
corr2data Measure1 Measure2, n(500) corr(C)




-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jason
Thompson
Sent: Tuesday, April 25, 2006 10:28 AM
To: statalist
Subject: st: simulating datasets with certain characteristics

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