Thank you so much, Austin!
>Your code doesn't match your stated desiderata:
Yes!, my bad !
variable 1= 125+-25 mg/dl
variable 2= 120+-50 mg/dl
>Sampling variation is normal; if you want to match .7 exactly use
my bad again!
Definitely, sampling variability will not provide exact values. However,
simulating a large number of observations will provide very close estimates.
But the problem it that I was simulating with a non-updated do-file (with
n=10).
Simulations with 10000000 indeed provide a covariance very close to that
inputed.
. corr cholesterol1 cholesterol2, covar
(obs=10000000)
| choles~1 choles~2
-------------+------------------
cholesterol1 | 25.0221
cholesterol2 | .697355 49.9838
*
* 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/