MultiNormal


MultiNormal(m, s, c, i, j)

A multi-variate normal (or Gaussian) distribution with mean «m», standard deviation «s», and correlation matrix «cm». «m» and «s» may be scalar or indexed by «i». «cm» must be symmetric, positive-definite, and indexed by «i» and «j», which must be the same length.

MultiNormal uses a correlation matrix. Compare with Gaussian, which also defines a multi-variate normal but which uses a covariance matrix.

Library

Multivariate Distributions library functions (Multivariate Distributions.ana)

Use FileAdd Library... to add this library

Example

Index I := [1, 2, 3, 4]
Index J := [1, 2, 3, 4]
Variable M :=
I ▶
1 2 3 4
10 -5 0 7
Variable S :=
I ▶
1 4 16 9
10 -5 0 7
Variable Cor :=
I ▶
J ▼ 1 2 3
1 1 -0.5 0.3 0.7
2 -0.5 1 -0.8 -0.2
3 0.3 -0.8 1 0.4
4 0.7 -0.2 0.4 1
MultiNormal(M, S, C, I, J) →

Gaussian1 2.jpg Gaussian1 4.jpg Gaussian2 3.jpg Gaussian2 4.jpg

(The above graphs are scatter plots in sample view, using I as the coordinate index.)

Single Random Sample

MultiNormal may be used with the Random function to generate a single random vector, indexed by I, drawn from the multi-variate Gaussian distribution. Using the above variables, the usage is:

Random(MultiNormal(M, CV, I, J))

Independent samples

The «Over» parameter can also be used with MultiNormal to generate multivariate samples that are independent over additional indexes. For example, to generate an independent MultiNormal for each element of Index K, use:

MultiNormal(M, CV, I, J, Over: K)

See Also

Comments


You are not allowed to post comments.