pstdev Interface

public interface pstdev

Calculates the population standard deviation of a set of values given in a vector of any size with one dimension applying the following equation:

Where:

  • is a vector with real numbers.
  • is how many numbers are included in .

Syntax

y = pstdev(x)

Where:

  • x = vector of rank 1 with real numbers. See this example to use an array of rank larger than 1.
  • y = real number of the same kind as x with the population standard deviation of x.

Example

The following program calculates the population standard deviation of a vector:

 PROGRAM pstdevExample
    USE FU_Statistics, ONLY: pstdev
    IMPLICIT NONE
    REAL, DIMENSION(5) :: x = [1., 2., 3., 4., 5.]
    WRITE(*,*) pstdev(x)
 END PROGRAM pstdevExample

Contents


Module Procedures

private pure function pstdev_sp(x) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in), DIMENSION(:) :: x

Vector of real numbers to calculate the population standard deviation. It can have any size and it must have one dimension.

Return Value real(kind=sp)

Real number with the population standard deviation of x.

private pure function pstdev_dp(x) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in), DIMENSION(:) :: x

Vector of real numbers to calculate the population standard deviation. It can have any size and it must have one dimension.

Return Value real(kind=dp)

Real number with the population standard deviation of x.

private pure function pstdev_qp(x) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=qp), intent(in), DIMENSION(:) :: x

Vector of real numbers to calculate the population standard deviation. It can have any size and it must have one dimension.

Return Value real(kind=qp)

Real number with the population standard deviation of x.