FORCES
FORtran lib for Comp. Env. Sys.
|
Skewness of a vector. More...
Public Member Functions | |
real(sp) function | skewness_sp (dat, mask) |
real(dp) function | skewness_dp (dat, mask) |
Skewness of a vector.
Calculates the skewness of a vector, i.e. the third standardised moment:
\[\tilde \mu_3 = \sum_i\left(\frac{(x-\bar x)}{\sigma_x}\right)^3\]
If an optinal mask is given, the average is only over those locations that correspond to true values in the mask. \(x\) can be single or double precision. The result will have the same numerical precision.
Example
vec = (/ 1., 2, 3., -999., 5., 6. /) m = skewness(vec, mask=(vec >= 0.))
See also example in test directory.
[in] | real(sp/dp) :: dat(:) | 1D-array with input numbers. |
[in] | logical, optional :: mask(:) | 1D-array of logical values with size(dat) . If present, only those locations in vec corresponding to the true values in mask are used. |
real(sp/dp) :: skewness | Skewness of all elements in dat. |
Definition at line 528 of file mo_moment.f90.
real(dp) function mo_moment::skewness::skewness_dp | ( | real(dp), dimension(:), intent(in) | dat, |
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 1588 of file mo_moment.f90.
real(sp) function mo_moment::skewness::skewness_sp | ( | real(sp), dimension(:), intent(in) | dat, |
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 1630 of file mo_moment.f90.