[SciPy-user] Generating random variables in a joint normal distribution?
Sun Oct 28 23:26:04 CDT 2007
Thanks a lot.
And I am still puzzled about the input arguments, mean and cov.
So take my current problem for example. I am expecting the random
variable P and S, which follow a joint normal distribution with
(Mu)p=(Mu)s=0.5 (the mean?), and (Sigma)p=(Sigma)s=0.4 (the variance),
and a coefficient ro = 0.8.
According to the function multivariate_normal(mean, cov), only the
matrixes of mean and cov are provided as input. Mapping to my problem,
the mean could be [0.5, 0.5]. and the cov matrix is supposed to be
Is it indicated that we have to get each cov(p, s) with some formula like
ro = cov(p, s) / (sqrt(Dp) * sqrt(Ds)) = 0.8
then fill the result into the cov matrix?
On 10/29/07, Robert Kern <email@example.com> wrote:
> In : from numpy import random
> In : random.multivariate_normal?
> Type: builtin_function_or_method
> Base Class: <type 'builtin_function_or_method'>
> Namespace: Interactive
> Return an array containing multivariate normally distributed random numbers
> with specified mean and covariance.
> multivariate_normal(mean, cov) -> random values
> multivariate_normal(mean, cov, [m, n, ...]) -> random values
> mean must be a 1 dimensional array. cov must be a square two dimensional
> array with the same number of rows and columns as mean has elements.
> The first form returns a single 1-D array containing a multivariate
> The second form returns an array of shape (m, n, ..., cov.shape).
> In this case, output[i,j,...,:] is a 1-D array containing a multivariate
> Robert Kern
> "I have come to believe that the whole world is an enigma, a harmless enigma
> that is made terrible by our own mad attempt to interpret it as though it had
> an underlying truth."
> -- Umberto Eco
> SciPy-user mailing list
More information about the SciPy-user