Probability density function for the F distribution.
Type | Intent | Optional | 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 |
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