FORCES
FORtran lib for Comp. Env. Sys.
|
First four moments, stddev and mean absolute devation. More...
Public Member Functions | |
subroutine | moment_sp (dat, average, variance, skewness, kurtosis, mean, stddev, absdev, mask, sample) |
subroutine | moment_dp (dat, average, variance, skewness, kurtosis, mean, stddev, absdev, mask, sample) |
First four moments, stddev and mean absolute devation.
Calculates the first four sample/population moments of a vector, i.e. mean, variance, skewness, and kurtosis, as well as standard deviation and mean absolute devation.
All output is optional.
If an optinal mask is given, the calculations are 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., 4., 5., 6. /) call moment(vec, average=average, variance=variance, skewness=skewness, kurtosis=kurtosis, & mean=mean, stddev=stddev, absdev=absdev, mask=mask, sample=sample) --> average = 3.5
[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. |
[in] | logical, optional :: sample | Logical value. If present and False, the population variance and std-dev will be calculated (divide by n). |
[out] | real(sp/dp), optional :: average | Average of input vector. |
[out] | real(sp/dp), optional :: variance | Sample variance of input vector (either a sample or pupulation moment). |
[out] | real(sp/dp), optional :: skewness | Skewness of input vector. |
[out] | real(sp/dp), optional :: kurtosis | Excess kurtosis of input vector. |
[out] | real(sp/dp), optional :: mean | Same as average. |
[out] | real(sp/dp), optional :: stddev | Sqaure root of variance (either a sample or pupulation moment). |
[out] | real(sp/dp), optional :: absdev | Mean absolute deviations from average. |
Definition at line 494 of file mo_moment.f90.
subroutine mo_moment::moment::moment_dp | ( | real(dp), dimension(:), intent(in) | dat, |
real(dp), intent(out), optional | average, | ||
real(dp), intent(out), optional | variance, | ||
real(dp), intent(out), optional | skewness, | ||
real(dp), intent(out), optional | kurtosis, | ||
real(dp), intent(out), optional | mean, | ||
real(dp), intent(out), optional | stddev, | ||
real(dp), intent(out), optional | absdev, | ||
logical, dimension(:), intent(in), optional | mask, | ||
logical, intent(in), optional | sample | ||
) |
Definition at line 1358 of file mo_moment.f90.
subroutine mo_moment::moment::moment_sp | ( | real(sp), dimension(:), intent(in) | dat, |
real(sp), intent(out), optional | average, | ||
real(sp), intent(out), optional | variance, | ||
real(sp), intent(out), optional | skewness, | ||
real(sp), intent(out), optional | kurtosis, | ||
real(sp), intent(out), optional | mean, | ||
real(sp), intent(out), optional | stddev, | ||
real(sp), intent(out), optional | absdev, | ||
logical, dimension(:), intent(in), optional | mask, | ||
logical, intent(in), optional | sample | ||
) |
Definition at line 1435 of file mo_moment.f90.