How can I generate a vector of random numbers using the normal distribution?

176 views
Skip to first unread message

Krzysztof W

unread,
Apr 23, 2015, 3:04:32 AM4/23/15
to am...@googlegroups.com
Dear all,

could you tell me how can I generate a vector of random numbers using the normal distribution in AMPL with mean and variance listed below?

param mean :=
1   45
2   35
3   40;

param variance :
    1       2       3 :=
1   1      -2      -1
2  -2      36      -8
3  -1      -8       9;


Kind regards,
Krzystof

Robert Fourer

unread,
May 14, 2015, 11:27:42 AM5/14/15
to am...@googlegroups.com
AMPL and its extended function library (http://ampl.com/resources/extended-function-library/) only provide samples from univariate random distributions. If you know or can compute an AA^T factorization of your n x n covariance matrix, then you can compute a multivariate normal sample from n univariate samples -- according to http://en.wikipedia.org/wiki/Multivariate_normal_distribution#Drawing_values_from_the_distribution. Alternatively you may use a math or stat system (MATLAB, R, ...) to compute multivariate normal samples and then read them as data into AMPL.

Bob Fourer
am...@googlegroups.com

=======
Reply all
Reply to author
Forward
0 new messages