f_dst_exp_cdf_core Function

public elemental function f_dst_exp_cdf_core(x, lambda, loc, tail) result(p)

Cumulative distribution function for exponential distribution.

Arguments

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

sample position

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

lambda parameter, beta(scale) = 1/lambda = mu/mean

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

location parameter

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

tail options

Return Value real(kind=wp)

returned probability integral


Called by

proc~~f_dst_exp_cdf_core~~CalledByGraph proc~f_dst_exp_cdf_core f_dst_exp_cdf_core proc~f_dst_exp_cdf f_dst_exp_cdf proc~f_dst_exp_cdf->proc~f_dst_exp_cdf_core proc~f_dst_exp_ppf_core f_dst_exp_ppf_core proc~f_dst_exp_ppf_core->proc~f_dst_exp_cdf_core interface~fsml_exp_cdf fsml_exp_cdf interface~fsml_exp_cdf->proc~f_dst_exp_cdf proc~f_dst_exp_ppf f_dst_exp_ppf proc~f_dst_exp_ppf->proc~f_dst_exp_ppf_core interface~fsml_exp_ppf fsml_exp_ppf interface~fsml_exp_ppf->proc~f_dst_exp_ppf

Source Code

elemental function f_dst_exp_cdf_core(x, lambda, loc, tail) result(p)

! ==== Description
!! Cumulative distribution function for exponential distribution.

! ==== Declarations
  real(wp)        , intent(in) :: x        !! sample position
  real(wp)        , intent(in) :: loc      !! location parameter
  real(wp)        , intent(in) :: lambda   !! lambda parameter, beta(scale) = 1/lambda = mu/mean
  character(len=*), intent(in) :: tail     !! tail options
  real(wp)                     :: p        !! returned probability integral

! ==== Instructions

! ---- compute CDF

  ! compute integral (left tailed)
  if (x .lt. loc) then
     p = 0.0_wp
  elseif (lambda .lt. 0.0_wp) then
     p = 0.0_wp
  else
     p = 1.0_wp - exp( - lambda * (x - loc) )
  endif

  ! tail options
  select case(tail)
    ! left-tailed; P(z<x)
     case("left")
        p = p
     ! right-tailed; P(z>x)
     case("right")
        p = 1.0_wp - p
   end select

end function f_dst_exp_cdf_core