# [SciPy-user] Generating random variables in a joint normal distribution?

Robert Kern robert.kern@gmail....
Sun Oct 28 23:37:16 CDT 2007

```Parvel Gu wrote:
> Hi,
>
> 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.

Careful there. The Greek letter sigma is usally reserved for the standard
deviation, the square root of variance.

> 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
> [
> cov(p,p), cov(p,s)
> cov(s,p), cov(s,s)
> ]
>
> 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?

Yes.

--
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
```