Permalink
Browse files

Add improper constructor for gamma distribution

  • Loading branch information...
Shimuuar committed Mar 15, 2012
1 parent 049fdb0 commit c568cc33e16bfa858a05e85860d9ef63e55d9eb9
Showing with 10 additions and 1 deletion.
  1. +10 −1 Statistics/Distribution/Gamma.hs
@@ -19,6 +19,7 @@ module Statistics.Distribution.Gamma
GammaDistribution
-- * Constructors
, gammaDistr
+ , improperGammaDistr
-- * Accessors
, gdShape
, gdScale
@@ -44,10 +45,18 @@ gammaDistr :: Double -- ^ Shape parameter. /k/
gammaDistr k theta
| k <= 0 = error $ msg ++ "shape must be positive. Got " ++ show k
| theta <= 0 = error $ msg ++ "scale must be positive. Got " ++ show theta
- | otherwise = GD k theta
+ | otherwise = improperGammaDistr k theta
where msg = "Statistics.Distribution.Gamma.gammaDistr: "
{-# INLINE gammaDistr #-}
+-- | Create gamma distribution. This constructor do not check whether
+-- parameters are valid
+improperGammaDistr :: Double -- ^ Shape parameter. /k/
+ -> Double -- ^ Scale parameter, &#977;.
+ -> GammaDistribution
+improperGammaDistr = GD
+{-# INLINE improperGammaDistr #-}
+
instance D.Distribution GammaDistribution where
cumulative = cumulative

0 comments on commit c568cc3

Please sign in to comment.