f_dst_gpd_ppf_core Function

public elemental function f_dst_gpd_ppf_core(p, xi, mu, sigma) result(x)

Percent point function/quantile function for generalised pareto distribution.

Arguments

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

probability between 0.0 - 1.0

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

distribution shape parameter

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

distribution location

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

distribution dispersion/scale (must be positive)

Return Value real(kind=wp)

sample position


Called by

proc~~f_dst_gpd_ppf_core~~CalledByGraph proc~f_dst_gpd_ppf_core f_dst_gpd_ppf_core proc~f_dst_gpd_ppf f_dst_gpd_ppf proc~f_dst_gpd_ppf->proc~f_dst_gpd_ppf_core interface~fsml_gpd_ppf fsml_gpd_ppf interface~fsml_gpd_ppf->proc~f_dst_gpd_ppf

Source Code

elemental function f_dst_gpd_ppf_core(p, xi, mu, sigma) result(x)

! ==== Description
!! Percent point function/quantile function for generalised pareto distribution.

! ==== Declarations
  real(wp)        , intent(in) :: p       !! probability between 0.0 - 1.0
  real(wp)        , intent(in) :: mu      !! distribution location
  real(wp)        , intent(in) :: sigma   !! distribution dispersion/scale (must be positive)
  real(wp)        , intent(in) :: xi      !! distribution shape parameter
  real(wp)                     :: x       !! sample position

! ==== Instructions

! ---- compute PPF

  ! compute inverse cdf based on xi
  if (abs(xi) .lt. 1.0e-12_wp) then
     ! if xi is approximately zero, use exponential distribution
     x = mu - sigma * log(1.0_wp - p)
  else
     ! if xi is not zero, use general formula
     x = mu + (sigma / xi) * ( (1.0_wp - p) ** (-xi) - 1.0_wp )
  endif

end function f_dst_gpd_ppf_core