f_dst_f_pdf_core Function

public elemental function f_dst_f_pdf_core(x, d1, d2, loc, scale) result(fx)

Probability density function for the F distribution.

Arguments

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

sample position

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

numerator degrees of freedom

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

denominator degrees of freedom

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

location parameter

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

scale parameter

Return Value real(kind=wp)


Called by

proc~~f_dst_f_pdf_core~~CalledByGraph proc~f_dst_f_pdf_core f_dst_f_pdf_core proc~f_dst_f_pdf f_dst_f_pdf proc~f_dst_f_pdf->proc~f_dst_f_pdf_core interface~fsml_f_pdf fsml_f_pdf interface~fsml_f_pdf->proc~f_dst_f_pdf

Source Code

elemental function f_dst_f_pdf_core(x, d1, d2, loc, scale) result(fx)

! ==== Description
!! Probability density function for the F distribution.

! ==== Declarations
  real(wp), intent(in) :: x       !! sample position
  real(wp), intent(in) :: d1      !! numerator degrees of freedom
  real(wp), intent(in) :: d2      !! denominator degrees of freedom
  real(wp), intent(in) :: loc     !! location parameter
  real(wp), intent(in) :: scale   !! scale parameter
  real(wp)             :: B       !! beta(0.5*d1, 0.5*d2)
  real(wp)             :: z       !! standardised variable
  real(wp)             :: fx

! ==== Instructions

! ----compute PDF

  ! get z score (standardise)
  z = (x - loc) / scale

  ! calculate beta(0.5*d1, 0.5*d2) from gamma functions
  B = gamma(0.5_wp * d1) * gamma(0.5_wp * d2) / &
    & gamma(0.5_wp * d1 + 0.5_wp * d2)

  ! calculate probability/fx
  if (z .le. 0.0_wp) then
     fx = 0.0_wp
  else
     fx = sqrt(( (d1 * z) ** d1 * d2 ** d2 ) / &
       & ( (d1 * z + d2)**(d1 + d2) )) / z / (scale * B)
  endif

end function f_dst_f_pdf_core