1. Bryan O'Sullivan
  2. statistics

Commits

Aleksey Khudyakov  committed d6f5ba3

Fix edge case for F distribution

Following should hold:
> cumulative d +Infinity = 1

  • Participants
  • Parent commits 954c62b
  • Branches default

Comments (0)

Files changed (1)

File Statistics/Distribution/FDistribution.hs

View file
   
 cumulative :: FDistribution -> Double -> Double
 cumulative (F n m _) x
-  | x > 0     = let y = n*x in incompleteBeta (0.5 * n) (0.5 * m) (y / (m + y))
-  | otherwise = 0
+  | x <= 0       = 0
+  | isInfinite x = 1            -- Only matches +∞
+  | x > 0        = let y = n*x in incompleteBeta (0.5 * n) (0.5 * m) (y / (m + y))
 
 density :: FDistribution -> Double -> Double
 density (F n m fac) x