packages feed

hstats (empty) → 0.1

raw patch · 27 files changed

+523/−0 lines, 27 filesdep +basedep +haskell98build-type:Customsetup-changedbinary-added

Dependencies added: base, haskell98

Files

+ LICENSE view
@@ -0,0 +1,24 @@+* Copyright (c) 2007, SFTank+* All rights reserved.+* Redistribution and use in source and binary forms, with or without+* modification, are permitted provided that the following conditions are met:+*+*     * Redistributions of source code must retain the above copyright+*       notice, this list of conditions and the following disclaimer.+*     * Redistributions in binary form must reproduce the above copyright+*       notice, this list of conditions and the following disclaimer in the+*       documentation and/or other materials provided with the distribution.+*     * Neither the name of SFTank nor the+*       names of its contributors may be used to endorse or promote products+*       derived from this software without specific prior written permission.+*+* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+* DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ _darcs/inventory view
@@ -0,0 +1,2 @@+[initial commit.+mbeddoe@sftank.net**20070918213154] 
+ _darcs/patches/20070918213154-0e28a-c3676cccf964045a487682ba14406a05656b4001.gz view

binary file changed (absent → 4199 bytes)

+ _darcs/patches/pending view
@@ -0,0 +1,2 @@+{+}
+ _darcs/prefs/author view
@@ -0,0 +1,1 @@+mbeddoe@sftank.net
+ _darcs/prefs/binaries view
@@ -0,0 +1,59 @@+# Binary file regexps:+\.png$+\.PNG$+\.gz$+\.GZ$+\.pdf$+\.PDF$+\.jpg$+\.JPG$+\.jpeg$+\.JPEG$+\.gif$+\.GIF$+\.tif$+\.TIF$+\.tiff$+\.TIFF$+\.pnm$+\.PNM$+\.pbm$+\.PBM$+\.pgm$+\.PGM$+\.ppm$+\.PPM$+\.bmp$+\.BMP$+\.mng$+\.MNG$+\.tar$+\.TAR$+\.bz2$+\.BZ2$+\.z$+\.Z$+\.zip$+\.ZIP$+\.jar$+\.JAR$+\.so$+\.SO$+\.a$+\.A$+\.tgz$+\.TGZ$+\.mpg$+\.MPG$+\.mpeg$+\.MPEG$+\.iso$+\.ISO$+\.exe$+\.EXE$+\.doc$+\.DOC$+\.elc$+\.ELC$+\.pyc$+\.PYC$
+ _darcs/prefs/boring view
@@ -0,0 +1,49 @@+# Boring file regexps:+\.hi$+\.hi-boot$+\.o-boot$+\.o$+\.o\.cmd$+# *.ko files aren't boring by default because they might+# be Korean translations rather than kernel modules.+# \.ko$+\.ko\.cmd$+\.mod\.c$+(^|/)\.tmp_versions($|/)+(^|/)CVS($|/)+\.cvsignore$+^\.#+(^|/)RCS($|/)+,v$+(^|/)\.svn($|/)+\.bzr$+(^|/)SCCS($|/)+~$+(^|/)_darcs($|/)+\.bak$+\.BAK$+\.orig$+\.rej$+(^|/)vssver\.scc$+\.swp$+(^|/)MT($|/)+(^|/)\{arch\}($|/)+(^|/).arch-ids($|/)+(^|/),+\.prof$+(^|/)\.DS_Store$+(^|/)BitKeeper($|/)+(^|/)ChangeSet($|/)+\.py[co]$+\.elc$+\.class$+\#+(^|/)Thumbs\.db$+(^|/)autom4te\.cache($|/)+(^|/)config\.(log|status)$+^\.depend$+(^|/)(tags|TAGS)$+#(^|/)\.[^/]+(^|/|\.)core$+\.(obj|a|exe|so|lo|la)$+^\.darcs-temp-mail$
+ _darcs/prefs/motd view
+ _darcs/pristine/LICENSE view
@@ -0,0 +1,24 @@+* Copyright (c) 2007, SFTank+* All rights reserved.+* Redistribution and use in source and binary forms, with or without+* modification, are permitted provided that the following conditions are met:+*+*     * Redistributions of source code must retain the above copyright+*       notice, this list of conditions and the following disclaimer.+*     * Redistributions in binary form must reproduce the above copyright+*       notice, this list of conditions and the following disclaimer in the+*       documentation and/or other materials provided with the distribution.+*     * Neither the name of SFTank nor the+*       names of its contributors may be used to endorse or promote products+*       derived from this software without specific prior written permission.+*+* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+* DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ _darcs/pristine/Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ _darcs/pristine/dist/build/autogen/Paths_hstats.hs view
@@ -0,0 +1,26 @@+module Paths_hstats (+	version,+	getBinDir, getLibDir, getDataDir, getLibexecDir,+	getDataFileName+	) where++import Data.Version++version :: Version+version = Version {versionBranch = [0,1], versionTags = []}++bindir, libdir, datadir, libexecdir :: FilePath++bindir     = "/usr/local/bin"+libdir     = "/usr/local/lib/hstats-0.1/ghc-6.6"+datadir    = "/usr/local/share/hstats-0.1"+libexecdir = "/usr/local/libexec"++getBinDir, getLibDir, getDataDir, getLibexecDir :: IO FilePath+getBinDir = return bindir+getLibDir = return libdir+getDataDir = return datadir+getLibexecDir = return libexecdir++getDataFileName :: FilePath -> IO FilePath+getDataFileName name = return (datadir ++ "/" ++ name)
+ _darcs/pristine/dist/installed-pkg-config view
@@ -0,0 +1,29 @@+name: hstats+version: 0.1+license: BSD3+copyright: Copyright (c) 2007, SFTank+maintainer: mbeddoe@<nospam>sftank.net+stability:+homepage: http://www.sftank.net+package-url:+description: A library of commonly used statistical functions+category: Math+author: Marshall Beddoe+exposed: True+exposed-modules: Math.Statistics+hidden-modules:+import-dirs: /usr/local/lib/hstats-0.1/ghc-6.6+library-dirs: /usr/local/lib/hstats-0.1/ghc-6.6+hs-libraries: HShstats-0.1+extra-libraries:+extra-ghci-libraries:+include-dirs:+includes:+depends: base-2.0 haskell98-1.0+hugs-options:+cc-options:+ld-options:+framework-dirs:+frameworks:+haddock-interfaces: /usr/local/share/doc/hstats-0.1/html/hstats/hstats.haddock+haddock-html: /usr/local/share/doc/hstats-0.1/html/hstats
+ _darcs/pristine/dist/setup-config view
@@ -0,0 +1,1 @@+LocalBuildInfo {installDirTemplates = InstallDirTemplates {prefixDirTemplate = "/usr/local", binDirTemplate = "$prefix/bin", libDirTemplate = "$prefix/lib", libSubdirTemplate = "$pkgid/$compiler", libexecDirTemplate = "$prefix/libexec", progDirTemplate = "$libdir/hugs/programs", includeDirTemplate = "$libdir/$libsubdir/include", dataDirTemplate = "$prefix/share", dataSubdirTemplate = "$pkgid", docDirTemplate = "$datadir/doc/$pkgid", htmlDirTemplate = "$docdir/html"}, compiler = Compiler {compilerFlavor = GHC, compilerId = PackageIdentifier {pkgName = "ghc", pkgVersion = Version {versionBranch = [6,6], versionTags = []}}, compilerExtensions = [(OverlappingInstances,"-fallow-overlapping-instances"),(TypeSynonymInstances,"-fglasgow-exts"),(TemplateHaskell,"-fth"),(ForeignFunctionInterface,"-fffi"),(NoMonomorphismRestriction,"-fno-monomorphism-restriction"),(UndecidableInstances,"-fallow-undecidable-instances"),(IncoherentInstances,"-fallow-incoherent-instances"),(Arrows,"-farrows"),(Generics,"-fgenerics"),(NoImplicitPrelude,"-fno-implicit-prelude"),(ImplicitParams,"-fimplicit-params"),(CPP,"-cpp"),(BangPatterns,"-fbang-patterns"),(KindSignatures,"-fglasgow-exts"),(RecursiveDo,"-fglasgow-exts"),(ParallelListComp,"-fglasgow-exts"),(MultiParamTypeClasses,"-fglasgow-exts"),(FunctionalDependencies,"-fglasgow-exts"),(Rank2Types,"-fglasgow-exts"),(RankNTypes,"-fglasgow-exts"),(PolymorphicComponents,"-fglasgow-exts"),(ExistentialQuantification,"-fglasgow-exts"),(ScopedTypeVariables,"-fglasgow-exts"),(FlexibleContexts,"-fglasgow-exts"),(FlexibleInstances,"-fglasgow-exts"),(EmptyDataDecls,"-fglasgow-exts"),(PatternGuards,"-fglasgow-exts"),(GeneralizedNewtypeDeriving,"-fglasgow-exts"),(MagicHash,"-fglasgow-exts")]}, buildDir = "dist/build", scratchDir = "dist/scratch", packageDeps = [PackageIdentifier {pkgName = "base", pkgVersion = Version {versionBranch = [2,0], versionTags = []}},PackageIdentifier {pkgName = "haskell98", pkgVersion = Version {versionBranch = [1,0], versionTags = []}}], localPkgDescr = PackageDescription {package = PackageIdentifier {pkgName = "hstats", pkgVersion = Version {versionBranch = [0,1], versionTags = []}}, license = BSD3, licenseFile = "LICENSE", copyright = "Copyright (c) 2007, SFTank", maintainer = "mbeddoe@<nospam>sftank.net", author = "Marshall Beddoe", stability = "", testedWith = [], homepage = "http://www.sftank.net", pkgUrl = "", synopsis = "Statistical Computing in Haskell", description = "A library of commonly used statistical functions", category = "Math", buildDepends = [Dependency "base" (UnionVersionRanges (ThisVersion (Version {versionBranch = [2,0], versionTags = []})) (LaterVersion (Version {versionBranch = [2,0], versionTags = []}))),Dependency "haskell98" AnyVersion], descCabalVersion = AnyVersion, buildType = Custom, library = Just (Library {exposedModules = ["Math.Statistics"], libBuildInfo = BuildInfo {buildable = True, buildTools = [], ccOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], cSources = [], hsSourceDirs = ["src"], otherModules = [], extensions = [], extraLibs = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [(GHC,["-O"])], ghcProfOptions = [], ghcSharedOptions = []}}), executables = [], dataFiles = [], extraSrcFiles = [], extraTmpFiles = []}, withPrograms = [("alex",ConfiguredProgram {programId = "alex", programVersion = Just (Version {versionBranch = [2,1,0], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/alex"}}),("ar",ConfiguredProgram {programId = "ar", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/bin/ar"}}),("ffihugs",ConfiguredProgram {programId = "ffihugs", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/opt/local/bin/ffihugs"}}),("ghc",ConfiguredProgram {programId = "ghc", programVersion = Just (Version {versionBranch = [6,6], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/ghc"}}),("ghc-pkg",ConfiguredProgram {programId = "ghc-pkg", programVersion = Just (Version {versionBranch = [6,6], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/ghc-pkg"}}),("haddock",ConfiguredProgram {programId = "haddock", programVersion = Just (Version {versionBranch = [0,8], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/haddock"}}),("happy",ConfiguredProgram {programId = "happy", programVersion = Just (Version {versionBranch = [1,16], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/happy"}}),("hmake",ConfiguredProgram {programId = "hmake", programVersion = Just (Version {versionBranch = [3,13], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/hmake"}}),("hsc2hs",ConfiguredProgram {programId = "hsc2hs", programVersion = Just (Version {versionBranch = [0,66], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/hsc2hs"}}),("hugs",ConfiguredProgram {programId = "hugs", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/opt/local/bin/hugs"}}),("ld",ConfiguredProgram {programId = "ld", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/bin/ld"}}),("pkg-config",ConfiguredProgram {programId = "pkg-config", programVersion = Just (Version {versionBranch = [0,21], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/opt/local/bin/pkg-config"}}),("ranlib",ConfiguredProgram {programId = "ranlib", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/bin/ranlib"}}),("tar",ConfiguredProgram {programId = "tar", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/bin/tar"}})], withPackageDB = GlobalPackageDB, withVanillaLib = True, withProfLib = False, withSharedLib = False, withProfExe = False, withOptimization = True, withGHCiLib = True, splitObjs = False}
+ _darcs/pristine/hstats.cabal view
@@ -0,0 +1,15 @@+Name:                hstats+Version:             0.1+License:             BSD3+License-file:        LICENSE+Author:              Marshall Beddoe+Copyright:           Copyright (c) 2007, SFTank+category:            Math+synopsis:            Statistical Computing in Haskell+description:         A library of commonly used statistical functions+maintainer:          mbeddoe@<nospam>sftank.net+homepage:            http://www.sftank.net+hs-source-dirs:      src+ghc-options:         -O+exposed-Modules:     Math.Statistics+build-depends:       base>=2.0, haskell98
+ _darcs/pristine/src/Math/Statistics.hs view
@@ -0,0 +1,108 @@+-----------------------------------------------------------------------------+-- Module      : Math.Statistics+-- Copyright   : (c) 2007 SFTank+-- License     : BSD3+--+-- Maintainer  : mbeddoe@<nospam>sftank.net+-- Stability   : experimental+-- Portability : portable+--+-- Description :+--   A collection of commonly used statistical functions.+-----------------------------------------------------------------------------++module Math.Statistics where++import List++-- Arithmetic mean+mean :: (Floating a) => [a] -> a+mean xs = sum xs / (fromIntegral . length) xs++-- Harmonic mean+hmean :: (Floating a) => [a] -> a+hmean xs = fromIntegral (length xs) / (sum $ map (1/) xs)++-- Geometric mean+gmean :: (Floating a) => [a] -> a+gmean xs = (foldr1 (*) xs)**(1 / fromIntegral (length xs))++-- Median+median :: (Floating a, Ord a) => [a] -> a+median x | odd n  = head  $ drop (n `div` 2) x'+         | even n = mean $ take 2 $ drop i x'+                  where i = (length x' `div` 2) - 1+                        x' = sort x+                        n  = length x++-- Modes+-- Returns a sorted list of modes in descending order+modes :: (Ord a) => [a] -> [(Int, a)]+modes xs = sortOn (negate.fst) $ map (\x->(length x, head x)) $ (group.sort) xs+    where+      sortOn :: Ord b => (a -> b) -> [a] -> [a]+      sortOn f = sortBy (\x y -> compare (f x) (f y))++-- Range+range :: (Num a, Ord a) => [a] -> a+range xs = maximum xs - minimum xs++-- Average deviation+avgdev :: (Floating a) => [a] -> a+avgdev xs = mean $ map (\x -> abs(x - m)) xs+    where+      m = mean xs++-- Standard Deviation+stddev :: (Floating a) => [a] -> a+stddev xs = sqrt $ var xs++-- Population variance+pvar :: (Floating a) => [a] -> a+pvar xs = mean $ map (\x -> (x - m)^2) xs+    where+      m = mean xs++-- Sample variance+var :: (Floating a) => [a] -> a+var xs = (sum $ map (\x -> (x - m)^2) xs) / (fromIntegral (length xs)-1)+    where+      m = mean xs++-- Interquartile range+-- XXX: Add case that takes into account even vs odd length+iqr xs = take (length xs - 2*q) $ drop q xs+    where+      q = ((length xs) + 1) `div` 4++-- Kurtosis+kurtosis :: (Floating b) => [b] -> b+kurtosis xs = sum (map (\x -> ((x - m) / (stddev xs))^4) xs)  / n - 3+    where+      m = mean xs+      n = fromIntegral $ length $ xs++-- Skew+skew :: (Floating a) => [a] -> a+skew xs = mean $ (map (\x -> ((x - (mean xs)) / (stddev xs))^3) xs)++-- Covariance+cov :: (Floating a) => [a] -> [a] -> a+cov xs ys = sum (zipWith (*) (map f1 xs) (map f2 ys)) / (n - 1)+    where+      n = fromIntegral $ length $ xs+      m1 = mean xs+      m2 = mean ys+      f1 = \x -> (x - m1)+      f2 = \x -> (x - m2)++-- Covariance matrix+covm :: (Floating a) => [[a]] -> [[a]]+covm xs =  split' (length xs) cs+    where+      cs = [ cov a b | a <- xs, b <- xs]+      split' n = unfoldr (\y -> if null y then Nothing else Just $ splitAt n y)++-- Pearson's product-moment correlation coefficient+corr :: (Floating a) => [a] -> [a] -> a+corr x y = cov x y / (stddev x * stddev y)
+ dist/build/HShstats-0.1.o view

binary file changed (absent → 23984 bytes)

+ dist/build/Math/Statistics.hi view

binary file changed (absent → 10802 bytes)

+ dist/build/Math/Statistics.o view

binary file changed (absent → 28168 bytes)

+ dist/build/Math/Stats.hi view

binary file changed (absent → 10316 bytes)

+ dist/build/Math/Stats.o view

binary file changed (absent → 26836 bytes)

+ dist/build/autogen/Paths_hstats.hs view
@@ -0,0 +1,26 @@+module Paths_hstats (+	version,+	getBinDir, getLibDir, getDataDir, getLibexecDir,+	getDataFileName+	) where++import Data.Version++version :: Version+version = Version {versionBranch = [0,1], versionTags = []}++bindir, libdir, datadir, libexecdir :: FilePath++bindir     = "/usr/local/bin"+libdir     = "/usr/local/lib/hstats-0.1/ghc-6.6"+datadir    = "/usr/local/share/hstats-0.1"+libexecdir = "/usr/local/libexec"++getBinDir, getLibDir, getDataDir, getLibexecDir :: IO FilePath+getBinDir = return bindir+getLibDir = return libdir+getDataDir = return datadir+getLibexecDir = return libexecdir++getDataFileName :: FilePath -> IO FilePath+getDataFileName name = return (datadir ++ "/" ++ name)
+ dist/build/libHShstats-0.1.a view

binary file changed (absent → 31096 bytes)

+ dist/installed-pkg-config view
@@ -0,0 +1,29 @@+name: hstats+version: 0.1+license: BSD3+copyright: Copyright (c) 2007, SFTank+maintainer: mbeddoe@<nospam>sftank.net+stability:+homepage: http://www.sftank.net+package-url:+description: A library of commonly used statistical functions+category: Math+author: Marshall Beddoe+exposed: True+exposed-modules: Math.Statistics+hidden-modules:+import-dirs: /usr/local/lib/hstats-0.1/ghc-6.6+library-dirs: /usr/local/lib/hstats-0.1/ghc-6.6+hs-libraries: HShstats-0.1+extra-libraries:+extra-ghci-libraries:+include-dirs:+includes:+depends: base-2.0 haskell98-1.0+hugs-options:+cc-options:+ld-options:+framework-dirs:+frameworks:+haddock-interfaces: /usr/local/share/doc/hstats-0.1/html/hstats/hstats.haddock+haddock-html: /usr/local/share/doc/hstats-0.1/html/hstats
+ dist/setup-config view
@@ -0,0 +1,1 @@+LocalBuildInfo {installDirTemplates = InstallDirTemplates {prefixDirTemplate = "/usr/local", binDirTemplate = "$prefix/bin", libDirTemplate = "$prefix/lib", libSubdirTemplate = "$pkgid/$compiler", libexecDirTemplate = "$prefix/libexec", progDirTemplate = "$libdir/hugs/programs", includeDirTemplate = "$libdir/$libsubdir/include", dataDirTemplate = "$prefix/share", dataSubdirTemplate = "$pkgid", docDirTemplate = "$datadir/doc/$pkgid", htmlDirTemplate = "$docdir/html"}, compiler = Compiler {compilerFlavor = GHC, compilerId = PackageIdentifier {pkgName = "ghc", pkgVersion = Version {versionBranch = [6,6], versionTags = []}}, compilerExtensions = [(OverlappingInstances,"-fallow-overlapping-instances"),(TypeSynonymInstances,"-fglasgow-exts"),(TemplateHaskell,"-fth"),(ForeignFunctionInterface,"-fffi"),(NoMonomorphismRestriction,"-fno-monomorphism-restriction"),(UndecidableInstances,"-fallow-undecidable-instances"),(IncoherentInstances,"-fallow-incoherent-instances"),(Arrows,"-farrows"),(Generics,"-fgenerics"),(NoImplicitPrelude,"-fno-implicit-prelude"),(ImplicitParams,"-fimplicit-params"),(CPP,"-cpp"),(BangPatterns,"-fbang-patterns"),(KindSignatures,"-fglasgow-exts"),(RecursiveDo,"-fglasgow-exts"),(ParallelListComp,"-fglasgow-exts"),(MultiParamTypeClasses,"-fglasgow-exts"),(FunctionalDependencies,"-fglasgow-exts"),(Rank2Types,"-fglasgow-exts"),(RankNTypes,"-fglasgow-exts"),(PolymorphicComponents,"-fglasgow-exts"),(ExistentialQuantification,"-fglasgow-exts"),(ScopedTypeVariables,"-fglasgow-exts"),(FlexibleContexts,"-fglasgow-exts"),(FlexibleInstances,"-fglasgow-exts"),(EmptyDataDecls,"-fglasgow-exts"),(PatternGuards,"-fglasgow-exts"),(GeneralizedNewtypeDeriving,"-fglasgow-exts"),(MagicHash,"-fglasgow-exts")]}, buildDir = "dist/build", scratchDir = "dist/scratch", packageDeps = [PackageIdentifier {pkgName = "base", pkgVersion = Version {versionBranch = [2,0], versionTags = []}},PackageIdentifier {pkgName = "haskell98", pkgVersion = Version {versionBranch = [1,0], versionTags = []}}], localPkgDescr = PackageDescription {package = PackageIdentifier {pkgName = "hstats", pkgVersion = Version {versionBranch = [0,1], versionTags = []}}, license = BSD3, licenseFile = "LICENSE", copyright = "Copyright (c) 2007, SFTank", maintainer = "mbeddoe@<nospam>sftank.net", author = "Marshall Beddoe", stability = "", testedWith = [], homepage = "http://www.sftank.net", pkgUrl = "", synopsis = "Statistical Computing in Haskell", description = "A library of commonly used statistical functions", category = "Math", buildDepends = [Dependency "base" (UnionVersionRanges (ThisVersion (Version {versionBranch = [2,0], versionTags = []})) (LaterVersion (Version {versionBranch = [2,0], versionTags = []}))),Dependency "haskell98" AnyVersion], descCabalVersion = AnyVersion, buildType = Custom, library = Just (Library {exposedModules = ["Math.Statistics"], libBuildInfo = BuildInfo {buildable = True, buildTools = [], ccOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], cSources = [], hsSourceDirs = ["src"], otherModules = [], extensions = [], extraLibs = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [(GHC,["-O"])], ghcProfOptions = [], ghcSharedOptions = []}}), executables = [], dataFiles = [], extraSrcFiles = [], extraTmpFiles = []}, withPrograms = [("alex",ConfiguredProgram {programId = "alex", programVersion = Just (Version {versionBranch = [2,1,0], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/alex"}}),("ar",ConfiguredProgram {programId = "ar", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/bin/ar"}}),("ffihugs",ConfiguredProgram {programId = "ffihugs", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/opt/local/bin/ffihugs"}}),("ghc",ConfiguredProgram {programId = "ghc", programVersion = Just (Version {versionBranch = [6,6], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/ghc"}}),("ghc-pkg",ConfiguredProgram {programId = "ghc-pkg", programVersion = Just (Version {versionBranch = [6,6], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/ghc-pkg"}}),("haddock",ConfiguredProgram {programId = "haddock", programVersion = Just (Version {versionBranch = [0,8], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/haddock"}}),("happy",ConfiguredProgram {programId = "happy", programVersion = Just (Version {versionBranch = [1,16], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/happy"}}),("hmake",ConfiguredProgram {programId = "hmake", programVersion = Just (Version {versionBranch = [3,13], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/hmake"}}),("hsc2hs",ConfiguredProgram {programId = "hsc2hs", programVersion = Just (Version {versionBranch = [0,66], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/local/bin/hsc2hs"}}),("hugs",ConfiguredProgram {programId = "hugs", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/opt/local/bin/hugs"}}),("ld",ConfiguredProgram {programId = "ld", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/bin/ld"}}),("pkg-config",ConfiguredProgram {programId = "pkg-config", programVersion = Just (Version {versionBranch = [0,21], versionTags = []}), programArgs = [], programLocation = FoundOnSystem {locationPath = "/opt/local/bin/pkg-config"}}),("ranlib",ConfiguredProgram {programId = "ranlib", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/bin/ranlib"}}),("tar",ConfiguredProgram {programId = "tar", programVersion = Nothing, programArgs = [], programLocation = FoundOnSystem {locationPath = "/usr/bin/tar"}})], withPackageDB = GlobalPackageDB, withVanillaLib = True, withProfLib = False, withSharedLib = False, withProfExe = False, withOptimization = True, withGHCiLib = True, splitObjs = False}
+ hstats.cabal view
@@ -0,0 +1,15 @@+Name:                hstats+Version:             0.1+License:             BSD3+License-file:        LICENSE+Author:              Marshall Beddoe+Copyright:           Copyright (c) 2007, SFTank+category:            Math+synopsis:            Statistical Computing in Haskell+description:         A library of commonly used statistical functions+maintainer:          mbeddoe@<nospam>sftank.net+homepage:            http://www.sftank.net+hs-source-dirs:      src+ghc-options:         -O+exposed-Modules:     Math.Statistics+build-depends:       base>=2.0, haskell98
+ src/Math/Statistics.hs view
@@ -0,0 +1,108 @@+-----------------------------------------------------------------------------+-- Module      : Math.Statistics+-- Copyright   : (c) 2007 SFTank+-- License     : BSD3+--+-- Maintainer  : mbeddoe@<nospam>sftank.net+-- Stability   : experimental+-- Portability : portable+--+-- Description :+--   A collection of commonly used statistical functions.+-----------------------------------------------------------------------------++module Math.Statistics where++import List++-- Arithmetic mean+mean :: (Floating a) => [a] -> a+mean xs = sum xs / (fromIntegral . length) xs++-- Harmonic mean+hmean :: (Floating a) => [a] -> a+hmean xs = fromIntegral (length xs) / (sum $ map (1/) xs)++-- Geometric mean+gmean :: (Floating a) => [a] -> a+gmean xs = (foldr1 (*) xs)**(1 / fromIntegral (length xs))++-- Median+median :: (Floating a, Ord a) => [a] -> a+median x | odd n  = head  $ drop (n `div` 2) x'+         | even n = mean $ take 2 $ drop i x'+                  where i = (length x' `div` 2) - 1+                        x' = sort x+                        n  = length x++-- Modes+-- Returns a sorted list of modes in descending order+modes :: (Ord a) => [a] -> [(Int, a)]+modes xs = sortOn (negate.fst) $ map (\x->(length x, head x)) $ (group.sort) xs+    where+      sortOn :: Ord b => (a -> b) -> [a] -> [a]+      sortOn f = sortBy (\x y -> compare (f x) (f y))++-- Range+range :: (Num a, Ord a) => [a] -> a+range xs = maximum xs - minimum xs++-- Average deviation+avgdev :: (Floating a) => [a] -> a+avgdev xs = mean $ map (\x -> abs(x - m)) xs+    where+      m = mean xs++-- Standard Deviation+stddev :: (Floating a) => [a] -> a+stddev xs = sqrt $ var xs++-- Population variance+pvar :: (Floating a) => [a] -> a+pvar xs = mean $ map (\x -> (x - m)^2) xs+    where+      m = mean xs++-- Sample variance+var :: (Floating a) => [a] -> a+var xs = (sum $ map (\x -> (x - m)^2) xs) / (fromIntegral (length xs)-1)+    where+      m = mean xs++-- Interquartile range+-- XXX: Add case that takes into account even vs odd length+iqr xs = take (length xs - 2*q) $ drop q xs+    where+      q = ((length xs) + 1) `div` 4++-- Kurtosis+kurtosis :: (Floating b) => [b] -> b+kurtosis xs = sum (map (\x -> ((x - m) / (stddev xs))^4) xs)  / n - 3+    where+      m = mean xs+      n = fromIntegral $ length $ xs++-- Skew+skew :: (Floating a) => [a] -> a+skew xs = mean $ (map (\x -> ((x - (mean xs)) / (stddev xs))^3) xs)++-- Covariance+cov :: (Floating a) => [a] -> [a] -> a+cov xs ys = sum (zipWith (*) (map f1 xs) (map f2 ys)) / (n - 1)+    where+      n = fromIntegral $ length $ xs+      m1 = mean xs+      m2 = mean ys+      f1 = \x -> (x - m1)+      f2 = \x -> (x - m2)++-- Covariance matrix+covm :: (Floating a) => [[a]] -> [[a]]+covm xs =  split' (length xs) cs+    where+      cs = [ cov a b | a <- xs, b <- xs]+      split' n = unfoldr (\y -> if null y then Nothing else Just $ splitAt n y)++-- Pearson's product-moment correlation coefficient+corr :: (Floating a) => [a] -> [a] -> a+corr x y = cov x y / (stddev x * stddev y)