{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
module Statistics.Types
(
CL
, confidenceLevel
, significanceLevel
, mkCL
, mkCLE
, mkCLFromSignificance
, mkCLFromSignificanceE
, cl90
, cl95
, cl99
, nSigma
, nSigma1
, getNSigma
, getNSigma1
, PValue
, pValue
, mkPValue
, mkPValueE
, Estimate(..)
, NormalErr(..)
, ConfInt(..)
, UpperLimit(..)
, LowerLimit(..)
, estimateNormErr
, (±)
, estimateFromInterval
, estimateFromErr
, confidenceInterval
, asymErrors
, Scale(..)
, Sample
, WeightedSample
, Weights
) where
import Control.Monad ((<=<), liftM2, liftM3)
import Control.DeepSeq (NFData(..))
import Data.Aeson (FromJSON(..), ToJSON)
import Data.Binary (Binary(..))
import Data.Data (Data,Typeable)
import Data.Maybe (fromMaybe)
import Data.Vector.Unboxed (Unbox)
import Data.Vector.Unboxed.Deriving (derivingUnbox)
import GHC.Generics (Generic)
import Statistics.Internal
import Statistics.Types.Internal
import Statistics.Distribution
import Statistics.Distribution.Normal
newtype CL a = CL a
deriving (CL a -> CL a -> Bool
forall a. Eq a => CL a -> CL a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CL a -> CL a -> Bool
$c/= :: forall a. Eq a => CL a -> CL a -> Bool
== :: CL a -> CL a -> Bool
$c== :: forall a. Eq a => CL a -> CL a -> Bool
Eq, Typeable, CL a -> DataType
CL a -> Constr
forall {a}. Data a => Typeable (CL a)
forall a. Data a => CL a -> DataType
forall a. Data a => CL a -> Constr
forall a. Data a => (forall b. Data b => b -> b) -> CL a -> CL a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> CL a -> u
forall a u. Data a => (forall d. Data d => d -> u) -> CL a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CL a -> r
forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CL a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> CL a -> m (CL a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> CL a -> m (CL a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (CL a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CL a -> c (CL a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (CL a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (CL a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (CL a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CL a -> c (CL a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (CL a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CL a -> m (CL a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> CL a -> m (CL a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CL a -> m (CL a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> CL a -> m (CL a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CL a -> m (CL a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> CL a -> m (CL a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CL a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> CL a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> CL a -> [u]
$cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> CL a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CL a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CL a -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CL a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CL a -> r
gmapT :: (forall b. Data b => b -> b) -> CL a -> CL a
$cgmapT :: forall a. Data a => (forall b. Data b => b -> b) -> CL a -> CL a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (CL a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (CL a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (CL a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (CL a))
dataTypeOf :: CL a -> DataType
$cdataTypeOf :: forall a. Data a => CL a -> DataType
toConstr :: CL a -> Constr
$ctoConstr :: forall a. Data a => CL a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (CL a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (CL a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CL a -> c (CL a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CL a -> c (CL a)
Data, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (CL a) x -> CL a
forall a x. CL a -> Rep (CL a) x
$cto :: forall a x. Rep (CL a) x -> CL a
$cfrom :: forall a x. CL a -> Rep (CL a) x
Generic)
instance Show a => Show (CL a) where
showsPrec :: Int -> CL a -> ShowS
showsPrec Int
n (CL a
p) = forall a. Show a => String -> a -> Int -> ShowS
defaultShow1 String
"mkCLFromSignificance" a
p Int
n
instance (Num a, Ord a, Read a) => Read (CL a) where
readPrec :: ReadPrec (CL a)
readPrec = forall a r. Read a => String -> (a -> Maybe r) -> ReadPrec r
defaultReadPrecM1 String
"mkCLFromSignificance" forall a. (Ord a, Num a) => a -> Maybe (CL a)
mkCLFromSignificanceE
instance (Binary a, Num a, Ord a) => Binary (CL a) where
put :: CL a -> Put
put (CL a
p) = forall t. Binary t => t -> Put
put a
p
get :: Get (CL a)
get = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
errMkCL) forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Ord a, Num a) => a -> Maybe (CL a)
mkCLFromSignificanceE forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< forall t. Binary t => Get t
get
instance (ToJSON a) => ToJSON (CL a)
instance (FromJSON a, Num a, Ord a) => FromJSON (CL a) where
parseJSON :: Value -> Parser (CL a)
parseJSON = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
errMkCL) forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Ord a, Num a) => a -> Maybe (CL a)
mkCLFromSignificanceE forall (m :: * -> *) b c a.
Monad m =>
(b -> m c) -> (a -> m b) -> a -> m c
<=< forall a. FromJSON a => Value -> Parser a
parseJSON
instance NFData a => NFData (CL a) where
rnf :: CL a -> ()
rnf (CL a
a) = forall a. NFData a => a -> ()
rnf a
a
instance Ord a => Ord (CL a) where
CL a
a < :: CL a -> CL a -> Bool
< CL a
b = a
a forall a. Ord a => a -> a -> Bool
> a
b
CL a
a <= :: CL a -> CL a -> Bool
<= CL a
b = a
a forall a. Ord a => a -> a -> Bool
>= a
b
CL a
a > :: CL a -> CL a -> Bool
> CL a
b = a
a forall a. Ord a => a -> a -> Bool
< a
b
CL a
a >= :: CL a -> CL a -> Bool
>= CL a
b = a
a forall a. Ord a => a -> a -> Bool
<= a
b
max :: CL a -> CL a -> CL a
max (CL a
a) (CL a
b) = forall a. a -> CL a
CL (forall a. Ord a => a -> a -> a
min a
a a
b)
min :: CL a -> CL a -> CL a
min (CL a
a) (CL a
b) = forall a. a -> CL a
CL (forall a. Ord a => a -> a -> a
max a
a a
b)
mkCL :: (Ord a, Num a) => a -> CL a
mkCL :: forall a. (Ord a, Num a) => a -> CL a
mkCL
= forall a. a -> Maybe a -> a
fromMaybe (forall a. HasCallStack => String -> a
error String
"Statistics.Types.mkCL: probability is out if [0,1] range")
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Ord a, Num a) => a -> Maybe (CL a)
mkCLE
mkCLE :: (Ord a, Num a) => a -> Maybe (CL a)
mkCLE :: forall a. (Ord a, Num a) => a -> Maybe (CL a)
mkCLE a
p
| a
p forall a. Ord a => a -> a -> Bool
>= a
0 Bool -> Bool -> Bool
&& a
p forall a. Ord a => a -> a -> Bool
<= a
1 = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall a. a -> CL a
CL (a
1 forall a. Num a => a -> a -> a
- a
p)
| Bool
otherwise = forall a. Maybe a
Nothing
mkCLFromSignificance :: (Ord a, Num a) => a -> CL a
mkCLFromSignificance :: forall a. (Ord a, Num a) => a -> CL a
mkCLFromSignificance = forall a. a -> Maybe a -> a
fromMaybe (forall a. HasCallStack => String -> a
error String
errMkCL) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Ord a, Num a) => a -> Maybe (CL a)
mkCLFromSignificanceE
mkCLFromSignificanceE :: (Ord a, Num a) => a -> Maybe (CL a)
mkCLFromSignificanceE :: forall a. (Ord a, Num a) => a -> Maybe (CL a)
mkCLFromSignificanceE a
p
| a
p forall a. Ord a => a -> a -> Bool
>= a
0 Bool -> Bool -> Bool
&& a
p forall a. Ord a => a -> a -> Bool
<= a
1 = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall a. a -> CL a
CL a
p
| Bool
otherwise = forall a. Maybe a
Nothing
errMkCL :: String
errMkCL :: String
errMkCL = String
"Statistics.Types.mkPValCL: probability is out if [0,1] range"
confidenceLevel :: (Num a) => CL a -> a
confidenceLevel :: forall a. Num a => CL a -> a
confidenceLevel (CL a
p) = a
1 forall a. Num a => a -> a -> a
- a
p
significanceLevel :: CL a -> a
significanceLevel :: forall a. CL a -> a
significanceLevel (CL a
p) = a
p
cl90 :: Fractional a => CL a
cl90 :: forall a. Fractional a => CL a
cl90 = forall a. a -> CL a
CL a
0.10
cl95 :: Fractional a => CL a
cl95 :: forall a. Fractional a => CL a
cl95 = forall a. a -> CL a
CL a
0.05
cl99 :: Fractional a => CL a
cl99 :: forall a. Fractional a => CL a
cl99 = forall a. a -> CL a
CL a
0.01
newtype PValue a = PValue a
deriving (PValue a -> PValue a -> Bool
forall a. Eq a => PValue a -> PValue a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PValue a -> PValue a -> Bool
$c/= :: forall a. Eq a => PValue a -> PValue a -> Bool
== :: PValue a -> PValue a -> Bool
$c== :: forall a. Eq a => PValue a -> PValue a -> Bool
Eq,PValue a -> PValue a -> Bool
PValue a -> PValue a -> Ordering
PValue a -> PValue a -> PValue a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (PValue a)
forall a. Ord a => PValue a -> PValue a -> Bool
forall a. Ord a => PValue a -> PValue a -> Ordering
forall a. Ord a => PValue a -> PValue a -> PValue a
min :: PValue a -> PValue a -> PValue a
$cmin :: forall a. Ord a => PValue a -> PValue a -> PValue a
max :: PValue a -> PValue a -> PValue a
$cmax :: forall a. Ord a => PValue a -> PValue a -> PValue a
>= :: PValue a -> PValue a -> Bool
$c>= :: forall a. Ord a => PValue a -> PValue a -> Bool
> :: PValue a -> PValue a -> Bool
$c> :: forall a. Ord a => PValue a -> PValue a -> Bool
<= :: PValue a -> PValue a -> Bool
$c<= :: forall a. Ord a => PValue a -> PValue a -> Bool
< :: PValue a -> PValue a -> Bool
$c< :: forall a. Ord a => PValue a -> PValue a -> Bool
compare :: PValue a -> PValue a -> Ordering
$ccompare :: forall a. Ord a => PValue a -> PValue a -> Ordering
Ord, Typeable, PValue a -> DataType
PValue a -> Constr
forall {a}. Data a => Typeable (PValue a)
forall a. Data a => PValue a -> DataType
forall a. Data a => PValue a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> PValue a -> PValue a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> PValue a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> PValue a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PValue a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PValue a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> PValue a -> m (PValue a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> PValue a -> m (PValue a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (PValue a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PValue a -> c (PValue a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (PValue a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PValue a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (PValue a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PValue a -> c (PValue a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (PValue a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PValue a -> m (PValue a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> PValue a -> m (PValue a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PValue a -> m (PValue a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> PValue a -> m (PValue a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PValue a -> m (PValue a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> PValue a -> m (PValue a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PValue a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> PValue a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> PValue a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> PValue a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PValue a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PValue a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PValue a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PValue a -> r
gmapT :: (forall b. Data b => b -> b) -> PValue a -> PValue a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> PValue a -> PValue a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PValue a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PValue a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (PValue a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (PValue a))
dataTypeOf :: PValue a -> DataType
$cdataTypeOf :: forall a. Data a => PValue a -> DataType
toConstr :: PValue a -> Constr
$ctoConstr :: forall a. Data a => PValue a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (PValue a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (PValue a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PValue a -> c (PValue a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PValue a -> c (PValue a)
Data, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (PValue a) x -> PValue a
forall a x. PValue a -> Rep (PValue a) x
$cto :: forall a x. Rep (PValue a) x -> PValue a
$cfrom :: forall a x. PValue a -> Rep (PValue a) x
Generic)
instance Show a => Show (PValue a) where
showsPrec :: Int -> PValue a -> ShowS
showsPrec Int
n (PValue a
p) = forall a. Show a => String -> a -> Int -> ShowS
defaultShow1 String
"mkPValue" a
p Int
n
instance (Num a, Ord a, Read a) => Read (PValue a) where
readPrec :: ReadPrec (PValue a)
readPrec = forall a r. Read a => String -> (a -> Maybe r) -> ReadPrec r
defaultReadPrecM1 String
"mkPValue" forall a. (Ord a, Num a) => a -> Maybe (PValue a)
mkPValueE
instance (Binary a, Num a, Ord a) => Binary (PValue a) where
put :: PValue a -> Put
put (PValue a
p) = forall t. Binary t => t -> Put
put a
p
get :: Get (PValue a)
get = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
errMkPValue) forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Ord a, Num a) => a -> Maybe (PValue a)
mkPValueE forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< forall t. Binary t => Get t
get
instance (ToJSON a) => ToJSON (PValue a)
instance (FromJSON a, Num a, Ord a) => FromJSON (PValue a) where
parseJSON :: Value -> Parser (PValue a)
parseJSON = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
errMkPValue) forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Ord a, Num a) => a -> Maybe (PValue a)
mkPValueE forall (m :: * -> *) b c a.
Monad m =>
(b -> m c) -> (a -> m b) -> a -> m c
<=< forall a. FromJSON a => Value -> Parser a
parseJSON
instance NFData a => NFData (PValue a) where
rnf :: PValue a -> ()
rnf (PValue a
a) = forall a. NFData a => a -> ()
rnf a
a
mkPValue :: (Ord a, Num a) => a -> PValue a
mkPValue :: forall a. (Ord a, Num a) => a -> PValue a
mkPValue = forall a. a -> Maybe a -> a
fromMaybe (forall a. HasCallStack => String -> a
error String
errMkPValue) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Ord a, Num a) => a -> Maybe (PValue a)
mkPValueE
mkPValueE :: (Ord a, Num a) => a -> Maybe (PValue a)
mkPValueE :: forall a. (Ord a, Num a) => a -> Maybe (PValue a)
mkPValueE a
p
| a
p forall a. Ord a => a -> a -> Bool
>= a
0 Bool -> Bool -> Bool
&& a
p forall a. Ord a => a -> a -> Bool
<= a
1 = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall a. a -> PValue a
PValue a
p
| Bool
otherwise = forall a. Maybe a
Nothing
pValue :: PValue a -> a
pValue :: forall a. PValue a -> a
pValue (PValue a
p) = a
p
nSigma :: Double -> PValue Double
nSigma :: Double -> PValue Double
nSigma Double
n
| Double
n forall a. Ord a => a -> a -> Bool
> Double
0 = forall a. a -> PValue a
PValue forall a b. (a -> b) -> a -> b
$ Double
2 forall a. Num a => a -> a -> a
* forall d. Distribution d => d -> Double -> Double
cumulative NormalDistribution
standard (-Double
n)
| Bool
otherwise = forall a. HasCallStack => String -> a
error String
"Statistics.Extra.Error.nSigma: non-positive number of sigma"
nSigma1 :: Double -> PValue Double
nSigma1 :: Double -> PValue Double
nSigma1 Double
n
| Double
n forall a. Ord a => a -> a -> Bool
> Double
0 = forall a. a -> PValue a
PValue forall a b. (a -> b) -> a -> b
$ forall d. Distribution d => d -> Double -> Double
cumulative NormalDistribution
standard (-Double
n)
| Bool
otherwise = forall a. HasCallStack => String -> a
error String
"Statistics.Extra.Error.nSigma1: non-positive number of sigma"
getNSigma :: PValue Double -> Double
getNSigma :: PValue Double -> Double
getNSigma (PValue Double
p) = forall a. Num a => a -> a
negate forall a b. (a -> b) -> a -> b
$ forall d. ContDistr d => d -> Double -> Double
quantile NormalDistribution
standard (Double
p forall a. Fractional a => a -> a -> a
/ Double
2)
getNSigma1 :: PValue Double -> Double
getNSigma1 :: PValue Double -> Double
getNSigma1 (PValue Double
p) = forall a. Num a => a -> a
negate forall a b. (a -> b) -> a -> b
$ forall d. ContDistr d => d -> Double -> Double
quantile NormalDistribution
standard Double
p
errMkPValue :: String
errMkPValue :: String
errMkPValue = String
"Statistics.Types.mkPValue: probability is out if [0,1] range"
data Estimate e a = Estimate
{ forall (e :: * -> *) a. Estimate e a -> a
estPoint :: !a
, forall (e :: * -> *) a. Estimate e a -> e a
estError :: !(e a)
} deriving (Estimate e a -> Estimate e a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (e :: * -> *) a.
(Eq a, Eq (e a)) =>
Estimate e a -> Estimate e a -> Bool
/= :: Estimate e a -> Estimate e a -> Bool
$c/= :: forall (e :: * -> *) a.
(Eq a, Eq (e a)) =>
Estimate e a -> Estimate e a -> Bool
== :: Estimate e a -> Estimate e a -> Bool
$c== :: forall (e :: * -> *) a.
(Eq a, Eq (e a)) =>
Estimate e a -> Estimate e a -> Bool
Eq, ReadPrec [Estimate e a]
ReadPrec (Estimate e a)
ReadS [Estimate e a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall (e :: * -> *) a.
(Read a, Read (e a)) =>
ReadPrec [Estimate e a]
forall (e :: * -> *) a.
(Read a, Read (e a)) =>
ReadPrec (Estimate e a)
forall (e :: * -> *) a.
(Read a, Read (e a)) =>
Int -> ReadS (Estimate e a)
forall (e :: * -> *) a.
(Read a, Read (e a)) =>
ReadS [Estimate e a]
readListPrec :: ReadPrec [Estimate e a]
$creadListPrec :: forall (e :: * -> *) a.
(Read a, Read (e a)) =>
ReadPrec [Estimate e a]
readPrec :: ReadPrec (Estimate e a)
$creadPrec :: forall (e :: * -> *) a.
(Read a, Read (e a)) =>
ReadPrec (Estimate e a)
readList :: ReadS [Estimate e a]
$creadList :: forall (e :: * -> *) a.
(Read a, Read (e a)) =>
ReadS [Estimate e a]
readsPrec :: Int -> ReadS (Estimate e a)
$creadsPrec :: forall (e :: * -> *) a.
(Read a, Read (e a)) =>
Int -> ReadS (Estimate e a)
Read, Int -> Estimate e a -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (e :: * -> *) a.
(Show a, Show (e a)) =>
Int -> Estimate e a -> ShowS
forall (e :: * -> *) a.
(Show a, Show (e a)) =>
[Estimate e a] -> ShowS
forall (e :: * -> *) a.
(Show a, Show (e a)) =>
Estimate e a -> String
showList :: [Estimate e a] -> ShowS
$cshowList :: forall (e :: * -> *) a.
(Show a, Show (e a)) =>
[Estimate e a] -> ShowS
show :: Estimate e a -> String
$cshow :: forall (e :: * -> *) a.
(Show a, Show (e a)) =>
Estimate e a -> String
showsPrec :: Int -> Estimate e a -> ShowS
$cshowsPrec :: forall (e :: * -> *) a.
(Show a, Show (e a)) =>
Int -> Estimate e a -> ShowS
Show, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (e :: * -> *) a x. Rep (Estimate e a) x -> Estimate e a
forall (e :: * -> *) a x. Estimate e a -> Rep (Estimate e a) x
$cto :: forall (e :: * -> *) a x. Rep (Estimate e a) x -> Estimate e a
$cfrom :: forall (e :: * -> *) a x. Estimate e a -> Rep (Estimate e a) x
Generic
, Typeable, Estimate e a -> DataType
Estimate e a -> Constr
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Estimate e a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Estimate e a -> c (Estimate e a)
forall {e :: * -> *} {a}.
(Typeable e, Data a, Data (e a)) =>
Typeable (Estimate e a)
forall (e :: * -> *) a.
(Typeable e, Data a, Data (e a)) =>
Estimate e a -> DataType
forall (e :: * -> *) a.
(Typeable e, Data a, Data (e a)) =>
Estimate e a -> Constr
forall (e :: * -> *) a.
(Typeable e, Data a, Data (e a)) =>
(forall b. Data b => b -> b) -> Estimate e a -> Estimate e a
forall (e :: * -> *) a u.
(Typeable e, Data a, Data (e a)) =>
Int -> (forall d. Data d => d -> u) -> Estimate e a -> u
forall (e :: * -> *) a u.
(Typeable e, Data a, Data (e a)) =>
(forall d. Data d => d -> u) -> Estimate e a -> [u]
forall (e :: * -> *) a r r'.
(Typeable e, Data a, Data (e a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Estimate e a -> r
forall (e :: * -> *) a r r'.
(Typeable e, Data a, Data (e a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Estimate e a -> r
forall (e :: * -> *) a (m :: * -> *).
(Typeable e, Data a, Data (e a), Monad m) =>
(forall d. Data d => d -> m d) -> Estimate e a -> m (Estimate e a)
forall (e :: * -> *) a (m :: * -> *).
(Typeable e, Data a, Data (e a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Estimate e a -> m (Estimate e a)
forall (e :: * -> *) a (c :: * -> *).
(Typeable e, Data a, Data (e a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Estimate e a)
forall (e :: * -> *) a (c :: * -> *).
(Typeable e, Data a, Data (e a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Estimate e a -> c (Estimate e a)
forall (e :: * -> *) a (t :: * -> *) (c :: * -> *).
(Typeable e, Data a, Data (e a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Estimate e a))
forall (e :: * -> *) a (t :: * -> * -> *) (c :: * -> *).
(Typeable e, Data a, Data (e a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Estimate e a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Estimate e a -> m (Estimate e a)
$cgmapMo :: forall (e :: * -> *) a (m :: * -> *).
(Typeable e, Data a, Data (e a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Estimate e a -> m (Estimate e a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Estimate e a -> m (Estimate e a)
$cgmapMp :: forall (e :: * -> *) a (m :: * -> *).
(Typeable e, Data a, Data (e a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Estimate e a -> m (Estimate e a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Estimate e a -> m (Estimate e a)
$cgmapM :: forall (e :: * -> *) a (m :: * -> *).
(Typeable e, Data a, Data (e a), Monad m) =>
(forall d. Data d => d -> m d) -> Estimate e a -> m (Estimate e a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Estimate e a -> u
$cgmapQi :: forall (e :: * -> *) a u.
(Typeable e, Data a, Data (e a)) =>
Int -> (forall d. Data d => d -> u) -> Estimate e a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Estimate e a -> [u]
$cgmapQ :: forall (e :: * -> *) a u.
(Typeable e, Data a, Data (e a)) =>
(forall d. Data d => d -> u) -> Estimate e a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Estimate e a -> r
$cgmapQr :: forall (e :: * -> *) a r r'.
(Typeable e, Data a, Data (e a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Estimate e a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Estimate e a -> r
$cgmapQl :: forall (e :: * -> *) a r r'.
(Typeable e, Data a, Data (e a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Estimate e a -> r
gmapT :: (forall b. Data b => b -> b) -> Estimate e a -> Estimate e a
$cgmapT :: forall (e :: * -> *) a.
(Typeable e, Data a, Data (e a)) =>
(forall b. Data b => b -> b) -> Estimate e a -> Estimate e a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Estimate e a))
$cdataCast2 :: forall (e :: * -> *) a (t :: * -> * -> *) (c :: * -> *).
(Typeable e, Data a, Data (e a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Estimate e a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Estimate e a))
$cdataCast1 :: forall (e :: * -> *) a (t :: * -> *) (c :: * -> *).
(Typeable e, Data a, Data (e a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Estimate e a))
dataTypeOf :: Estimate e a -> DataType
$cdataTypeOf :: forall (e :: * -> *) a.
(Typeable e, Data a, Data (e a)) =>
Estimate e a -> DataType
toConstr :: Estimate e a -> Constr
$ctoConstr :: forall (e :: * -> *) a.
(Typeable e, Data a, Data (e a)) =>
Estimate e a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Estimate e a)
$cgunfold :: forall (e :: * -> *) a (c :: * -> *).
(Typeable e, Data a, Data (e a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Estimate e a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Estimate e a -> c (Estimate e a)
$cgfoldl :: forall (e :: * -> *) a (c :: * -> *).
(Typeable e, Data a, Data (e a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Estimate e a -> c (Estimate e a)
Data
)
instance (Binary (e a), Binary a) => Binary (Estimate e a) where
get :: Get (Estimate e a)
get = forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 forall (e :: * -> *) a. a -> e a -> Estimate e a
Estimate forall t. Binary t => Get t
get forall t. Binary t => Get t
get
put :: Estimate e a -> Put
put (Estimate a
ep e a
ee) = forall t. Binary t => t -> Put
put a
ep forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put e a
ee
instance (FromJSON (e a), FromJSON a) => FromJSON (Estimate e a)
instance (ToJSON (e a), ToJSON a) => ToJSON (Estimate e a)
instance (NFData (e a), NFData a) => NFData (Estimate e a) where
rnf :: Estimate e a -> ()
rnf (Estimate a
x e a
dx) = forall a. NFData a => a -> ()
rnf a
x seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf e a
dx
newtype NormalErr a = NormalErr
{ forall a. NormalErr a -> a
normalError :: a
}
deriving (NormalErr a -> NormalErr a -> Bool
forall a. Eq a => NormalErr a -> NormalErr a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NormalErr a -> NormalErr a -> Bool
$c/= :: forall a. Eq a => NormalErr a -> NormalErr a -> Bool
== :: NormalErr a -> NormalErr a -> Bool
$c== :: forall a. Eq a => NormalErr a -> NormalErr a -> Bool
Eq, ReadPrec [NormalErr a]
ReadPrec (NormalErr a)
ReadS [NormalErr a]
forall a. Read a => ReadPrec [NormalErr a]
forall a. Read a => ReadPrec (NormalErr a)
forall a. Read a => Int -> ReadS (NormalErr a)
forall a. Read a => ReadS [NormalErr a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NormalErr a]
$creadListPrec :: forall a. Read a => ReadPrec [NormalErr a]
readPrec :: ReadPrec (NormalErr a)
$creadPrec :: forall a. Read a => ReadPrec (NormalErr a)
readList :: ReadS [NormalErr a]
$creadList :: forall a. Read a => ReadS [NormalErr a]
readsPrec :: Int -> ReadS (NormalErr a)
$creadsPrec :: forall a. Read a => Int -> ReadS (NormalErr a)
Read, Int -> NormalErr a -> ShowS
forall a. Show a => Int -> NormalErr a -> ShowS
forall a. Show a => [NormalErr a] -> ShowS
forall a. Show a => NormalErr a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NormalErr a] -> ShowS
$cshowList :: forall a. Show a => [NormalErr a] -> ShowS
show :: NormalErr a -> String
$cshow :: forall a. Show a => NormalErr a -> String
showsPrec :: Int -> NormalErr a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> NormalErr a -> ShowS
Show, Typeable, NormalErr a -> DataType
NormalErr a -> Constr
forall {a}. Data a => Typeable (NormalErr a)
forall a. Data a => NormalErr a -> DataType
forall a. Data a => NormalErr a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> NormalErr a -> NormalErr a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> NormalErr a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> NormalErr a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NormalErr a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NormalErr a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> NormalErr a -> m (NormalErr a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NormalErr a -> m (NormalErr a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NormalErr a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NormalErr a -> c (NormalErr a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (NormalErr a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NormalErr a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NormalErr a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NormalErr a -> c (NormalErr a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (NormalErr a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NormalErr a -> m (NormalErr a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NormalErr a -> m (NormalErr a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NormalErr a -> m (NormalErr a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NormalErr a -> m (NormalErr a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NormalErr a -> m (NormalErr a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> NormalErr a -> m (NormalErr a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NormalErr a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> NormalErr a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> NormalErr a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> NormalErr a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NormalErr a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NormalErr a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NormalErr a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NormalErr a -> r
gmapT :: (forall b. Data b => b -> b) -> NormalErr a -> NormalErr a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> NormalErr a -> NormalErr a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NormalErr a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NormalErr a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (NormalErr a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (NormalErr a))
dataTypeOf :: NormalErr a -> DataType
$cdataTypeOf :: forall a. Data a => NormalErr a -> DataType
toConstr :: NormalErr a -> Constr
$ctoConstr :: forall a. Data a => NormalErr a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NormalErr a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NormalErr a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NormalErr a -> c (NormalErr a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NormalErr a -> c (NormalErr a)
Data, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (NormalErr a) x -> NormalErr a
forall a x. NormalErr a -> Rep (NormalErr a) x
$cto :: forall a x. Rep (NormalErr a) x -> NormalErr a
$cfrom :: forall a x. NormalErr a -> Rep (NormalErr a) x
Generic)
instance Binary a => Binary (NormalErr a) where
get :: Get (NormalErr a)
get = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. a -> NormalErr a
NormalErr forall t. Binary t => Get t
get
put :: NormalErr a -> Put
put = forall t. Binary t => t -> Put
put forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. NormalErr a -> a
normalError
instance FromJSON a => FromJSON (NormalErr a)
instance ToJSON a => ToJSON (NormalErr a)
instance NFData a => NFData (NormalErr a) where
rnf :: NormalErr a -> ()
rnf (NormalErr a
x) = forall a. NFData a => a -> ()
rnf a
x
data ConfInt a = ConfInt
{ forall a. ConfInt a -> a
confIntLDX :: !a
, forall a. ConfInt a -> a
confIntUDX :: !a
, forall a. ConfInt a -> CL Double
confIntCL :: !(CL Double)
}
deriving (ReadPrec [ConfInt a]
ReadPrec (ConfInt a)
ReadS [ConfInt a]
forall a. Read a => ReadPrec [ConfInt a]
forall a. Read a => ReadPrec (ConfInt a)
forall a. Read a => Int -> ReadS (ConfInt a)
forall a. Read a => ReadS [ConfInt a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfInt a]
$creadListPrec :: forall a. Read a => ReadPrec [ConfInt a]
readPrec :: ReadPrec (ConfInt a)
$creadPrec :: forall a. Read a => ReadPrec (ConfInt a)
readList :: ReadS [ConfInt a]
$creadList :: forall a. Read a => ReadS [ConfInt a]
readsPrec :: Int -> ReadS (ConfInt a)
$creadsPrec :: forall a. Read a => Int -> ReadS (ConfInt a)
Read,Int -> ConfInt a -> ShowS
forall a. Show a => Int -> ConfInt a -> ShowS
forall a. Show a => [ConfInt a] -> ShowS
forall a. Show a => ConfInt a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfInt a] -> ShowS
$cshowList :: forall a. Show a => [ConfInt a] -> ShowS
show :: ConfInt a -> String
$cshow :: forall a. Show a => ConfInt a -> String
showsPrec :: Int -> ConfInt a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> ConfInt a -> ShowS
Show,ConfInt a -> ConfInt a -> Bool
forall a. Eq a => ConfInt a -> ConfInt a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfInt a -> ConfInt a -> Bool
$c/= :: forall a. Eq a => ConfInt a -> ConfInt a -> Bool
== :: ConfInt a -> ConfInt a -> Bool
$c== :: forall a. Eq a => ConfInt a -> ConfInt a -> Bool
Eq,Typeable,ConfInt a -> DataType
ConfInt a -> Constr
forall {a}. Data a => Typeable (ConfInt a)
forall a. Data a => ConfInt a -> DataType
forall a. Data a => ConfInt a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> ConfInt a -> ConfInt a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> ConfInt a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> ConfInt a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConfInt a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConfInt a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> ConfInt a -> m (ConfInt a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> ConfInt a -> m (ConfInt a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ConfInt a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConfInt a -> c (ConfInt a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ConfInt a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ConfInt a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ConfInt a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConfInt a -> c (ConfInt a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ConfInt a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConfInt a -> m (ConfInt a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> ConfInt a -> m (ConfInt a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConfInt a -> m (ConfInt a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> ConfInt a -> m (ConfInt a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConfInt a -> m (ConfInt a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> ConfInt a -> m (ConfInt a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ConfInt a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> ConfInt a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> ConfInt a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> ConfInt a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConfInt a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConfInt a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConfInt a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConfInt a -> r
gmapT :: (forall b. Data b => b -> b) -> ConfInt a -> ConfInt a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> ConfInt a -> ConfInt a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ConfInt a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ConfInt a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ConfInt a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ConfInt a))
dataTypeOf :: ConfInt a -> DataType
$cdataTypeOf :: forall a. Data a => ConfInt a -> DataType
toConstr :: ConfInt a -> Constr
$ctoConstr :: forall a. Data a => ConfInt a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ConfInt a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ConfInt a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConfInt a -> c (ConfInt a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConfInt a -> c (ConfInt a)
Data,forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (ConfInt a) x -> ConfInt a
forall a x. ConfInt a -> Rep (ConfInt a) x
$cto :: forall a x. Rep (ConfInt a) x -> ConfInt a
$cfrom :: forall a x. ConfInt a -> Rep (ConfInt a) x
Generic)
instance Binary a => Binary (ConfInt a) where
get :: Get (ConfInt a)
get = forall (m :: * -> *) a1 a2 a3 r.
Monad m =>
(a1 -> a2 -> a3 -> r) -> m a1 -> m a2 -> m a3 -> m r
liftM3 forall a. a -> a -> CL Double -> ConfInt a
ConfInt forall t. Binary t => Get t
get forall t. Binary t => Get t
get forall t. Binary t => Get t
get
put :: ConfInt a -> Put
put (ConfInt a
l a
u CL Double
cl) = forall t. Binary t => t -> Put
put a
l forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put a
u forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put CL Double
cl
instance FromJSON a => FromJSON (ConfInt a)
instance ToJSON a => ToJSON (ConfInt a)
instance NFData a => NFData (ConfInt a) where
rnf :: ConfInt a -> ()
rnf (ConfInt a
x a
y CL Double
_) = forall a. NFData a => a -> ()
rnf a
x seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf a
y
estimateNormErr :: a
-> a
-> Estimate NormalErr a
estimateNormErr :: forall a. a -> a -> Estimate NormalErr a
estimateNormErr a
x a
dx = forall (e :: * -> *) a. a -> e a -> Estimate e a
Estimate a
x (forall a. a -> NormalErr a
NormalErr a
dx)
(±) :: a
-> a
-> Estimate NormalErr a
± :: forall a. a -> a -> Estimate NormalErr a
(±) = forall a. a -> a -> Estimate NormalErr a
estimateNormErr
estimateFromErr
:: a
-> (a,a)
-> CL Double
-> Estimate ConfInt a
estimateFromErr :: forall a. a -> (a, a) -> CL Double -> Estimate ConfInt a
estimateFromErr a
x (a
ldx,a
udx) CL Double
cl = forall (e :: * -> *) a. a -> e a -> Estimate e a
Estimate a
x (forall a. a -> a -> CL Double -> ConfInt a
ConfInt a
ldx a
udx CL Double
cl)
estimateFromInterval
:: Num a
=> a
-> (a,a)
-> CL Double
-> Estimate ConfInt a
estimateFromInterval :: forall a. Num a => a -> (a, a) -> CL Double -> Estimate ConfInt a
estimateFromInterval a
x (a
lx,a
ux) CL Double
cl
= forall (e :: * -> *) a. a -> e a -> Estimate e a
Estimate a
x (forall a. a -> a -> CL Double -> ConfInt a
ConfInt (a
xforall a. Num a => a -> a -> a
-a
lx) (a
uxforall a. Num a => a -> a -> a
-a
x) CL Double
cl)
confidenceInterval :: Num a => Estimate ConfInt a -> (a,a)
confidenceInterval :: forall a. Num a => Estimate ConfInt a -> (a, a)
confidenceInterval (Estimate a
x (ConfInt a
ldx a
udx CL Double
_))
= (a
x forall a. Num a => a -> a -> a
- a
ldx, a
x forall a. Num a => a -> a -> a
+ a
udx)
asymErrors :: Estimate ConfInt a -> (a,a)
asymErrors :: forall a. Estimate ConfInt a -> (a, a)
asymErrors (Estimate a
_ (ConfInt a
ldx a
udx CL Double
_)) = (a
ldx,a
udx)
class Scale e where
scale :: (Ord a, Num a) => a -> e a -> e a
instance Scale NormalErr where
scale :: forall a. (Ord a, Num a) => a -> NormalErr a -> NormalErr a
scale a
a (NormalErr a
e) = forall a. a -> NormalErr a
NormalErr (forall a. Num a => a -> a
abs a
a forall a. Num a => a -> a -> a
* a
e)
instance Scale ConfInt where
scale :: forall a. (Ord a, Num a) => a -> ConfInt a -> ConfInt a
scale a
a (ConfInt a
l a
u CL Double
cl) | a
a forall a. Ord a => a -> a -> Bool
>= a
0 = forall a. a -> a -> CL Double -> ConfInt a
ConfInt (a
aforall a. Num a => a -> a -> a
*a
l) (a
aforall a. Num a => a -> a -> a
*a
u) CL Double
cl
| Bool
otherwise = forall a. a -> a -> CL Double -> ConfInt a
ConfInt (-a
aforall a. Num a => a -> a -> a
*a
u) (-a
aforall a. Num a => a -> a -> a
*a
l) CL Double
cl
instance Scale e => Scale (Estimate e) where
scale :: forall a. (Ord a, Num a) => a -> Estimate e a -> Estimate e a
scale a
a (Estimate a
x e a
dx) = forall (e :: * -> *) a. a -> e a -> Estimate e a
Estimate (a
aforall a. Num a => a -> a -> a
*a
x) (forall (e :: * -> *) a. (Scale e, Ord a, Num a) => a -> e a -> e a
scale a
a e a
dx)
data UpperLimit a = UpperLimit
{ forall a. UpperLimit a -> a
upperLimit :: !a
, forall a. UpperLimit a -> CL Double
ulConfidenceLevel :: !(CL Double)
} deriving (UpperLimit a -> UpperLimit a -> Bool
forall a. Eq a => UpperLimit a -> UpperLimit a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpperLimit a -> UpperLimit a -> Bool
$c/= :: forall a. Eq a => UpperLimit a -> UpperLimit a -> Bool
== :: UpperLimit a -> UpperLimit a -> Bool
$c== :: forall a. Eq a => UpperLimit a -> UpperLimit a -> Bool
Eq, ReadPrec [UpperLimit a]
ReadPrec (UpperLimit a)
ReadS [UpperLimit a]
forall a. Read a => ReadPrec [UpperLimit a]
forall a. Read a => ReadPrec (UpperLimit a)
forall a. Read a => Int -> ReadS (UpperLimit a)
forall a. Read a => ReadS [UpperLimit a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpperLimit a]
$creadListPrec :: forall a. Read a => ReadPrec [UpperLimit a]
readPrec :: ReadPrec (UpperLimit a)
$creadPrec :: forall a. Read a => ReadPrec (UpperLimit a)
readList :: ReadS [UpperLimit a]
$creadList :: forall a. Read a => ReadS [UpperLimit a]
readsPrec :: Int -> ReadS (UpperLimit a)
$creadsPrec :: forall a. Read a => Int -> ReadS (UpperLimit a)
Read, Int -> UpperLimit a -> ShowS
forall a. Show a => Int -> UpperLimit a -> ShowS
forall a. Show a => [UpperLimit a] -> ShowS
forall a. Show a => UpperLimit a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpperLimit a] -> ShowS
$cshowList :: forall a. Show a => [UpperLimit a] -> ShowS
show :: UpperLimit a -> String
$cshow :: forall a. Show a => UpperLimit a -> String
showsPrec :: Int -> UpperLimit a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> UpperLimit a -> ShowS
Show, Typeable, UpperLimit a -> DataType
UpperLimit a -> Constr
forall {a}. Data a => Typeable (UpperLimit a)
forall a. Data a => UpperLimit a -> DataType
forall a. Data a => UpperLimit a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> UpperLimit a -> UpperLimit a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> UpperLimit a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> UpperLimit a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpperLimit a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpperLimit a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> UpperLimit a -> m (UpperLimit a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> UpperLimit a -> m (UpperLimit a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (UpperLimit a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpperLimit a -> c (UpperLimit a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (UpperLimit a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (UpperLimit a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (UpperLimit a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpperLimit a -> c (UpperLimit a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (UpperLimit a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UpperLimit a -> m (UpperLimit a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> UpperLimit a -> m (UpperLimit a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UpperLimit a -> m (UpperLimit a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> UpperLimit a -> m (UpperLimit a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UpperLimit a -> m (UpperLimit a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> UpperLimit a -> m (UpperLimit a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UpperLimit a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> UpperLimit a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> UpperLimit a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> UpperLimit a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpperLimit a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpperLimit a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpperLimit a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpperLimit a -> r
gmapT :: (forall b. Data b => b -> b) -> UpperLimit a -> UpperLimit a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> UpperLimit a -> UpperLimit a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (UpperLimit a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (UpperLimit a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (UpperLimit a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (UpperLimit a))
dataTypeOf :: UpperLimit a -> DataType
$cdataTypeOf :: forall a. Data a => UpperLimit a -> DataType
toConstr :: UpperLimit a -> Constr
$ctoConstr :: forall a. Data a => UpperLimit a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (UpperLimit a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (UpperLimit a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpperLimit a -> c (UpperLimit a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpperLimit a -> c (UpperLimit a)
Data, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (UpperLimit a) x -> UpperLimit a
forall a x. UpperLimit a -> Rep (UpperLimit a) x
$cto :: forall a x. Rep (UpperLimit a) x -> UpperLimit a
$cfrom :: forall a x. UpperLimit a -> Rep (UpperLimit a) x
Generic)
instance Binary a => Binary (UpperLimit a) where
get :: Get (UpperLimit a)
get = forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 forall a. a -> CL Double -> UpperLimit a
UpperLimit forall t. Binary t => Get t
get forall t. Binary t => Get t
get
put :: UpperLimit a -> Put
put (UpperLimit a
l CL Double
cl) = forall t. Binary t => t -> Put
put a
l forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put CL Double
cl
instance FromJSON a => FromJSON (UpperLimit a)
instance ToJSON a => ToJSON (UpperLimit a)
instance NFData a => NFData (UpperLimit a) where
rnf :: UpperLimit a -> ()
rnf (UpperLimit a
x CL Double
cl) = forall a. NFData a => a -> ()
rnf a
x seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf CL Double
cl
data LowerLimit a = LowerLimit {
forall a. LowerLimit a -> a
lowerLimit :: !a
, forall a. LowerLimit a -> CL Double
llConfidenceLevel :: !(CL Double)
} deriving (LowerLimit a -> LowerLimit a -> Bool
forall a. Eq a => LowerLimit a -> LowerLimit a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LowerLimit a -> LowerLimit a -> Bool
$c/= :: forall a. Eq a => LowerLimit a -> LowerLimit a -> Bool
== :: LowerLimit a -> LowerLimit a -> Bool
$c== :: forall a. Eq a => LowerLimit a -> LowerLimit a -> Bool
Eq, ReadPrec [LowerLimit a]
ReadPrec (LowerLimit a)
ReadS [LowerLimit a]
forall a. Read a => ReadPrec [LowerLimit a]
forall a. Read a => ReadPrec (LowerLimit a)
forall a. Read a => Int -> ReadS (LowerLimit a)
forall a. Read a => ReadS [LowerLimit a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LowerLimit a]
$creadListPrec :: forall a. Read a => ReadPrec [LowerLimit a]
readPrec :: ReadPrec (LowerLimit a)
$creadPrec :: forall a. Read a => ReadPrec (LowerLimit a)
readList :: ReadS [LowerLimit a]
$creadList :: forall a. Read a => ReadS [LowerLimit a]
readsPrec :: Int -> ReadS (LowerLimit a)
$creadsPrec :: forall a. Read a => Int -> ReadS (LowerLimit a)
Read, Int -> LowerLimit a -> ShowS
forall a. Show a => Int -> LowerLimit a -> ShowS
forall a. Show a => [LowerLimit a] -> ShowS
forall a. Show a => LowerLimit a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LowerLimit a] -> ShowS
$cshowList :: forall a. Show a => [LowerLimit a] -> ShowS
show :: LowerLimit a -> String
$cshow :: forall a. Show a => LowerLimit a -> String
showsPrec :: Int -> LowerLimit a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> LowerLimit a -> ShowS
Show, Typeable, LowerLimit a -> DataType
LowerLimit a -> Constr
forall {a}. Data a => Typeable (LowerLimit a)
forall a. Data a => LowerLimit a -> DataType
forall a. Data a => LowerLimit a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> LowerLimit a -> LowerLimit a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> LowerLimit a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> LowerLimit a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LowerLimit a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LowerLimit a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> LowerLimit a -> m (LowerLimit a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> LowerLimit a -> m (LowerLimit a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LowerLimit a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LowerLimit a -> c (LowerLimit a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (LowerLimit a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LowerLimit a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LowerLimit a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LowerLimit a -> c (LowerLimit a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (LowerLimit a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LowerLimit a -> m (LowerLimit a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> LowerLimit a -> m (LowerLimit a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LowerLimit a -> m (LowerLimit a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> LowerLimit a -> m (LowerLimit a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LowerLimit a -> m (LowerLimit a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> LowerLimit a -> m (LowerLimit a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LowerLimit a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> LowerLimit a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> LowerLimit a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> LowerLimit a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LowerLimit a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LowerLimit a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LowerLimit a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LowerLimit a -> r
gmapT :: (forall b. Data b => b -> b) -> LowerLimit a -> LowerLimit a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> LowerLimit a -> LowerLimit a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LowerLimit a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (LowerLimit a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (LowerLimit a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (LowerLimit a))
dataTypeOf :: LowerLimit a -> DataType
$cdataTypeOf :: forall a. Data a => LowerLimit a -> DataType
toConstr :: LowerLimit a -> Constr
$ctoConstr :: forall a. Data a => LowerLimit a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LowerLimit a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (LowerLimit a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LowerLimit a -> c (LowerLimit a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LowerLimit a -> c (LowerLimit a)
Data, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (LowerLimit a) x -> LowerLimit a
forall a x. LowerLimit a -> Rep (LowerLimit a) x
$cto :: forall a x. Rep (LowerLimit a) x -> LowerLimit a
$cfrom :: forall a x. LowerLimit a -> Rep (LowerLimit a) x
Generic)
instance Binary a => Binary (LowerLimit a) where
get :: Get (LowerLimit a)
get = forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 forall a. a -> CL Double -> LowerLimit a
LowerLimit forall t. Binary t => Get t
get forall t. Binary t => Get t
get
put :: LowerLimit a -> Put
put (LowerLimit a
l CL Double
cl) = forall t. Binary t => t -> Put
put a
l forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall t. Binary t => t -> Put
put CL Double
cl
instance FromJSON a => FromJSON (LowerLimit a)
instance ToJSON a => ToJSON (LowerLimit a)
instance NFData a => NFData (LowerLimit a) where
rnf :: LowerLimit a -> ()
rnf (LowerLimit a
x CL Double
cl) = forall a. NFData a => a -> ()
rnf a
x seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf CL Double
cl
derivingUnbox "CL"
[t| forall a. Unbox a => CL a -> a |]
[| \(CL a) -> a |]
[| CL |]
derivingUnbox "PValue"
[t| forall a. Unbox a => PValue a -> a |]
[| \(PValue a) -> a |]
[| PValue |]
derivingUnbox "Estimate"
[t| forall a e. (Unbox a, Unbox (e a)) => Estimate e a -> (a, e a) |]
[| \(Estimate x dx) -> (x,dx) |]
[| \(x,dx) -> (Estimate x dx) |]
derivingUnbox "NormalErr"
[t| forall a. Unbox a => NormalErr a -> a |]
[| \(NormalErr a) -> a |]
[| NormalErr |]
derivingUnbox "ConfInt"
[t| forall a. Unbox a => ConfInt a -> (a, a, CL Double) |]
[| \(ConfInt a b c) -> (a,b,c) |]
[| \(a,b,c) -> ConfInt a b c |]
derivingUnbox "UpperLimit"
[t| forall a. Unbox a => UpperLimit a -> (a, CL Double) |]
[| \(UpperLimit a b) -> (a,b) |]
[| \(a,b) -> UpperLimit a b |]
derivingUnbox "LowerLimit"
[t| forall a. Unbox a => LowerLimit a -> (a, CL Double) |]
[| \(LowerLimit a b) -> (a,b) |]
[| \(a,b) -> LowerLimit a b |]