Difference between revisions of "MultiNormal"

(another graph)
Line 2: Line 2:
 
[[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 ) =
+
== MultiNormal(m, s, c, i, j) ==
  
A multi-variate normal (or Gaussian) distribution with mean  m, standard deviation s, and correlation matrix cmm 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.
+
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.
+
[[MultiNormal]] uses a correlation matrix.  Compare with [[Gaussian]], which also defines a multi-variate normal but which uses a covariance matrix.
  
= Library =
+
== Library ==
 +
<code>Multivariate Distribution.ana</code>
  
Multivariate Distribution.ana
+
== Example ==
 
+
:<code>Index I := [1, 2, 3, 4]</code>
= Example =
+
:<code>Index J := [1, 2, 3, 4]</code>
 
+
:<code>Variable M :=</code>
Index I := [1,2,3,4]
+
:{| class="wikitable"
Index J := [1,2,3,4]
+
! colspan="4" | I &#9654;  
{| border="1"
+
|-
|+ Variable M := Table(I)
+
! 1 !! 2 !! 3 !! 4
! I &rarr; !! 1 !! 2 !! 3 !! 4
 
 
|-
 
|-
| || 10 || -5 || 0 || 7
+
| 10 || -5 || 0 || 7
 
|}
 
|}
  
{| border="1"
+
:<code>Variable S := </code>
|+ Variable S := Table(I)
+
:{| class="wikitable"
! I &rarr; !! 1 !! 4 !! 16 !! 9
+
! colspan="4" | I &#9654;  
 
|-
 
|-
| || 10 || -5 || 0 || 7
+
! 1 !! 4 !! 16 !! 9
 +
|-
 +
| 10 || -5 || 0 || 7
 
|}
 
|}
  
{| border="1"
+
:<code>Variable Cor := </code>
|+ Variable Cor := Table(I,J)
+
:{| class="wikitable"
! !! !! colspan="4" | I
+
! !! colspan="4" | I &#9654;
 
|-
 
|-
! !! !! 1 !! 2 !! 3 !! 4
+
! J &#9660; !! 1 !! 2 !! 3 !!  
 
|-
 
|-
! rowspan="4" | J
+
! 1
! 1 || 1 || -0.5 || 0.3 || 0.7
+
| 1 || -0.5 || 0.3 || 0.7
 
|-
 
|-
! 2 || -0.5 || 1 || -0.8 || -0.2
+
! 2  
 +
| -0.5 || 1 || -0.8 || -0.2
 
|-
 
|-
! 3 || 0.3 || -0.8 || 1 || 0.4
+
! 3  
 +
| 0.3 || -0.8 || 1 || 0.4
 
|-
 
|-
! 4 || 0.7 || -0.2 || 0.4 || 1
+
! 4  
 +
| 0.7 || -0.2 || 0.4 || 1
 
|}
 
|}
  
:MultiNormal( M, S, C, I, J ) &rarr;
+
:<code>MultiNormal(M, S, C, I, J) &rarr;</code>
  
 
[[image:Gaussian1_2.jpg]]
 
[[image:Gaussian1_2.jpg]]
Line 53: Line 58:
 
[[image:Gaussian2_4.jpg]]
 
[[image:Gaussian2_4.jpg]]
  
(The above graphs are scatter plots in sample view, using I as the coordinate index.)
+
(The above graphs are scatter plots in sample view, using <code>I</code> 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 indexesFor example, to generate an independent MultiNormal for each element of Index K, use:
+
=== Single Random Sample ===
MultiNormal( M, CV, I, J, Over: K )
+
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]] distributionUsing the above variables, the usage is:
 +
:<code>Random(MultiNormal(M, CV, I, J))</code>
  
= See Also =
+
=== 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>
  
* [[Gaussian]] : Multivariate normal specified using covariance rather than correlation.
+
== See Also ==
* [[Normal]] : 1-D normal distribution
+
* [[Gaussian]] -- Multivariate normal specified using covariance rather than correlation.
* [[BiNormal]], [[Normal_correl]] : 2-D normal distributions
+
* [[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.

Revision as of 22:41, 18 January 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 Distribution.ana

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.