f_dst_gamma_cdf_core Function

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

Cumulative distribution function for gamma distribution.

Arguments

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

sample position

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

shape parameter

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

scale parameter

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

location parameter

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

tail options

Return Value real(kind=wp)

returned probability integral


Calls

proc~~f_dst_gamma_cdf_core~~CallsGraph proc~f_dst_gamma_cdf_core f_dst_gamma_cdf_core proc~f_dst_gammai_core f_dst_gammai_core proc~f_dst_gamma_cdf_core->proc~f_dst_gammai_core

Called by

proc~~f_dst_gamma_cdf_core~~CalledByGraph proc~f_dst_gamma_cdf_core f_dst_gamma_cdf_core proc~f_dst_gamma_cdf f_dst_gamma_cdf proc~f_dst_gamma_cdf->proc~f_dst_gamma_cdf_core proc~f_dst_gamma_ppf_core f_dst_gamma_ppf_core proc~f_dst_gamma_ppf_core->proc~f_dst_gamma_cdf_core interface~fsml_gamma_cdf fsml_gamma_cdf interface~fsml_gamma_cdf->proc~f_dst_gamma_cdf proc~f_dst_gamma_ppf f_dst_gamma_ppf proc~f_dst_gamma_ppf->proc~f_dst_gamma_ppf_core interface~fsml_gamma_ppf fsml_gamma_ppf interface~fsml_gamma_ppf->proc~f_dst_gamma_ppf

Source Code

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

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

! ==== Declarations
  real(wp)        , intent(in) :: x       !! sample position
  real(wp)        , intent(in) :: alpha   !! shape  parameter
  real(wp)        , intent(in) :: beta    !! scale parameter
  real(wp)        , intent(in) :: loc     !! location parameter
  character(len=*), intent(in) :: tail    !! tail options
  real(wp)                     :: z       !! standardised variable
  real(wp)                     :: p       !! returned probability integral

! ==== Instructions

! ---- compute CDF

  ! compute integral (left tailed)
  if (x .le. loc .or. alpha .le. 0.0_wp .or. beta .le. 0.0_wp) then
     p = 0.0_wp
  else
     z = (x - loc) / beta
     p = f_dst_gammai_core(alpha, z)
  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
     ! two-tailed
     case("two")
        p = 2.0_wp * (1.0_wp - p)
     ! confidence interval
     case("confidence")
        p = 1.0_wp - 2.0_wp * (1.0_wp - p)
   end select

end function f_dst_gamma_cdf_core