Difference between revisions of "Gaussian distribution"

Line 2: Line 2:
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
  
= Gaussian(m, cv, I, J) =
+
== Gaussian(m, cv, I, J) ==
 +
A multi-variate Gaussian distribution based on a mean vector «m» and covariance matrix «cv».  The covariance matrix must symmetric and positive-definite.  The meanVec is indexed by «I».  The covariance matrix is 2-D, indexed by «I» & «J».  Indexes «I» & «J» should be the same length.
  
Declaration:
+
Declaration:  
Gaussian(meanVec : numeric[I],covar : numeric[I,J]; I,J:IndexType)
+
:[[Gaussian]](m : numeric[I], cv : numeric[I, J]; I, J: IndexType)
  
A multi-variate Gaussian distribution based on a mean vector and covariance matrix.  The covariance matrix must symmetric and positive-definite.  The meanVec is indexed by I.  The covariance matrix is 2-D, indexed by I & J.  Indexes I & J should be the same length.
+
== Library ==
 +
<code>Multivariate Distributions.ana</code>
  
= Library =
+
== Example ==
 
+
:<code>Index I := [1, 2, 3, 4]</code>
Multivariate Distributions.ana
+
:<code>Index J := [1, 2, 3, 4]</code>
 
+
:<code>Variable M := </code>
= Example =
+
:{| class="wikitable"
 
+
! colspan="4" | I &#9654;  
Index I := [1,2,3,4]
+
|-
Index J := [1,2,3,4]
+
! 1 !! 2 !! 3 !! 4
{| border="1"
 
|+ Variable M := Table(I)
 
! I &rarr; !! 1 !! 2 !! 3 !! 4
 
 
|-
 
|-
| || 10 || -5 || 0 || 7
+
| 10 || -5 || 0 || 7
 
|}
 
|}
  
{| border="1"
+
:<code>Variable CV :=</code>
|+ Variable CV := Table(I,J)
+
:{| class="wikitable"
! !! !! colspan="4" | I
+
! !! colspan="4" | I &#9654; 
 
|-
 
|-
! !! !! 1 !! 2 !! 3 !! 4
+
! J &#9660; !! 1 !! 2 !! 3 !! 4
 
|-
 
|-
! rowspan="4" | J
+
! 1
! 1 || 1 || -2 || 4.8 || 6.3
+
| 1 || -2 || 4.8 || 6.3
 
|-
 
|-
! 2 || -2 || 16 || -51.2 || -7.2
+
! 2  
 +
| -2 || 16 || -51.2 || -7.2
 
|-
 
|-
! 3 || 4.8 || -51.2 || 256 || 57.6
+
! 3  
 +
| 4.8 || -51.2 || 256 || 57.6
 
|-
 
|-
! 4 || 6.3 || -7.2 || 57.6 || 81
+
! 4  
 +
| 6.3 || -7.2 || 57.6 || 81
 
|}
 
|}
  
:Gaussian( M, CV, I, J ) &rarr;
+
:<code>Gaussian(M, CV, I, J) &rarr;</code>
  
 
[[image:Gaussian1_2.jpg]]
 
[[image:Gaussian1_2.jpg]]
Line 47: Line 49:
 
[[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 ==
 
 
 
Gaussian 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( Gaussian( M, CV, I, J ) )
 
 
 
== Independent samples ==
 
  
The Over parameter can also be used with Gaussian to generate multivariate samples that are independent over additional indexesFor example, to generate an independent Gaussian for each element of Index K, use:
+
=== Single Random Sample ===
Gaussian( M, CV, I, J, Over: K )
+
Gaussian may be used with the [[Random]] function to generate a single random vector, indexed by «I», drawn from the multi-variate Gaussian distributionUsing the above variables, the usage is:
 +
:<code>Random(Gaussian(M, CV, I, J))</code>
  
= See Also =
+
=== Independent samples ===
 +
The optional «Over» parameter can also be used with Gaussian to generate multivariate samples that are independent over additional indexes.  For example, to generate an independent Gaussian for each element of Index <code>K</code>, use:
 +
:<code>Gaussian(M, CV, I, J, Over: K)</code>
  
* [[Dens_Gaussian]] : The probability density of a Gaussian at x
+
== See Also ==
 +
* [[Dens_Gaussian]] : The probability density of a Gaussian at ''x''
 
* [[MultiNormal]] : For multi-D normal (Gaussian) using correlation, rather than covariance
 
* [[MultiNormal]] : For multi-D normal (Gaussian) using correlation, rather than covariance
 
* [[Normal]] : for 1-D normal
 
* [[Normal]] : for 1-D normal
* [[BiNormal]], [[Normal_correl]] : For 2-D normals
+
* [[BiNormal]]
 +
* [[Normal_correl]] : For 2-D normals
 
* [[Covariance]] : For estimating covariance from data
 
* [[Covariance]] : For estimating covariance from data

Revision as of 19:51, 18 January 2016


Gaussian(m, cv, I, J)

A multi-variate Gaussian distribution based on a mean vector «m» and covariance matrix «cv». The covariance matrix must symmetric and positive-definite. The meanVec is indexed by «I». The covariance matrix is 2-D, indexed by «I» & «J». Indexes «I» & «J» should be the same length.

Declaration:

Gaussian(m : numeric[I], cv : numeric[I, J]; I, J: IndexType)

Library

Multivariate Distributions.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 CV :=
I ▶
J ▼ 1 2 3 4
1 1 -2 4.8 6.3
2 -2 16 -51.2 -7.2
3 4.8 -51.2 256 57.6
4 6.3 -7.2 57.6 81
Gaussian(M, CV, 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

Gaussian 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(Gaussian(M, CV, I, J))

Independent samples

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

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

See Also

Comments


You are not allowed to post comments.