0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_moment::moment Interface Reference

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)
 

Detailed Description

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
Parameters
[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 :: sampleLogical value. If present and False, the population variance and std-dev will be calculated (divide by n).
[out]real(sp/dp), optional :: averageAverage of input vector.
[out]real(sp/dp), optional :: varianceSample variance of input vector (either a sample or pupulation moment).
[out]real(sp/dp), optional :: skewnessSkewness of input vector.
[out]real(sp/dp), optional :: kurtosisExcess kurtosis of input vector.
[out]real(sp/dp), optional :: meanSame as average.
[out]real(sp/dp), optional :: stddevSqaure root of variance (either a sample or pupulation moment).
[out]real(sp/dp), optional :: absdevMean absolute deviations from average.
Note
Input values must be floating points. Inpt and all optional outputs must have same kind.
Author
Matthias Cuntz
Date
Nov 2011
Author
Sebastian Mueller
Date
Dec 2019
  • added optional sample input-para to switch sample to population variance and std-dev.

Definition at line 494 of file mo_moment.f90.

Member Function/Subroutine Documentation

◆ moment_dp()

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.

◆ moment_sp()

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.


The documentation for this interface was generated from the following file: