{-# LANGUAGE DeriveFunctor, DeriveDataTypeable,DeriveGeneric #-}
module Statistics.Test.Types (
Test(..)
, isSignificant
, TestResult(..)
, significant
, PositionTest(..)
) where
import Control.DeepSeq (NFData(..))
import Control.Monad (liftM3)
import Data.Aeson (FromJSON, ToJSON)
import Data.Binary (Binary (..))
import Data.Data (Typeable, Data)
import GHC.Generics
import Statistics.Types (PValue)
data TestResult = Significant
| NotSignificant
deriving (TestResult -> TestResult -> Bool
(TestResult -> TestResult -> Bool)
-> (TestResult -> TestResult -> Bool) -> Eq TestResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestResult -> TestResult -> Bool
$c/= :: TestResult -> TestResult -> Bool
== :: TestResult -> TestResult -> Bool
$c== :: TestResult -> TestResult -> Bool
Eq,Eq TestResult
Eq TestResult
-> (TestResult -> TestResult -> Ordering)
-> (TestResult -> TestResult -> Bool)
-> (TestResult -> TestResult -> Bool)
-> (TestResult -> TestResult -> Bool)
-> (TestResult -> TestResult -> Bool)
-> (TestResult -> TestResult -> TestResult)
-> (TestResult -> TestResult -> TestResult)
-> Ord TestResult
TestResult -> TestResult -> Bool
TestResult -> TestResult -> Ordering
TestResult -> TestResult -> TestResult
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
min :: TestResult -> TestResult -> TestResult
$cmin :: TestResult -> TestResult -> TestResult
max :: TestResult -> TestResult -> TestResult
$cmax :: TestResult -> TestResult -> TestResult
>= :: TestResult -> TestResult -> Bool
$c>= :: TestResult -> TestResult -> Bool
> :: TestResult -> TestResult -> Bool
$c> :: TestResult -> TestResult -> Bool
<= :: TestResult -> TestResult -> Bool
$c<= :: TestResult -> TestResult -> Bool
< :: TestResult -> TestResult -> Bool
$c< :: TestResult -> TestResult -> Bool
compare :: TestResult -> TestResult -> Ordering
$ccompare :: TestResult -> TestResult -> Ordering
$cp1Ord :: Eq TestResult
Ord,Int -> TestResult -> ShowS
[TestResult] -> ShowS
TestResult -> String
(Int -> TestResult -> ShowS)
-> (TestResult -> String)
-> ([TestResult] -> ShowS)
-> Show TestResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestResult] -> ShowS
$cshowList :: [TestResult] -> ShowS
show :: TestResult -> String
$cshow :: TestResult -> String
showsPrec :: Int -> TestResult -> ShowS
$cshowsPrec :: Int -> TestResult -> ShowS
Show,Typeable,Typeable TestResult
DataType
Constr
Typeable TestResult
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TestResult -> c TestResult)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TestResult)
-> (TestResult -> Constr)
-> (TestResult -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TestResult))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TestResult))
-> ((forall b. Data b => b -> b) -> TestResult -> TestResult)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TestResult -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TestResult -> r)
-> (forall u. (forall d. Data d => d -> u) -> TestResult -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> TestResult -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TestResult -> m TestResult)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TestResult -> m TestResult)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TestResult -> m TestResult)
-> Data TestResult
TestResult -> DataType
TestResult -> Constr
(forall b. Data b => b -> b) -> TestResult -> TestResult
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TestResult -> c TestResult
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TestResult
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 u. Int -> (forall d. Data d => d -> u) -> TestResult -> u
forall u. (forall d. Data d => d -> u) -> TestResult -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TestResult -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TestResult -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TestResult -> m TestResult
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TestResult -> m TestResult
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TestResult
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TestResult -> c TestResult
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TestResult)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TestResult)
$cNotSignificant :: Constr
$cSignificant :: Constr
$tTestResult :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> TestResult -> m TestResult
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TestResult -> m TestResult
gmapMp :: (forall d. Data d => d -> m d) -> TestResult -> m TestResult
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TestResult -> m TestResult
gmapM :: (forall d. Data d => d -> m d) -> TestResult -> m TestResult
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TestResult -> m TestResult
gmapQi :: Int -> (forall d. Data d => d -> u) -> TestResult -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TestResult -> u
gmapQ :: (forall d. Data d => d -> u) -> TestResult -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TestResult -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TestResult -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TestResult -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TestResult -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TestResult -> r
gmapT :: (forall b. Data b => b -> b) -> TestResult -> TestResult
$cgmapT :: (forall b. Data b => b -> b) -> TestResult -> TestResult
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TestResult)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TestResult)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c TestResult)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TestResult)
dataTypeOf :: TestResult -> DataType
$cdataTypeOf :: TestResult -> DataType
toConstr :: TestResult -> Constr
$ctoConstr :: TestResult -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TestResult
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TestResult
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TestResult -> c TestResult
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TestResult -> c TestResult
$cp1Data :: Typeable TestResult
Data,(forall x. TestResult -> Rep TestResult x)
-> (forall x. Rep TestResult x -> TestResult) -> Generic TestResult
forall x. Rep TestResult x -> TestResult
forall x. TestResult -> Rep TestResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestResult x -> TestResult
$cfrom :: forall x. TestResult -> Rep TestResult x
Generic)
instance Binary TestResult where
get :: Get TestResult
get = do
Bool
sig <- Get Bool
forall t. Binary t => Get t
get
if Bool
sig then TestResult -> Get TestResult
forall (m :: * -> *) a. Monad m => a -> m a
return TestResult
Significant else TestResult -> Get TestResult
forall (m :: * -> *) a. Monad m => a -> m a
return TestResult
NotSignificant
put :: TestResult -> Put
put = Bool -> Put
forall t. Binary t => t -> Put
put (Bool -> Put) -> (TestResult -> Bool) -> TestResult -> Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TestResult -> TestResult -> Bool
forall a. Eq a => a -> a -> Bool
== TestResult
Significant)
instance FromJSON TestResult
instance ToJSON TestResult
instance NFData TestResult
data Test distr = Test
{ Test distr -> PValue Double
testSignificance :: !(PValue Double)
, Test distr -> Double
testStatistics :: !Double
, Test distr -> distr
testDistribution :: distr
}
deriving (Test distr -> Test distr -> Bool
(Test distr -> Test distr -> Bool)
-> (Test distr -> Test distr -> Bool) -> Eq (Test distr)
forall distr. Eq distr => Test distr -> Test distr -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Test distr -> Test distr -> Bool
$c/= :: forall distr. Eq distr => Test distr -> Test distr -> Bool
== :: Test distr -> Test distr -> Bool
$c== :: forall distr. Eq distr => Test distr -> Test distr -> Bool
Eq,Eq (Test distr)
Eq (Test distr)
-> (Test distr -> Test distr -> Ordering)
-> (Test distr -> Test distr -> Bool)
-> (Test distr -> Test distr -> Bool)
-> (Test distr -> Test distr -> Bool)
-> (Test distr -> Test distr -> Bool)
-> (Test distr -> Test distr -> Test distr)
-> (Test distr -> Test distr -> Test distr)
-> Ord (Test distr)
Test distr -> Test distr -> Bool
Test distr -> Test distr -> Ordering
Test distr -> Test distr -> Test distr
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 distr. Ord distr => Eq (Test distr)
forall distr. Ord distr => Test distr -> Test distr -> Bool
forall distr. Ord distr => Test distr -> Test distr -> Ordering
forall distr. Ord distr => Test distr -> Test distr -> Test distr
min :: Test distr -> Test distr -> Test distr
$cmin :: forall distr. Ord distr => Test distr -> Test distr -> Test distr
max :: Test distr -> Test distr -> Test distr
$cmax :: forall distr. Ord distr => Test distr -> Test distr -> Test distr
>= :: Test distr -> Test distr -> Bool
$c>= :: forall distr. Ord distr => Test distr -> Test distr -> Bool
> :: Test distr -> Test distr -> Bool
$c> :: forall distr. Ord distr => Test distr -> Test distr -> Bool
<= :: Test distr -> Test distr -> Bool
$c<= :: forall distr. Ord distr => Test distr -> Test distr -> Bool
< :: Test distr -> Test distr -> Bool
$c< :: forall distr. Ord distr => Test distr -> Test distr -> Bool
compare :: Test distr -> Test distr -> Ordering
$ccompare :: forall distr. Ord distr => Test distr -> Test distr -> Ordering
$cp1Ord :: forall distr. Ord distr => Eq (Test distr)
Ord,Int -> Test distr -> ShowS
[Test distr] -> ShowS
Test distr -> String
(Int -> Test distr -> ShowS)
-> (Test distr -> String)
-> ([Test distr] -> ShowS)
-> Show (Test distr)
forall distr. Show distr => Int -> Test distr -> ShowS
forall distr. Show distr => [Test distr] -> ShowS
forall distr. Show distr => Test distr -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Test distr] -> ShowS
$cshowList :: forall distr. Show distr => [Test distr] -> ShowS
show :: Test distr -> String
$cshow :: forall distr. Show distr => Test distr -> String
showsPrec :: Int -> Test distr -> ShowS
$cshowsPrec :: forall distr. Show distr => Int -> Test distr -> ShowS
Show,Typeable,Typeable (Test distr)
DataType
Constr
Typeable (Test distr)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Test distr -> c (Test distr))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Test distr))
-> (Test distr -> Constr)
-> (Test distr -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Test distr)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Test distr)))
-> ((forall b. Data b => b -> b) -> Test distr -> Test distr)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r)
-> (forall u. (forall d. Data d => d -> u) -> Test distr -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> Test distr -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr))
-> Data (Test distr)
Test distr -> DataType
Test distr -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Test distr))
(forall b. Data b => b -> b) -> Test distr -> Test distr
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Test distr -> c (Test distr)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Test distr)
forall distr. Data distr => Typeable (Test distr)
forall distr. Data distr => Test distr -> DataType
forall distr. Data distr => Test distr -> Constr
forall distr.
Data distr =>
(forall b. Data b => b -> b) -> Test distr -> Test distr
forall distr u.
Data distr =>
Int -> (forall d. Data d => d -> u) -> Test distr -> u
forall distr u.
Data distr =>
(forall d. Data d => d -> u) -> Test distr -> [u]
forall distr r r'.
Data distr =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r
forall distr r r'.
Data distr =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r
forall distr (m :: * -> *).
(Data distr, Monad m) =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
forall distr (m :: * -> *).
(Data distr, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
forall distr (c :: * -> *).
Data distr =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Test distr)
forall distr (c :: * -> *).
Data distr =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Test distr -> c (Test distr)
forall distr (t :: * -> *) (c :: * -> *).
(Data distr, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Test distr))
forall distr (t :: * -> * -> *) (c :: * -> *).
(Data distr, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Test distr))
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 u. Int -> (forall d. Data d => d -> u) -> Test distr -> u
forall u. (forall d. Data d => d -> u) -> Test distr -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Test distr)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Test distr -> c (Test distr)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Test distr))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Test distr))
$cTest :: Constr
$tTest :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
$cgmapMo :: forall distr (m :: * -> *).
(Data distr, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
gmapMp :: (forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
$cgmapMp :: forall distr (m :: * -> *).
(Data distr, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
gmapM :: (forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
$cgmapM :: forall distr (m :: * -> *).
(Data distr, Monad m) =>
(forall d. Data d => d -> m d) -> Test distr -> m (Test distr)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Test distr -> u
$cgmapQi :: forall distr u.
Data distr =>
Int -> (forall d. Data d => d -> u) -> Test distr -> u
gmapQ :: (forall d. Data d => d -> u) -> Test distr -> [u]
$cgmapQ :: forall distr u.
Data distr =>
(forall d. Data d => d -> u) -> Test distr -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r
$cgmapQr :: forall distr r r'.
Data distr =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r
$cgmapQl :: forall distr r r'.
Data distr =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Test distr -> r
gmapT :: (forall b. Data b => b -> b) -> Test distr -> Test distr
$cgmapT :: forall distr.
Data distr =>
(forall b. Data b => b -> b) -> Test distr -> Test distr
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Test distr))
$cdataCast2 :: forall distr (t :: * -> * -> *) (c :: * -> *).
(Data distr, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Test distr))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Test distr))
$cdataCast1 :: forall distr (t :: * -> *) (c :: * -> *).
(Data distr, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Test distr))
dataTypeOf :: Test distr -> DataType
$cdataTypeOf :: forall distr. Data distr => Test distr -> DataType
toConstr :: Test distr -> Constr
$ctoConstr :: forall distr. Data distr => Test distr -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Test distr)
$cgunfold :: forall distr (c :: * -> *).
Data distr =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Test distr)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Test distr -> c (Test distr)
$cgfoldl :: forall distr (c :: * -> *).
Data distr =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Test distr -> c (Test distr)
$cp1Data :: forall distr. Data distr => Typeable (Test distr)
Data,(forall x. Test distr -> Rep (Test distr) x)
-> (forall x. Rep (Test distr) x -> Test distr)
-> Generic (Test distr)
forall x. Rep (Test distr) x -> Test distr
forall x. Test distr -> Rep (Test distr) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall distr x. Rep (Test distr) x -> Test distr
forall distr x. Test distr -> Rep (Test distr) x
$cto :: forall distr x. Rep (Test distr) x -> Test distr
$cfrom :: forall distr x. Test distr -> Rep (Test distr) x
Generic,a -> Test b -> Test a
(a -> b) -> Test a -> Test b
(forall a b. (a -> b) -> Test a -> Test b)
-> (forall a b. a -> Test b -> Test a) -> Functor Test
forall a b. a -> Test b -> Test a
forall a b. (a -> b) -> Test a -> Test b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Test b -> Test a
$c<$ :: forall a b. a -> Test b -> Test a
fmap :: (a -> b) -> Test a -> Test b
$cfmap :: forall a b. (a -> b) -> Test a -> Test b
Functor)
instance (Binary d) => Binary (Test d) where
get :: Get (Test d)
get = (PValue Double -> Double -> d -> Test d)
-> Get (PValue Double) -> Get Double -> Get d -> Get (Test d)
forall (m :: * -> *) a1 a2 a3 r.
Monad m =>
(a1 -> a2 -> a3 -> r) -> m a1 -> m a2 -> m a3 -> m r
liftM3 PValue Double -> Double -> d -> Test d
forall distr. PValue Double -> Double -> distr -> Test distr
Test Get (PValue Double)
forall t. Binary t => Get t
get Get Double
forall t. Binary t => Get t
get Get d
forall t. Binary t => Get t
get
put :: Test d -> Put
put (Test PValue Double
sign Double
stat d
distr) = PValue Double -> Put
forall t. Binary t => t -> Put
put PValue Double
sign Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Double -> Put
forall t. Binary t => t -> Put
put Double
stat Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> d -> Put
forall t. Binary t => t -> Put
put d
distr
instance (FromJSON d) => FromJSON (Test d)
instance (ToJSON d) => ToJSON (Test d)
instance (NFData d) => NFData (Test d) where
rnf :: Test d -> ()
rnf (Test PValue Double
_ Double
_ d
a) = d -> ()
forall a. NFData a => a -> ()
rnf d
a
isSignificant :: PValue Double -> Test d -> TestResult
isSignificant :: PValue Double -> Test d -> TestResult
isSignificant PValue Double
p Test d
t
= Bool -> TestResult
significant (Bool -> TestResult) -> Bool -> TestResult
forall a b. (a -> b) -> a -> b
$ PValue Double
p PValue Double -> PValue Double -> Bool
forall a. Ord a => a -> a -> Bool
>= Test d -> PValue Double
forall distr. Test distr -> PValue Double
testSignificance Test d
t
data PositionTest
= SamplesDiffer
| AGreater
| BGreater
deriving (PositionTest -> PositionTest -> Bool
(PositionTest -> PositionTest -> Bool)
-> (PositionTest -> PositionTest -> Bool) -> Eq PositionTest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PositionTest -> PositionTest -> Bool
$c/= :: PositionTest -> PositionTest -> Bool
== :: PositionTest -> PositionTest -> Bool
$c== :: PositionTest -> PositionTest -> Bool
Eq,Eq PositionTest
Eq PositionTest
-> (PositionTest -> PositionTest -> Ordering)
-> (PositionTest -> PositionTest -> Bool)
-> (PositionTest -> PositionTest -> Bool)
-> (PositionTest -> PositionTest -> Bool)
-> (PositionTest -> PositionTest -> Bool)
-> (PositionTest -> PositionTest -> PositionTest)
-> (PositionTest -> PositionTest -> PositionTest)
-> Ord PositionTest
PositionTest -> PositionTest -> Bool
PositionTest -> PositionTest -> Ordering
PositionTest -> PositionTest -> PositionTest
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
min :: PositionTest -> PositionTest -> PositionTest
$cmin :: PositionTest -> PositionTest -> PositionTest
max :: PositionTest -> PositionTest -> PositionTest
$cmax :: PositionTest -> PositionTest -> PositionTest
>= :: PositionTest -> PositionTest -> Bool
$c>= :: PositionTest -> PositionTest -> Bool
> :: PositionTest -> PositionTest -> Bool
$c> :: PositionTest -> PositionTest -> Bool
<= :: PositionTest -> PositionTest -> Bool
$c<= :: PositionTest -> PositionTest -> Bool
< :: PositionTest -> PositionTest -> Bool
$c< :: PositionTest -> PositionTest -> Bool
compare :: PositionTest -> PositionTest -> Ordering
$ccompare :: PositionTest -> PositionTest -> Ordering
$cp1Ord :: Eq PositionTest
Ord,Int -> PositionTest -> ShowS
[PositionTest] -> ShowS
PositionTest -> String
(Int -> PositionTest -> ShowS)
-> (PositionTest -> String)
-> ([PositionTest] -> ShowS)
-> Show PositionTest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PositionTest] -> ShowS
$cshowList :: [PositionTest] -> ShowS
show :: PositionTest -> String
$cshow :: PositionTest -> String
showsPrec :: Int -> PositionTest -> ShowS
$cshowsPrec :: Int -> PositionTest -> ShowS
Show,Typeable,Typeable PositionTest
DataType
Constr
Typeable PositionTest
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositionTest -> c PositionTest)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositionTest)
-> (PositionTest -> Constr)
-> (PositionTest -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PositionTest))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositionTest))
-> ((forall b. Data b => b -> b) -> PositionTest -> PositionTest)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositionTest -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositionTest -> r)
-> (forall u. (forall d. Data d => d -> u) -> PositionTest -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> PositionTest -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PositionTest -> m PositionTest)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PositionTest -> m PositionTest)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PositionTest -> m PositionTest)
-> Data PositionTest
PositionTest -> DataType
PositionTest -> Constr
(forall b. Data b => b -> b) -> PositionTest -> PositionTest
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositionTest -> c PositionTest
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositionTest
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 u. Int -> (forall d. Data d => d -> u) -> PositionTest -> u
forall u. (forall d. Data d => d -> u) -> PositionTest -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositionTest -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositionTest -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PositionTest -> m PositionTest
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PositionTest -> m PositionTest
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositionTest
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositionTest -> c PositionTest
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PositionTest)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositionTest)
$cBGreater :: Constr
$cAGreater :: Constr
$cSamplesDiffer :: Constr
$tPositionTest :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> PositionTest -> m PositionTest
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PositionTest -> m PositionTest
gmapMp :: (forall d. Data d => d -> m d) -> PositionTest -> m PositionTest
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PositionTest -> m PositionTest
gmapM :: (forall d. Data d => d -> m d) -> PositionTest -> m PositionTest
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PositionTest -> m PositionTest
gmapQi :: Int -> (forall d. Data d => d -> u) -> PositionTest -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PositionTest -> u
gmapQ :: (forall d. Data d => d -> u) -> PositionTest -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> PositionTest -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositionTest -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PositionTest -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositionTest -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PositionTest -> r
gmapT :: (forall b. Data b => b -> b) -> PositionTest -> PositionTest
$cgmapT :: (forall b. Data b => b -> b) -> PositionTest -> PositionTest
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositionTest)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PositionTest)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c PositionTest)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PositionTest)
dataTypeOf :: PositionTest -> DataType
$cdataTypeOf :: PositionTest -> DataType
toConstr :: PositionTest -> Constr
$ctoConstr :: PositionTest -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositionTest
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PositionTest
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositionTest -> c PositionTest
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PositionTest -> c PositionTest
$cp1Data :: Typeable PositionTest
Data,(forall x. PositionTest -> Rep PositionTest x)
-> (forall x. Rep PositionTest x -> PositionTest)
-> Generic PositionTest
forall x. Rep PositionTest x -> PositionTest
forall x. PositionTest -> Rep PositionTest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PositionTest x -> PositionTest
$cfrom :: forall x. PositionTest -> Rep PositionTest x
Generic)
instance Binary PositionTest where
get :: Get PositionTest
get = do
Int
i <- Get Int
forall t. Binary t => Get t
get
case (Int
i :: Int) of
Int
0 -> PositionTest -> Get PositionTest
forall (m :: * -> *) a. Monad m => a -> m a
return PositionTest
SamplesDiffer
Int
1 -> PositionTest -> Get PositionTest
forall (m :: * -> *) a. Monad m => a -> m a
return PositionTest
AGreater
Int
2 -> PositionTest -> Get PositionTest
forall (m :: * -> *) a. Monad m => a -> m a
return PositionTest
BGreater
Int
_ -> String -> Get PositionTest
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Invalid PositionTest"
put :: PositionTest -> Put
put PositionTest
SamplesDiffer = Int -> Put
forall t. Binary t => t -> Put
put (Int
0 :: Int)
put PositionTest
AGreater = Int -> Put
forall t. Binary t => t -> Put
put (Int
1 :: Int)
put PositionTest
BGreater = Int -> Put
forall t. Binary t => t -> Put
put (Int
2 :: Int)
instance FromJSON PositionTest
instance ToJSON PositionTest
instance NFData PositionTest
significant :: Bool -> TestResult
significant :: Bool -> TestResult
significant Bool
True = TestResult
Significant
significant Bool
False = TestResult
NotSignificant