Percent point function/quantile function for generalised pareto distribution.
Type | Intent | Optional | 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) |
sample position
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