Generate multivariate normal data

How can I generate data from multivariate normal distribution?

3 Answers



0



Use the GAUSS function rndMVn to create random multivariate normal numbers. Here is a quick example:

cov = { 1 0.3, 0.3 1 };
m = { 0, 0 };
x = rndMVn(10, m, cov);

It will assign x to something similar to:

      0.13556258       0.70364339 
       1.3377170        1.7658075 
      0.45610105        1.0462764 
      0.80858336       0.61191143 
     -0.12203310        1.1235922 
     -0.33557195       -1.1784729 
      0.64867047       0.64239651 
      -1.3486377      -0.35377445 
      0.25183689      -0.38000242 
       1.4196805        2.1463587 

Note that the mean, m, must be specified for each column. If you at some point need multivariate t distributed numbers, you can use rndMVt

aptech

1,338


0



 

I dont have that function because i'm using Gauss 9.0. I also have GaussX.



0



cov = {   1  0.3,
        0.3    1 };

m = { 0, 0 };

x = rndn(10,2);

x1 = x * chol(cov) + m';

 

Your Answer


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 30 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy