f_dst_f_cdf Function

public impure function f_dst_f_cdf(x, d1, d2, loc, scale, tail) result(p)

Impure wrapper function for f_dst_f_cdf_core. Handles optional arguments and invalid values for arguments.

Arguments

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

sample position

real(kind=wp), intent(in) :: d1

numerator degrees of freedom

real(kind=wp), intent(in) :: d2

denominator degrees of freedom

real(kind=wp), intent(in), optional :: loc

location parameter

real(kind=wp), intent(in), optional :: scale

scale parameter

character(len=*), intent(in), optional :: tail

tail option

Return Value real(kind=wp)

output probability


Calls

proc~~f_dst_f_cdf~~CallsGraph proc~f_dst_f_cdf f_dst_f_cdf proc~f_dst_f_cdf_core f_dst_f_cdf_core proc~f_dst_f_cdf->proc~f_dst_f_cdf_core proc~s_err_print s_err_print proc~f_dst_f_cdf->proc~s_err_print proc~f_dst_betai_core f_dst_betai_core proc~f_dst_f_cdf_core->proc~f_dst_betai_core proc~f_utl_r2c f_utl_r2c proc~s_err_print->proc~f_utl_r2c

Called by

proc~~f_dst_f_cdf~~CalledByGraph proc~f_dst_f_cdf f_dst_f_cdf interface~fsml_f_cdf fsml_f_cdf interface~fsml_f_cdf->proc~f_dst_f_cdf

Source Code

impure function f_dst_f_cdf(x, d1, d2, loc, scale, tail) result(p)

! ==== Description
!! Impure wrapper function for `f_dst_f_cdf_core`.
!! Handles optional arguments and invalid values for arguments.

! ==== Declarations
  real(wp)        , intent(in)           :: x       !! sample position
  real(wp)        , intent(in)           :: d1      !! numerator degrees of freedom
  real(wp)        , intent(in)           :: d2      !! denominator degrees of freedom
  real(wp)        , intent(in), optional :: loc     !! location parameter
  real(wp)        , intent(in), optional :: scale   !! scale parameter
  character(len=*), intent(in), optional :: tail    !! tail option
  real(wp)                               :: loc_w   !! final location
  real(wp)                               :: scale_w !! final scale
  character(len=16)                      :: tail_w  !! tail option final
  real(wp)                               :: p       !! output probability

! ==== Instructions

! ---- handle input

  ! assume loc = 0, overwrite if specified
  loc_w = 0.0_wp
  if (present(loc)) loc_w = loc

  ! assume scale = 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 sentinel value if invalid
     call s_err_print(fsml_error(1))
     p = c_sentinel_r
     return
  endif

  ! check if numerator degrees of freedom value is valid
  if (d1 .le. 0.0_wp) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(1))
     p = c_sentinel_r
     return
  endif

  ! check if denominator degrees of freedom value is valid
  if (d2 .le. 0.0_wp) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(1))
     p = c_sentinel_r
     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
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(2))
     p = c_sentinel_r
     return
  endif

! ----compute CDF

  ! call pure function to calculate probability integral
  p = f_dst_f_cdf_core(x, d1, d2, loc_w, scale_w, tail_w)


end function f_dst_f_cdf