Impure wrapper function for f_sts_var_core.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x(:) |
x vector (assumed size array) |
||
| real(kind=wp), | intent(in), | optional | :: | ddf |
delta degrees of freedom |
variance
impure function f_sts_var(x, ddf) result(var) ! ==== Description !! Impure wrapper function for `f_sts_var_core`. ! ==== Declarations real(wp), intent(in) :: x(:) !! x vector (assumed size array) real(wp), intent(in), optional :: ddf !! delta degrees of freedom real(wp) :: ddf_w !! final value for ddf real(wp) :: xbar !! mean of x real(wp) :: var !! variance ! ==== Instructions ! ---- handle input ! assume ddf = 0 (population, not sample statistics) ddf_w = 0.0_wp if (present(ddf)) ddf_w = ddf ! check if value is valid if (ddf_w .ne. 1.0_wp .and. ddf_w .ne. 0.0_wp) then ! write error message and assign NaN value if invalid call s_err_print(fsml_error(2)) var = f_utl_assign_nan() return endif ! check if size is valid if (size(x) .le. 1) then ! write error message and assign NaN value if invalid call s_err_print(fsml_error(4)) var = f_utl_assign_nan() return endif ! ---- compute variance ! call pure function var = f_sts_var_core(x, ddf_w) end function f_sts_var