Statalist The Stata Listserver

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

Re: st: simulating datasets with certain characteristics

From   Richard Williams <>
Subject   Re: st: simulating datasets with certain characteristics
Date   Tue, 25 Apr 2006 12:04:18 -0500

At 09:36 AM 4/25/2006, John Novak wrote:
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.
There is an important difference between corr2data and drawnorm. With corr2data, the simulated data set will have EXACTLY the correlations, means, and standard deviations you specify. It is like having the entire population in your data set. With drawnorm, you are drawing a random sample from a population with the population parameters you specify. Hence, because of sampling variability, the correlations etc. in your simulated sample will differ somewhat from the parameters you have specified.

Which do you want for your purposes? If, say, you were trying to replicate published analyses, where the correlations etc. were included in the paper, you would want corr2data. But if, say, you planned to draw a thousand samples from a hypothetical population, you would want drawnorm; otherwise if you used corr2data there would be zero sampling variability. This might be handy if, say, you wanted to see how many times a hypothesis was correctly or incorrectly rejected.

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: Richard.A.Williams.5@ND.Edu
WWW (personal):
WWW (department):
* For searches and help try:

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