Impure wrapper function for f_dst_logistic_cdf_core.
Handles optional arguments and invalid values for arguments.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x |
sample position |
||
| real(kind=wp), | intent(in), | optional | :: | mu |
distribution location |
|
| real(kind=wp), | intent(in), | optional | :: | scale |
distribution scale |
|
| character(len=*), | intent(in), | optional | :: | tail |
tail options |
impure function f_dst_logistic_cdf(x, mu, scale, tail) result(p) ! ==== Description !! Impure wrapper function for `f_dst_logistic_cdf_core`. !! Handles optional arguments and invalid values for arguments. ! ==== Declarations real(wp) , intent(in) :: x !! sample position real(wp) , intent(in), optional :: mu !! distribution location real(wp) , intent(in), optional :: scale !! distribution scale character(len=*), intent(in), optional :: tail !! tail options real(wp) :: mu_w !! final value of mu real(wp) :: scale_w !! final value of scale character(len=16) :: tail_w !! final tail option real(wp) :: p ! ==== Instructions ! assume location/mean = 0, overwrite if specified mu_w = 0.0_wp if (present(mu)) mu_w = mu ! assume sscale = 1, overwrite if specified scale_w = 1.0_wp if (present(scale)) scale_w = scale ! assume left-tailed, overwrite if specified tail_w = "left" if (present(tail)) tail_w = tail ! check if scale value is valid if (scale_w .le. 0.0_wp) then ! write error message and assign NaN value if invalid call s_err_print(fsml_error(1)) p = f_utl_assign_nan() return endif ! check if tail options are valid if (tail_w .ne. "left" .and. tail_w .ne. "right" .and. & &tail_w .ne. "two" .and. tail_w .ne. "confidence") then call s_err_print(fsml_error(2)) p = f_utl_assign_nan() return endif ! ---- compute CDF ! call pure function to calculate probability integral p = f_dst_logistic_cdf_core(x, mu_w, scale_w, tail_w) end function f_dst_logistic_cdf