@hackage / hanalyze-core

Bottom layer of hanalyze: stats, tests, optimisation, MCMC core

Latest0.2.0.1

About

Metadata

  • Last updated , by frenzieddoll
  • License BSD-3-Clause
  • Categories Mathematics
  • Maintained by: frenzieddoll@gmail.com

  • Lottery factor: 0

Links

Installation

Tested Compilers

  1. 9.6.7

Readme

hanalyze-core

The bottom layer of hanalyze — pure numerics with no dataframe and no Bayesian dependency: descriptive statistics, hypothesis tests, distributions, optimisation, and the MCMC abstractions.

It depends only on 10 external packages (base / hmatrix / vector / statistics / containers / mwc-random and friends) and on no other package in this repository. Every upper layer (-frame / -bayes / -models / -design / -viz) goes through it.

Main modules (44 in total)

Statistics (Hanalyze.Stat.*)
Module Role
Stat.Descriptive The single source of truth for univariate descriptive statistics (mean / variance / quantiles / skewness / kurtosis). All upper-layer aggregation delegates here
Stat.Test Unifies the test family behind a single TestResult type (t / Welch / F / χ² / non-parametric / Hotelling T² one- and two-sample / one-way MANOVA)
Stat.Distribution pdf / cdf / quantile / sampling for 40+ distributions
Stat.Effect Effect sizes (Cohen's d / Hedges' g / η² / Cliff's δ)
Stat.Bootstrap / Stat.CV Bootstrap confidence intervals / cross-validation splitters
Stat.MultipleTesting Multiple-comparison correction (Bonferroni / Holm / BH-FDR)
Stat.SPC Statistical process control — variable charts (X̄-R / I-MR), attribute charts (p / np / c / u) and EWMA / CUSUM, with Western Electric / Nelson rules
Stat.GroupComparison Good-vs-bad group comparison (goodVsBad — ranks every variable by Welch's t-test and Cohen's d)
Stat.ClassMetrics Classification metrics (confusion matrix / ROC-AUC / F1)
Optimisation (Hanalyze.Optim.*)
Module Role
Optim.NelderMead Derivative-free simplex method, the default of R's optim(method="Nelder-Mead")
Optim.LBFGS / Optim.GradAscent / Optim.Adam Gradient-based methods
Optim.CMAES / Optim.DifferentialEvolution / Optim.ParticleSwarm / Optim.SimulatedAnnealing Global optimisation
Optim.NSGA / Optim.Pareto Multi-objective optimisation — NSGA-II (Deb et al. 2002) and Pareto-front utilities
Optim.Constrained / Optim.Desirability Augmented-Lagrangian constrained optimisation / desirability scalarisation (Derringer & Suich 1980)
Foundations (MCMC.Core / Model.Core / Math.*)
Module Role
MCMC.Core Sampler-agnostic Chain type and posterior statistics (posteriorMean / posteriorSD / posteriorQuantile). The base for using MCMC.* as a standalone sampling library
Stat.MCMC MCMC diagnostics — rhat / ess / essBulk / hdi / autocorr / bfmi (the samplers themselves live in -bayes)
Model.Core The Result type and Model class shared by every regression model
Math.HSIC / Math.ICA / Math.Hungarian HSIC independence statistic / FastICA (Hyvärinen 1999) / Hungarian assignment

Using it standalone

If you do not need the upper layers, depend on this package directly:

build-depends: hanalyze-core, hmatrix
import qualified Hanalyze.Stat.Test as ST
import qualified Numeric.LinearAlgebra as LA

main = do
  let xs = LA.fromList [12, 14, 13, 15, 17, 11]
      ys = LA.fromList [18, 22, 20, 19, 25, 17]
      result = ST.tTestWelch xs ys ST.TwoSided
  print (ST.trPValue result, ST.trEffect result)
  -- (1.688e-3, Just ("Cohen's d", -2.527))

Normally you would just depend on the umbrella package hanalyze and get all of the above from a single import Hanalyze. Naming a layer directly is only worth it when you want to minimise dependencies.

repository README