Dear Tiago,
please try this:
--------------------------------begin example------------------------
corr2data cholesterol1 cholesterol2, means(125 120) cov(25, 0.7\ 0.7, 50)
cstorage(full)
correlate cholesterol1 cholesterol2, covariance
(obs=1000)
| choles~1 choles~2
-------------+------------------
cholesterol1 | 25
cholesterol2 | .7 50
---------------------------------end example------------------------------
HTH and Kind Regards,
Carlo
-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di
[email protected]
Inviato: marted� 18 marzo 2008 17.23
A: [email protected]
Oggetto: st: Question about -drawnorm- for two normally distributed
variables
Dear all,
I just want to generate two means which are modelled as being bivariate
normally distributed. However, I am not 100% sure regarding doing that in
Stata.
I have to simulate two variables (mean+-standard deviation, respectively:
variable 1 = 125+-50 mg/dl
variable 2 = 120+-25 mg/dl
covariance = 0.7
In this respect, I am using the following code:
clear
matrix C = (25, 0.7\ 0.7, 50)
matrix m = (125,120)
drawnorm cholesterol1 cholesterol2, n(100) means (m) cov(C)
My question is: is that correct? when I type
corr cholesterol1 cholesterol2, covar
the estimated covariance (for 10^6 simulated values) is far away from the
inputed 0.7 value.
For instance:
| choles~1 choles~2
-------------+------------------
cholesterol1 | 24.9746
cholesterol2 | .655911 49.9338
(for 1000000 simulated values)
Is that normal or am I doing something wrong?
Thanks again for your time.
Tiago
*
* 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/