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

Standard deviation of a vector. More...

Public Member Functions

real(sp) function stddev_sp (dat, mask)
 
real(dp) function stddev_dp (dat, mask)
 

Detailed Description

Standard deviation of a vector.

Calculates the sample standard deviation of a vector, i.e. the square root of the second moment

\[\sigma_x = \sqrt{\sum_i\frac{(x_i-\bar x)^2}{N-1}}\]

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   = stddev(vec, mask=(vec >= 0.))

See also example in test directory

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.
Return values
real(sp/dp) :: stddevSample standard deviation of all elements in dat.
Note
Input values must be floating points.
This is the sample standard deviation. The population standard deviation is: popstddev = stddev * sqrt((n-1)/n)
Author
Matthias Cuntz
Date
Nov 2011

Definition at line 567 of file mo_moment.f90.

Member Function/Subroutine Documentation

◆ stddev_dp()

real(dp) function mo_moment::stddev::stddev_dp ( real(dp), dimension(:), intent(in)  dat,
logical, dimension(:), intent(in), optional  mask 
)

Definition at line 1513 of file mo_moment.f90.

◆ stddev_sp()

real(sp) function mo_moment::stddev::stddev_sp ( real(sp), dimension(:), intent(in)  dat,
logical, dimension(:), intent(in), optional  mask 
)

Definition at line 1550 of file mo_moment.f90.


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