Programmer Guide/SPU Reference/EXSTAT: Difference between revisions

From STX Wiki
Jump to navigationJump to search
(initial import)
 
No edit summary
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
====EXSTAT - calculation of statistical moments====
Calculation of statistical moments.
 
==<code>[SPU EXSTAT <var>X PX NORM</var> OUT <var>M1 M2 M3 M4 N</var>]</code>==
=====Usage:=====
{|class="einrahmen"
 
!input !!description !!data type !!value type!!default value
<code>EXSTAT <var>X</var> <var>PX</var> <var>TYP</var></code>
 
=====Inputs:=====
 
{|
|-
|-
|X
|<var>X</var>||data vector||number, vector ||variable ||<code>0,1,..</code>
|data vector (default: 0 .. N<nowiki>-</nowiki>1)
|-
|-
|PX
|<var>PX</var>||probability vector||number, vector||variable ||<code>1, 1, ...
|probability vector (default: 1..1)
|-
|-
|TYP
|<var>NORM</var>||normalization flag||number (int.), string||constant ||<code>0</code> (= <code>NO</code>)
|0 ... central moments
|-
|-
|  
!output !!description !!data type !!value type!!comment
|1 ... "spectral moments"
|-
|<var>M1</var>||1st moment (mean)||number||variable
|-
|<var>M2</var>||2nd moment (variance or spread)||number||variable
|-
|<var>M3</var>||3rd moment (skewness)||number||variable
|-
|<var>M4</var>||4th moment (kurtosis)||number||variable
|-
|<var>N</var>||number of data samples||number||constant
|}
|}
 
Note:
=====Outputs:=====
*At least one of the data vectors <var>X</var> and <var>PX</var> must be supplied!
 
*The number of data points <var>N</var> is set to the length of the vector <var>X</var> or <var>PX</var>.
{|
*If <var>X</var> is a not connected, the ''x''-data are initialized with ''x''<sub>i</sub> = i.
*If <var>X</var> is a number, the ''x''-data are initialized with ''x''<sub>i</sub> = <var>X</var>+i.
*If <var>PX</var> is not a vector, the probabilies ''px''<sub>i</sub> are set to 1.
;Description:
{|class="einrahmen"
!output !!<var>NORM</var>=<code>0</code> !!<var>NORM</var>=<code>1</code> !!description
|-
|-
|<var>M1</var>
|<var>M1</var>
|first moment (mean value) (number)
|<math>\mu\!</math>
|-
|<math>\mu\!</math>
|M2
|mean: <math>\mu = \frac{\sum_{i=0}^{N-1} x_i px_i}{\sum_{i=0}^{N-1} px_i}</math>
|second moment (variance) (number)
|-
|-
|M3
|<var>M2</var>
|third moment (number)
|<math>V\!</math>
|<math>\frac{V}{\mu}</math>
|variance: <math>\sigma^2 = V = \frac{\sum_{i=0}^{N-1}(x_i-\mu)^2px_i}{\sum_{i=0}^{N-1} px_i}</math>
|-
|-
|M4
|<var>M3</var>
|fourth moment (number)
|<math>S\!</math>
|<math>\frac{S}{\sqrt{V^3}}</math>
|skewness: <math>S = \frac{\sum_{i=0}^{N-1}(x_i-\mu)^3px_i}{\sum_{i=0}^{N-1} px_i}</math>
|-
|-
|N
|<var>M4</var>
|length of X and <var>PX</var> (number)
|<math>K\!</math>
|<math>\frac{K}{V^2}</math>
|kurtosis: <math>K = \frac{\sum_{i=0}^{N-1}(x_i-\mu)^4px_i}{\sum_{i=0}^{N-1} px_i}</math>
|}
|}
 
;See also:
=====Function:=====
<[[../#Signal Processing Atoms|SP-atoms]]>
 
<!-- AN, 2.5.2011 -->
Compute the statistical moments of the inputs.
 
[[File:1222.png]] first moment
 
[[File:1223.png]] k-th moment
 
If <var>TYP</var> = 1 then the results are normalized as follows:
 
[[File:1224.png]] (spectral) spread
 
[[File:1225.png]] (Fisher) skewness
 
[[File:1226.png]] (Pearson) kurtosis
 
If both inputs are set to default values, calculation is stopped and an error is returned.

Latest revision as of 11:56, 9 May 2011

Calculation of statistical moments.

[SPU EXSTAT X PX NORM OUT M1 M2 M3 M4 N]

input description data type value type default value
X data vector number, vector variable 0,1,..
PX probability vector number, vector variable 1, 1, ...
NORM normalization flag number (int.), string constant 0 (= NO)
output description data type value type comment
M1 1st moment (mean) number variable
M2 2nd moment (variance or spread) number variable
M3 3rd moment (skewness) number variable
M4 4th moment (kurtosis) number variable
N number of data samples number constant

Note:

  • At least one of the data vectors X and PX must be supplied!
  • The number of data points N is set to the length of the vector X or PX.
  • If X is a not connected, the x-data are initialized with xi = i.
  • If X is a number, the x-data are initialized with xi = X+i.
  • If PX is not a vector, the probabilies pxi are set to 1.
Description
output NORM=0 NORM=1 description
M1 {\displaystyle \mu \!} {\displaystyle \mu \!} mean: {\displaystyle \mu ={\frac {\sum _{i=0}^{N-1}x_{i}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
M2 {\displaystyle V\!} {\displaystyle {\frac {V}{\mu }}} variance: {\displaystyle \sigma ^{2}=V={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{2}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
M3 {\displaystyle S\!} {\displaystyle {\frac {S}{\sqrt {V^{3}}}}} skewness: {\displaystyle S={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{3}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
M4 {\displaystyle K\!} {\displaystyle {\frac {K}{V^{2}}}} kurtosis: {\displaystyle K={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{4}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
See also

<SP-atoms>

Navigation menu

Personal tools