f_dst_llogistic_cdf_core Function

public elemental function f_dst_llogistic_cdf_core(x, alpha, beta, loc, tail) result(p)

Cumulative distribution function for log-logistic distribution.

Arguments

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

sample position

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

distribution log-scale

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

distribution shape

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

distribution log-location

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

tail options

Return Value real(kind=wp)


Called by

proc~~f_dst_llogistic_cdf_core~~CalledByGraph proc~f_dst_llogistic_cdf_core f_dst_llogistic_cdf_core proc~f_dst_llogistic_cdf f_dst_llogistic_cdf proc~f_dst_llogistic_cdf->proc~f_dst_llogistic_cdf_core interface~fsml_llogistic_cdf fsml_llogistic_cdf interface~fsml_llogistic_cdf->proc~f_dst_llogistic_cdf

Source Code

elemental function f_dst_llogistic_cdf_core(x, alpha, beta, loc, tail) result(p)

! ==== Description
!! Cumulative distribution function for log-logistic distribution.

! ==== Declarations
  real(wp)        , intent(in) :: x     !! sample position
  real(wp)        , intent(in) :: alpha !! distribution log-scale
  real(wp)        , intent(in) :: beta  !! distribution shape
  real(wp)        , intent(in) :: loc   !! distribution log-location
  character(len=*), intent(in) :: tail  !! tail options
  real(wp)                     :: z     !! log-scaled variable
  real(wp)                     :: t     !! transformed variable
  real(wp)                     :: p

! ==== Instructions

  ! compute transformed variable
  z = (log(x) - loc) / alpha
  t = exp(beta * z)

  ! compute integral (left tailed)
  p = t / (1.0_wp + t)

  ! tail options
  select case(tail)
     case("left")
        p = p
     case("right")
        p = 1.0_wp - p
     case("two")
        if (z .gt. 0.0_wp) then
           p = 2.0_wp * (1.0_wp - p)
        else
           p = 2.0_wp * p
        endif
     case("confidence")
        if (z .gt. 0.0_wp) then
           p = 1.0_wp - 2.0_wp * (1.0_wp - p)
        else
           p = 1.0_wp - 2.0_wp * p
        endif
  end select

end function f_dst_llogistic_cdf_core