Skip to content

Commit

Permalink
Move result data types into separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
Shimuuar committed Nov 2, 2011
1 parent 51774bb commit 750aa1e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Statistics/Test/NonParametric.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module Statistics.Test.NonParametric
, wilcoxonMatchedPairCriticalValue
-- * Data types
, TestType(..)
, TestResult(..)
) where

import Control.Applicative ((<$>))
Expand All @@ -44,15 +45,9 @@ import Statistics.Distribution.Normal (standard)
import Statistics.Math (choose)
import Statistics.Types (Sample)
import Statistics.Function (sortBy)
import Statistics.Test.Types



-- | Test type. Exact meaning depends on a specific test. But
-- generally it's tested whether some statistics is too big (small)
-- for 'OneTailed' or whether it too big or too small for 'TwoTailed'
data TestType = OneTailed
| TwoTailed

-- | The Wilcoxon Rank Sums Test.
--
-- This test calculates the sum of ranks for the given two samples. The samples
Expand Down
27 changes: 27 additions & 0 deletions Statistics/Test/Types.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{-# LANGUAGE DeriveDataTypeable #-}
module Statistics.Test.Types (
TestType(..)
, TestResult(..)
, significant
) where

import Data.Typeable (Typeable)


-- | Test type. Exact meaning depends on a specific test. But
-- generally it's tested whether some statistics is too big (small)
-- for 'OneTailed' or whether it too big or too small for 'TwoTailed'
data TestType = OneTailed
| TwoTailed
deriving (Eq,Ord,Show,Typeable)

-- | Result of hypothesis testing
data TestResult = Significant -- ^ Null hypothesis should be rejected
| NotSignificant -- ^ Data is compatible with hypothesis
deriving (Eq,Ord,Show,Typeable)

-- | Significant if parameter is 'True', not significant otherwiser
significant :: Bool -> TestResult
significant True = Significant
significant False = NotSignificant
{-# INLINE significant #-}
1 change: 1 addition & 0 deletions statistics.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ library
Statistics.Sample.KernelDensity.Simple
Statistics.Sample.Powers
Statistics.Test.NonParametric
Statistics.Test.Types
Statistics.Transform
Statistics.Types
other-modules:
Expand Down

0 comments on commit 750aa1e

Please sign in to comment.