f_dst_f_cdf_core Function

public elemental function f_dst_f_cdf_core(x, d1, d2, loc, scale, tail) result(p)

Cumulative 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

character(len=*), intent(in) :: tail

tail option

Return Value real(kind=wp)

output probability


Calls

proc~~f_dst_f_cdf_core~~CallsGraph proc~f_dst_f_cdf_core f_dst_f_cdf_core proc~f_dst_betai_core f_dst_betai_core proc~f_dst_f_cdf_core->proc~f_dst_betai_core

Called by

proc~~f_dst_f_cdf_core~~CalledByGraph proc~f_dst_f_cdf_core f_dst_f_cdf_core proc~f_dst_f_cdf f_dst_f_cdf proc~f_dst_f_cdf->proc~f_dst_f_cdf_core proc~f_dst_f_ppf_core f_dst_f_ppf_core proc~f_dst_f_ppf_core->proc~f_dst_f_cdf_core proc~s_tst_anova_1w_core s_tst_anova_1w_core proc~s_tst_anova_1w_core->proc~f_dst_f_cdf_core interface~fsml_f_cdf fsml_f_cdf interface~fsml_f_cdf->proc~f_dst_f_cdf proc~f_dst_f_ppf f_dst_f_ppf proc~f_dst_f_ppf->proc~f_dst_f_ppf_core proc~s_tst_anova_1w s_tst_anova_1w proc~s_tst_anova_1w->proc~s_tst_anova_1w_core interface~fsml_anova_1way fsml_anova_1way interface~fsml_anova_1way->proc~s_tst_anova_1w interface~fsml_f_ppf fsml_f_ppf interface~fsml_f_ppf->proc~f_dst_f_ppf

Source Code

elemental function f_dst_f_cdf_core(x, d1, d2, loc, scale, tail) result(p)

! ==== Description
!! Cumulative 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
  character(len=*), intent(in) :: tail    !! tail option
  real(wp)                     :: z       !! standardised variable
  real(wp)                     :: xbeta   !! beta variable
  real(wp)                     :: p       !! output probability

! ==== Instructions

! ----compute CDF

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

  ! z must be positive non-zero; return 0 if not
  if (z .le. 0.0_wp) then
    p = 0.0_wp
    return
  endif

  ! transform to beta domain
  xbeta = (d1 * z) / (d1 * z + d2)
  p = f_dst_betai_core(xbeta, 0.5_wp * d1, 0.5_wp * d2)

  ! tail options
  select case(tail)
    ! left-tailed; P(z<x)
     case("left")
        p = p
     ! right-tailed; P(z>x)
     case("right")
        p = 1.0_wp - p
     ! two-tailed
     case("two")
        if (z .lt. 1.0_wp) then
           p = 2.0_wp * p
        else
           p = 2.0_wp * (1.0_wp - p)
        endif
     ! confidence interval
     case("confidence")
        if (z .lt. 1.0_wp) then
           p = 1.0_wp - 2.0_wp * p
        else
           p = 1.0_wp - 2.0_wp * (1.0_wp - p)
        endif
  end select

end function f_dst_f_cdf_core