Probability density function for generalised pareto distribution.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x |
sample position |
||
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) |
elemental function f_dst_gpd_pdf_core(x, xi, mu, sigma) result(fx) ! ==== Description !! Probability density function for generalised pareto distribution. ! ==== Declarations real(wp), intent(in) :: x !! sample position real(wp), intent(in) :: xi !! distribution shape parameter real(wp), intent(in) :: mu !! distribution location real(wp), intent(in) :: sigma !! distribution dispersion/scale (must be positive) real(wp) :: z !! z-score real(wp) :: fx ! ==== Instructions ! ---- compute PDF ! compute z-score z = (x - mu) / sigma ! calculate probability/fx if (xi .eq. 0.0_wp) then if (z .lt. 0.0_wp) then fx = 0.0_wp else fx = exp(-z) / sigma endif else if (z .lt. 0.0_wp .or. & & (xi .lt. 0.0_wp .and. z .gt. -1.0_wp / xi)) then fx = 0.0_wp else fx = (1.0_wp + xi * z) ** (-1.0_wp / xi - 1.0_wp) / sigma endif endif end function f_dst_gpd_pdf_core