-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Statistics
--   
--   Purely functional interface for statistics based on hmatrix and
--   hmatrix-gsl-stats
--   
--   The vector type is Data.Vector.Storable from the <a>vector</a> package
--   and compatible with the <a>statistics</a> package.
--   <a>http://hackage.haskell.org/package/statistics</a>
--   
--   Feature requests, suggestions, and bug fixes welcome.
@package hstatistics
@version 0.3


-- | Useful statistical functions
module Numeric.Statistics
type Sample a = Vector a
type Samples a = Array Int (Vector a)

-- | the covariance matrix
covarianceMatrix :: Samples Double -> Matrix Double

-- | the correlation coefficient: (cov x y) / (std x) (std y)
correlationCoefficientMatrix :: Samples Double -> Matrix Double

-- | the mean of a list of vectors
meanList :: (Container Vector a, Num (Vector a), Fractional a) => [Sample a] -> Sample a

-- | the mean of an array of vectors
meanArray :: (Container Vector a, Num (Vector a), Fractional a) => Samples a -> Sample a

-- | the mean of a matrix with data series in rows
meanMatrix :: (Container Vector a, Num (Vector a), Fractional a) => Matrix a -> Sample a

-- | the variance of a list of vectors
varianceList :: (Container Vector a, Floating (Vector a), Num a, Fractional a) => [Sample a] -> Sample a

-- | the variance of an array of vectors
varianceArray :: (Container Vector a, Floating (Vector a), Fractional a) => Samples a -> Sample a

-- | the variance of a matrix with data series in rows
varianceMatrix :: (Container Vector a, Floating (Vector a), Fractional a) => Matrix a -> Sample a

-- | centre the data to 0: (x - (mean x))
centre :: Vector Double -> Vector Double

-- | complementary log-log function cloglog :: Vector Double -&gt; Vector
--   Double
cloglog :: Floating a => a -> a

-- | corcoeff = covariance x / (std dev x * std dev y)
corcoeff :: Vector Double -> Vector Double -> Double

-- | cut numerical data into intervals, data must fall inside the bounds
cut :: Vector Double -> Vector Double -> Vector Int

-- | return the rank of each element of the vector multiple identical
--   entries result in the average rank of those entries ranks :: Vector
--   Double -&gt; Vector Double
ranks :: (Fractional b, Storable b) => Vector Double -> Vector b

-- | kendall's rank correlation τ
kendall :: Vector Double -> Vector Double -> Matrix Double

-- | (logit p) = log(p/(1-p)) logit :: Vector Double -&gt; Vector Double
logit :: (Floating b, Storable b) => Vector b -> Vector b

-- | the Mahalanobis D-square distance between samples columns are
--   components and rows are observations (uses pseudoinverse)
mahalanobis :: Samples Double -> Maybe (Sample Double) -> Double

-- | a list of element frequencies
mode :: Vector Double -> [(Double, Integer)]

-- | the p'th moment of a vector
moment :: Integral a => a -> Bool -> Bool -> Vector Double -> Double

-- | ordinary least squares estimation for the multivariate model Y = X B +
--   e rows are observations, columns are elements mean e = 0, cov e =
--   kronecker s I
ols :: (Num (Vector t), Field t) => Matrix t -> Matrix t -> (Matrix t, Matrix t, Matrix t)

-- | compute quantiles in percent
percentile :: Double -> Vector Double -> Double

-- | the difference between the maximum and minimum of the input
range :: (Container c e, Num e) => c e -> e

-- | count the number of runs greater than or equal to <tt>n</tt> in the
--   data
run_count :: (Num a, Num t, Ord b, Ord a, Container Vector b) => a -> Vector b -> [(a, t)]

-- | Spearman's rank correlation coefficient
spearman :: Vector Double -> Vector Double -> Double

-- | centre and normalise a vector
studentize :: Vector Double -> Vector Double


-- | create histograms from density functions
module Numeric.Statistics.Histogram
cumulativeToHistogram :: (Double -> Double) -> Vector Double -> Histogram
gaussianHistogram :: Double -> Double -> Vector Double -> Histogram


-- | Independent Components Analysis
--   
--   implements the FastICA algorithm found in:
--   
--   <ul>
--   <li>Aapo Hyvärinen and Erkki Oja, Independent Component Analysis:
--   Algorithms and Applications, <i>Neural Networks</i>, 13(4-5):411-430,
--   2000</li>
--   </ul>
--   
--   
--   <a>http://www.google.com/url?sa=t&amp;source=web&amp;cd=2&amp;ved=0CBgQFjAB&amp;url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.79.7003%26rep%3Drep1%26type%3Dpdf&amp;ei=RQozTJb6L4_fcbCV6cMD&amp;usg=AFQjCNGClLIB9MAvbrEj45SyUx9cYubLyA&amp;sig2=hg5Wnfy3dLPkoIc1hqSfjg</a>
module Numeric.Statistics.ICA

-- | sigmoid transfer function
sigmoid :: Double -> Double

-- | derivative of sigmoid transfer function
sigmoid' :: Double -> Double

-- | remove the mean from data
demean :: Array Int (Vector Double) -> (Array Int (Vector Double), Vector Double)

-- | whiten data
whiten :: Array Int (Vector Double) -> Double -> (Array Int (Vector Double), Matrix Double)

-- | perform an ICA transform
ica :: Int -> (Double -> Double) -> (Double -> Double) -> NormType -> Double -> Int -> Array Int (Vector Double) -> (Array Int (Vector Double), Matrix Double)

-- | ICA with default values: no dimension reduction, euclidean norms, 16
--   sample groups, sigmoid
icaDefaults :: Int -> Array Int (Vector Double) -> (Array Int (Vector Double), Matrix Double)
data NormType
NormZero :: NormType
NormOne :: NormType
NormTwo :: NormType
NormInf :: NormType


-- | Principal Components Analysis
module Numeric.Statistics.PCA

-- | find the principal components of multidimensional data greater than
--   the threshhold
pca :: Array Int (Vector Double) -> Double -> (Vector Double, Matrix Double)

-- | find N greatest principal components of multidimensional data
--   according to size of the eigenvalue
pcaN :: Array Int (Vector Double) -> Int -> (Vector Double, Matrix Double)

-- | perform a PCA transform of the original data (remove mean) | Final =
--   M^T Data^T
pcaTransform :: Array Int (Vector Double) -> Matrix Double -> Array Int (Vector Double)

-- | perform a dimension-reducing PCA modification, using an eigenvalue
--   threshhold
pcaReduce :: Array Int (Vector Double) -> Double -> Array Int (Vector Double)

-- | perform a dimension-reducing PCA modification, using N components
pcaReduceN :: Array Int (Vector Double) -> Int -> Array Int (Vector Double)


-- | Probability Distribution Function interface
module Numeric.Statistics.PDF

-- | a probability distribution function
--   
--   a PDF interface
data PDFFunction a
class PDF b a

-- | calculate a probability
probability :: PDF b a => b -> Vector a -> Vector Double

-- | create a PDF from an arbtrary function f :-&gt; [0,1]
pdfFromFunction :: (a -> Double) -> PDFFunction a
instance Foreign.Storable.Storable b => Numeric.Statistics.PDF.PDF (Numeric.Statistics.PDF.PDFFunction b) b
instance Numeric.Statistics.PDF.PDF Numeric.GSL.Histogram.Histogram GHC.Types.Double
instance Numeric.Statistics.PDF.PDF Numeric.GSL.Histogram2D.Histogram2D (GHC.Types.Double, GHC.Types.Double)


-- | Shannon entropy
module Numeric.Statistics.Information

-- | the entropy sum p_i lln{p_i} of a sequence
entropy :: PDF a Double => a -> Vector Double -> Double

-- | the mutual information sum_x sum_y p(x,y) ln{frac{p(x,y)}{p(x)p(y)}}
mutual_information :: (PDF a Double, PDF b (Double, Double)) => b -> a -> a -> (Vector Double, Vector Double) -> Double


-- | Methods for tests using surrogate data
module Numeric.Statistics.Surrogate

-- | perform an analysis using surrogate data
surrogate :: Int -> Int -> (Array Int (Vector Double) -> a) -> Array Int (Vector Double) -> Array Int a
