EXSTAT
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 | |
| M2 | 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
μ
=
∑
i
=
0
N
−
1
x
i
p
x
i
∑
i
=
0
N
−
1
p
x
i
V
=
∑
i
=
0
N
−
1
(
x
i
−
μ
)
2
p
x
i
∑
i
=
0
N
−
1
p
x
i
S
=
∑
i
=
0
N
−
1
(
x
i
−
μ
)
3
p
x
i
∑
i
=
0
N
−
1
p
x
i
K
=
∑
i
=
0
N
−
1
(
x
i
−
μ
)
4
p
x
i
∑
i
=
0
N
−
1
p
x
i
{\displaystyle {\begin{matrix}\mu ={\frac {\sum _{i=0}^{N-1}x_{i}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}&V={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{2}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}\\S={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{3}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}&K={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{4}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}\end{matrix}}}
| output | NORM=0 |
NORM=1 |
stat. moment |
|---|---|---|---|
| M1 |
μ
{\displaystyle \mu \!}
|
μ
{\displaystyle \mu \!}
|
μ
=
∑
i
=
0
N
−
1
x
i
p
x
i
∑
i
=
0
N
−
1
p
x
i
{\displaystyle \mu ={\frac {\sum _{i=0}^{N-1}x_{i}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
|
| M2 |
V
{\displaystyle V\!}
|
V
μ
{\displaystyle {\frac {V}{\mu }}}
|
σ
2
=
V
=
∑
i
=
0
N
−
1
(
x
i
−
μ
)
2
p
x
i
∑
i
=
0
N
−
1
p
x
i
{\displaystyle \sigma ^{2}=V={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{2}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
|
| M3 |
S
{\displaystyle S\!}
|
S
V
3
{\displaystyle {\frac {S}{\sqrt {V^{3}}}}}
|
S
=
∑
i
=
0
N
−
1
(
x
i
−
μ
)
3
p
x
i
∑
i
=
0
N
−
1
p
x
i
{\displaystyle S={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{3}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
|
- See also
<SP-atoms>