Computes (sample) variance.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x(:) |
x vector (assumed size array) |
||
| real(kind=wp), | intent(in) | :: | ddf |
delta degrees of freedom |
variance
pure function f_sts_var_core(x, ddf) result(var) ! ==== Description !! Computes (sample) variance. ! ==== Declarations real(wp), intent(in) :: x(:) !! x vector (assumed size array) real(wp), intent(in) :: ddf !! delta degrees of freedom real(wp) :: xbar !! mean of x real(wp) :: var !! variance ! ==== Instructions xbar = f_sts_mean_core(x) var = dot_product( (x - xbar), (x - xbar) ) / & & (real(size(x), kind=wp) - ddf) end function f_sts_var_core