diff --git a/_darcs/inventory b/_darcs/inventory
deleted file mode 100644
--- a/_darcs/inventory
+++ /dev/null
@@ -1,2 +0,0 @@
-[initial commit.
-mbeddoe@sftank.net**20070918213154] 
diff --git a/_darcs/patches/20070918213154-0e28a-c3676cccf964045a487682ba14406a05656b4001.gz b/_darcs/patches/20070918213154-0e28a-c3676cccf964045a487682ba14406a05656b4001.gz
deleted file mode 100644
Binary files a/_darcs/patches/20070918213154-0e28a-c3676cccf964045a487682ba14406a05656b4001.gz and /dev/null differ
diff --git a/_darcs/patches/pending b/_darcs/patches/pending
deleted file mode 100644
--- a/_darcs/patches/pending
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-}
diff --git a/_darcs/prefs/author b/_darcs/prefs/author
deleted file mode 100644
--- a/_darcs/prefs/author
+++ /dev/null
@@ -1,1 +0,0 @@
-mbeddoe@sftank.net
diff --git a/_darcs/prefs/binaries b/_darcs/prefs/binaries
deleted file mode 100644
--- a/_darcs/prefs/binaries
+++ /dev/null
@@ -1,59 +0,0 @@
-# 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$
diff --git a/_darcs/prefs/boring b/_darcs/prefs/boring
deleted file mode 100644
--- a/_darcs/prefs/boring
+++ /dev/null
@@ -1,49 +0,0 @@
-# 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$
diff --git a/_darcs/prefs/motd b/_darcs/prefs/motd
deleted file mode 100644
--- a/_darcs/prefs/motd
+++ /dev/null
diff --git a/_darcs/pristine/LICENSE b/_darcs/pristine/LICENSE
deleted file mode 100644
--- a/_darcs/pristine/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-* 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.
diff --git a/_darcs/pristine/Setup.hs b/_darcs/pristine/Setup.hs
deleted file mode 100644
--- a/_darcs/pristine/Setup.hs
+++ /dev/null
@@ -1,2 +0,0 @@
-import Distribution.Simple
-main = defaultMain
diff --git a/_darcs/pristine/dist/build/autogen/Paths_hstats.hs b/_darcs/pristine/dist/build/autogen/Paths_hstats.hs
deleted file mode 100644
--- a/_darcs/pristine/dist/build/autogen/Paths_hstats.hs
+++ /dev/null
@@ -1,26 +0,0 @@
-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)
diff --git a/_darcs/pristine/dist/installed-pkg-config b/_darcs/pristine/dist/installed-pkg-config
deleted file mode 100644
--- a/_darcs/pristine/dist/installed-pkg-config
+++ /dev/null
@@ -1,29 +0,0 @@
-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
diff --git a/_darcs/pristine/dist/setup-config b/_darcs/pristine/dist/setup-config
deleted file mode 100644
--- a/_darcs/pristine/dist/setup-config
+++ /dev/null
@@ -1,1 +0,0 @@
-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}
diff --git a/_darcs/pristine/hstats.cabal b/_darcs/pristine/hstats.cabal
deleted file mode 100644
--- a/_darcs/pristine/hstats.cabal
+++ /dev/null
@@ -1,15 +0,0 @@
-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
diff --git a/_darcs/pristine/src/Math/Statistics.hs b/_darcs/pristine/src/Math/Statistics.hs
deleted file mode 100644
--- a/_darcs/pristine/src/Math/Statistics.hs
+++ /dev/null
@@ -1,108 +0,0 @@
------------------------------------------------------------------------------
--- 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)
diff --git a/dist/build/HShstats-0.1.o b/dist/build/HShstats-0.1.o
deleted file mode 100644
Binary files a/dist/build/HShstats-0.1.o and /dev/null differ
diff --git a/dist/build/Math/Statistics.hi b/dist/build/Math/Statistics.hi
deleted file mode 100644
Binary files a/dist/build/Math/Statistics.hi and /dev/null differ
diff --git a/dist/build/Math/Statistics.o b/dist/build/Math/Statistics.o
deleted file mode 100644
Binary files a/dist/build/Math/Statistics.o and /dev/null differ
diff --git a/dist/build/Math/Stats.hi b/dist/build/Math/Stats.hi
deleted file mode 100644
Binary files a/dist/build/Math/Stats.hi and /dev/null differ
diff --git a/dist/build/Math/Stats.o b/dist/build/Math/Stats.o
deleted file mode 100644
Binary files a/dist/build/Math/Stats.o and /dev/null differ
diff --git a/dist/build/autogen/Paths_hstats.hs b/dist/build/autogen/Paths_hstats.hs
deleted file mode 100644
--- a/dist/build/autogen/Paths_hstats.hs
+++ /dev/null
@@ -1,26 +0,0 @@
-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)
diff --git a/dist/build/libHShstats-0.1.a b/dist/build/libHShstats-0.1.a
deleted file mode 100644
Binary files a/dist/build/libHShstats-0.1.a and /dev/null differ
diff --git a/dist/installed-pkg-config b/dist/installed-pkg-config
deleted file mode 100644
--- a/dist/installed-pkg-config
+++ /dev/null
@@ -1,29 +0,0 @@
-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
diff --git a/dist/setup-config b/dist/setup-config
deleted file mode 100644
--- a/dist/setup-config
+++ /dev/null
@@ -1,1 +0,0 @@
-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}
diff --git a/hstats.cabal b/hstats.cabal
--- a/hstats.cabal
+++ b/hstats.cabal
@@ -1,5 +1,5 @@
 Name:                hstats
-Version:             0.1
+Version:             0.2
 License:             BSD3
 License-file:        LICENSE
 Author:              Marshall Beddoe
diff --git a/src/Math/Statistics.hs b/src/Math/Statistics.hs
--- a/src/Math/Statistics.hs
+++ b/src/Math/Statistics.hs
@@ -15,9 +15,9 @@
 
 import List
 
--- Arithmetic mean
-mean :: (Floating a) => [a] -> a
-mean xs = sum xs / (fromIntegral . length) xs
+-- Numerically stable mean
+mean :: Floating a => [a] -> a
+mean = fst.foldr (\x (m,n) -> (m+(x-m) / (fromIntegral $ n + 1), n + 1)) (0,0)
 
 -- Harmonic mean
 hmean :: (Floating a) => [a] -> a
@@ -43,6 +43,13 @@
       sortOn :: Ord b => (a -> b) -> [a] -> [a]
       sortOn f = sortBy (\x y -> compare (f x) (f y))
 
+-- Central moments
+centralMoment xs 1 = 0
+centralMoment xs r = (sum (map (\x -> (x-m)^r) xs)) / n
+    where
+      m = mean xs
+      n = fromIntegral $ length xs
+
 -- Range
 range :: (Num a, Ord a) => [a] -> a
 range xs = maximum xs - minimum xs
@@ -53,21 +60,22 @@
     where
       m = mean xs
 
--- Standard Deviation
+-- 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
+pvar xs = centralMoment xs 2
 
--- Sample variance
-var :: (Floating a) => [a] -> a
-var xs = (sum $ map (\x -> (x - m)^2) xs) / (fromIntegral (length xs)-1)
+-- Numerically stable sample variance
+var xs = (var' 0 0 0 xs) / (fromIntegral $ length xs - 1)
     where
-      m = mean xs
+      var' _ _ s [] = s
+      var' m n s (x:xs) = var' nm (n + 1) (s + delta * (x - nm)) xs
+         where
+           delta = x - m
+           nm = m + delta/(fromIntegral $ n + 1)
 
 -- Interquartile range
 -- XXX: Add case that takes into account even vs odd length
@@ -76,16 +84,17 @@
       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
+kurtosis xs = ((centralMoment xs 4) / (centralMoment xs 2)^2)-3
 
 -- Skew
-skew :: (Floating a) => [a] -> a
-skew xs = mean $ (map (\x -> ((x - (mean xs)) / (stddev xs))^3) xs)
+skew xs = (centralMoment xs 3) / (centralMoment xs 2)**(3/2)
 
+pearsonSkew1 xs = 3 * (mean xs - mo) / stddev xs
+    where
+      mo = snd $ head $ modes xs
+
+pearsonSkew2 xs = 3 * (mean xs - median xs) / stddev xs
+
 -- Covariance
 cov :: (Floating a) => [a] -> [a] -> a
 cov xs ys = sum (zipWith (*) (map f1 xs) (map f2 ys)) / (n - 1)
@@ -97,8 +106,8 @@
       f2 = \x -> (x - m2)
 
 -- Covariance matrix
-covm :: (Floating a) => [[a]] -> [[a]]
-covm xs =  split' (length xs) cs
+covMatrix :: (Floating a) => [[a]] -> [[a]]
+covMatrix 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)
@@ -106,3 +115,4 @@
 -- Pearson's product-moment correlation coefficient
 corr :: (Floating a) => [a] -> [a] -> a
 corr x y = cov x y / (stddev x * stddev y)
+
