Permalink
Browse files

Add case for sample which contain same elements

  • Loading branch information...
1 parent 5a86a7e commit 36f1d08e5ad0f4a1104f157ffdec0dcc01fbf4e4 @Shimuuar Shimuuar committed Sep 14, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 Statistics/Sample/KernelDensity.hs
@@ -34,6 +34,8 @@ import Statistics.Transform (dct, idct)
import qualified Data.Vector.Generic as G
import qualified Data.Vector.Unboxed as U
+
+
-- | Gaussian kernel density estimator for one-dimensional data, using
-- the method of Botev et al.
--
@@ -53,6 +55,7 @@ kde n0 xs = kde_ n0 (lo - range / 10) (hi + range / 10) xs
where
(lo,hi) = minMax xs
range | U.length xs <= 1 = 1 -- Unreasonable guess
+ | lo == hi = 1 -- All elements are equal
| otherwise = hi - lo
-- | Gaussian kernel density estimator for one-dimensional data, using

0 comments on commit 36f1d08

Please sign in to comment.