Hi. I want to generate data which is characterised by a multivariate normal distribution. I do the following:
Then to check I've entered the above correctly I do:
And get:
Which is great. However now if I enter
I get:
Can anybody tell me why the variance-covariance matrix in my data is so different from C_a, the matrix I enter for drawnorm? It is frequently 1/1000*C_a. Feel like I must be missing something extremely obvious here.
Thanks for any help!
Code:
clear all mat M = (4\5\2\2.8\6) mat C_a = ( .42250, .11430, .04225, .01521, .16900 \ /// .11430, .67640, .06764, .02435, .27056 \ /// .04225, .06764, .25000, .00900, .10000 \ /// .01521, .02435, .00900, .09000, .03600 \ /// .16900, .27056, .10000, .03600, 1.0000 )
Code:
mat list M mat list C_a
Code:
. mat list M M[5,1] c1 r1 4 r2 5 r3 2 r4 2.8 r5 6 . mat list C_a symmetric C_a[5,5] c1 c2 c3 c4 c5 r1 .4225 r2 .1143 .6764 r3 .04225 .06764 .25 r4 .01521 .02435 .009 .09 r5 .169 .27056 .1 .036 1
Code:
set seed 55555 drawnorm a_1 a_2 a_3 a_4 a_5, n(1000) means(M) cov(C_a) mean a_* mat list e(V)
Code:
. set seed 55555 . . drawnorm a_1 a_2 a_3 a_4 a_5, n(1000) means(M) cov(C_a) (obs 1,000) . . mean a_* Mean estimation Number of obs = 1,000 -------------------------------------------------------------- | Mean Std. Err. [95% Conf. Interval] -------------+------------------------------------------------ a_1 | 4.024775 .0202762 3.984986 4.064563 a_2 | 5.040562 .0264706 4.988617 5.092506 a_3 | 2.02859 .0158169 1.997552 2.059628 a_4 | 2.797371 .0098233 2.778094 2.816647 a_5 | 6.001783 .031926 5.939133 6.064432 -------------------------------------------------------------- . mat list e(V) symmetric e(V)[5,5] a_1 a_2 a_3 a_4 a_5 a_1 .00041113 a_2 .00012935 .00070069 a_3 .00002468 .00006461 .00025018 a_4 .0000123 .00002889 6.978e-06 .0000965 a_5 .00015814 .00027018 .00008073 .00002877 .00101927
Thanks for any help!
Comment