f_dst_gamma_pdf_core Function

public elemental function f_dst_gamma_pdf_core(x, alpha, beta, loc) result(fx)

Probability density 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

Return Value real(kind=wp)


Called by

proc~~f_dst_gamma_pdf_core~~CalledByGraph proc~f_dst_gamma_pdf_core f_dst_gamma_pdf_core proc~f_dst_gamma_pdf f_dst_gamma_pdf proc~f_dst_gamma_pdf->proc~f_dst_gamma_pdf_core interface~fsml_gamma_pdf fsml_gamma_pdf interface~fsml_gamma_pdf->proc~f_dst_gamma_pdf

Source Code

elemental function f_dst_gamma_pdf_core(x, alpha, beta, loc) result(fx)

! ==== Description
!! Probability density 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
  real(wp)             :: z       !! shifted and scaled variable
  real(wp)             :: fx

! ==== Instructions

! ---- compute PDF

  ! calculate probability/fx
  if (x .le. 0.0_wp .or. alpha .le. 0.0_wp .or. beta .le. 0.0_wp) then
     fx = 0.0_wp
  else
     z = (x - loc) / beta
     fx = ( x ** (alpha - 1.0_wp) ) * exp( -z) / &
        & ( beta ** alpha * gamma(alpha))
  endif

end function f_dst_gamma_pdf_core