Difference between revisions of "MultiNormal"

 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category::Multivariate Distributions]]
+
[[Category:Multivariate Distribution Functions]]
 +
[[Category: Multivariate Distributions library functions]]
 
[[Category:Doc Status D]] <!-- For Lumina use, do not change -->
 
[[Category:Doc Status D]] <!-- For Lumina use, do not change -->
= 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 & j, which must be the same length.
+
== MultiNormal(m, s, c, i, j) ==
  
Multinormal uses a correlation matrix.  Compare with [[Gaussian]], which also defines a multi-variate normal but which uses a covariance matrix.
+
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.
  
= Library =
+
[[MultiNormal]] uses a correlation matrix.  Compare with [[Gaussian]], which also defines a multi-variate normal but which uses a covariance matrix.
  
Multivariate Distribution.ana
+
== Library ==
 +
Multivariate Distributions library functions ([[media:Multivariate Distributions.ana |Multivariate Distributions.ana]])
 +
:Use [[File menu|File]] &rarr; '''Add Library...''' to add this library
  
= Notes =
+
== Example ==
 +
:<code>Index I := [1, 2, 3, 4]</code>
 +
:<code>Index J := [1, 2, 3, 4]</code>
 +
:<code>Variable M :=</code>
 +
:{| class="wikitable"
 +
! colspan="4" | I &#9654;
 +
|-
 +
! 1 !! 2 !! 3 !! 4
 +
|-
 +
| 10 || -5 || 0 || 7
 +
|}
  
MultiNormal can be used with the [[Random]] function to generate a single multivariate sample point, indexed by I.  E.g.:
+
:<code>Variable S := </code>
Random( MultiNormal(m,s,c,i,j) )
+
:{| class="wikitable"
 +
! colspan="4" | I &#9654;
 +
|-
 +
! 1 !! 4 !! 16 !! 9
 +
|-
 +
| 10 || -5 || 0 || 7
 +
|}
  
To generate independent samples along one or more indexes K1,K2,K3, use the Over parameter, e.g.:
+
:<code>Variable Cor := </code>
MultiNormal(m,s,c,i,j,Over:K1,K2,K3)
+
:{| class="wikitable"
 +
! !! colspan="4" | I &#9654;
 +
|-
 +
! J &#9660; !! 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
 +
|}
  
See [[Gaussian]] for an example.
+
:<code>MultiNormal(M, S, C, I, J) &rarr;</code>
  
= See Also =
+
[[image:Gaussian1_2.jpg]]
 +
[[image:Gaussian1_4.jpg]]
 +
[[image:Gaussian2_3.jpg]]
 +
[[image:Gaussian2_4.jpg]]
  
* [[Gaussian]] : Multivariate normal specified using covariance rather than correlation.
+
(The above graphs are scatter plots in sample view, using <code>I</code> as the coordinate index.)
* [[Normal]] : 1-D normal distribution
+
 
* [[BiNormal]], [[Normal_correl]] : 2-D normal distributions
+
=== Single Random Sample ===
 +
MultiNormal may be used with the [[Random]] function to generate a single random vector, indexed by <code>I</code>, drawn from the multi-variate [[Gaussian]] distribution.  Using the above variables, the usage is:
 +
:<code>Random(MultiNormal(M, CV, I, J))</code>
 +
 
 +
=== 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 <code>K</code>, use:
 +
:<code>MultiNormal(M, CV, I, J, Over: K)</code>
 +
 
 +
== See Also ==
 +
* [[Gaussian]] -- Multivariate normal specified using covariance rather than correlation.
 +
* [[Normal]] -- 1-D normal distribution
 +
* [[BiNormal]]
 +
* [[Normal_correl]] -- 2-D normal distributions
 
* [[Random]]
 
* [[Random]]
* [[Correlation]] : For estimating a sample correlation matrix from data.
+
* [[Correlation]] -- For estimating a sample correlation matrix from data.
 +
* [[Multivariate distributions]]
 +
* [[media:Multivariate Distributions.ana |Multivariate Distributions.ana]]

Latest revision as of 22:11, 24 May 2016


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.