f_dst_gpd_pdf_core Function

public elemental function f_dst_gpd_pdf_core(x, xi, mu, sigma) result(fx)

Probability density function for generalised pareto distribution.

Arguments

Type IntentOptional 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)

Return Value real(kind=wp)


Called by

proc~~f_dst_gpd_pdf_core~~CalledByGraph proc~f_dst_gpd_pdf_core f_dst_gpd_pdf_core proc~f_dst_gpd_pdf f_dst_gpd_pdf proc~f_dst_gpd_pdf->proc~f_dst_gpd_pdf_core interface~fsml_gpd_pdf fsml_gpd_pdf interface~fsml_gpd_pdf->proc~f_dst_gpd_pdf

Source Code

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