hanalyze-models: Model layer of hanalyze: regression, ML, survival, causal

[ bsd3, library, machine-learning, math, numeric, statistics ] [ Propose Tags ] [ Report a vulnerability ]

The model layer of the hanalyze toolkit: a model zoo spanning classical regression (LM, GLM, GLMM, robust, quantile, splines, GAM), penalised regression with automatic lambda selection (Lasso Ridge Elastic Net MCP SCAD), the Formula DSL front-end, multivariate analysis (PCA, PLS, LDA / QDA, MDS, clustering), machine learning (random forest, gradient boosting, SVM, k-NN, neural networks), Gaussian processes and multi-output models, time series (VAR, GARCH, state space), survival and reliability (Kaplan-Meier, Cox, AFT, Weibull MLE, accelerated-life models), causal inference (LiNGAM, propensity score, IPW, doubly robust, CATE) and Bayesian optimisation. . Module names match the umbrella package hanalyze, which re-exports everything, so downstream imports stay identical. See README.md for the module map and a standalone usage example.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.2.0.1
Dependencies base (>=4.14 && <5), containers (>=0.6 && <0.8), dataframe-core (>=1.1 && <1.2), hanalyze-bayes (==0.2.0.1), hanalyze-core (==0.2.0.1), hanalyze-frame (==0.2.0.1), hmatrix (>=0.20 && <0.22), megaparsec (>=9.0 && <9.7), mwc-random (>=0.15 && <0.16), parser-combinators (>=1.3 && <1.4), primitive (>=0.7 && <0.10), statistics (>=0.16 && <0.17), text (>=1.2 && <2.2), vector (>=0.12 && <0.14), vector-algorithms (>=0.9 && <0.10) [details]
Tested with ghc ==9.6.7
License BSD-3-Clause
Copyright 2026 Aelysce Project (Toshiaki Honda)
Author Toshiaki Honda
Maintainer frenzieddoll@gmail.com
Uploaded by frenzieddoll at 2026-08-13T05:54:47Z
Category Math, Statistics, Numeric, Machine Learning
Distributions
Reverse Dependencies 3 direct, 2 indirect [details]
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-08-13 [all 1 reports]

Readme for hanalyze-models-0.2.0.1

[back to package description]

hanalyze-models

The model layer of hanalyze. It owns the model zoo — everything from classical regression through machine learning, multivariate analysis, time series, survival/reliability, and causal inference. It is the largest of the six split layers (67 modules).

It depends on the three layers core (numerical foundation) / frame (dataframe interop) / bayes (MCMC), plus 12 external packages. -design (DoE) and -viz sit on top of this layer. It is the only layer that depends on megaparsec, since it owns the Formula DSL parser.

Main modules (67 in total)

Basic regression (Hanalyze.Model.*)

Module Role
Model.LM / Model.LM.Diagnostics Least-squares regression and residual diagnostics (leverage / Cook's distance / VIF)
Model.GLM / Model.GLMM GLM by IRLS (unifying Gaussian / Binomial / Poisson) and mixed-effects GLM
Model.MultiLM Multi-output linear regression
Model.Regularized / Model.RegularizedAdvanced Lasso / Ridge / Elastic Net + MCP / SCAD / Adaptive / Group. λ is auto-selected via k-fold CV plus the 1-SE rule
Model.Robust / Model.Quantile Robust regression via M-estimation / quantile regression
Model.Spline / Model.GAM Spline smoothing / generalized additive models

Formula DSL (Model.Formula.*)

Module Role
Model.Formula Parser and AST for the canonical Formula DSL front-end (y ~ x1 + x2*x3)
Model.Formula.Design / .Frame AST → model matrix, and joining with a dataframe
Model.Formula.Mixed / .Nonlinear / .RFormula Interpretation of mixed-effects / nonlinear terms / R-compatible formulas

Multivariate & dimensionality reduction

Module Role
Model.PCA Principal component analysis (variance maximization, no response)
Model.PLS Partial least squares — maximizes covariance with the response, plus VIP and CV-based component selection
Model.Discriminant Discriminant analysis (LDA = linear boundary / QDA = quadratic boundary)
Model.Multivariate The RRR / PLS / CCA family of multivariate regression
Model.MDS / Model.FDA Multidimensional scaling / functional data analysis
Model.Cluster / Model.HierarchicalCluster / Model.LatentClassAnalysis k-means / hierarchical clustering / latent class analysis

Machine learning

Module Role
Model.RandomForest / Model.RandomForestClassifier Random forest (regression / classification)
Model.DecisionTree / Model.GradientBoosting Decision trees / gradient boosting
Model.SVM / Model.KNN / Model.NaiveBayes / Model.NeuralNetwork SVM / k-nearest neighbors / naive Bayes / NN
Model.Kernel / Model.KernelRegression Kernel function family / kernel regression
Model.PartialDependence Model interpretation via PDP / ICE

Gaussian processes & multi-output

Module Role
Model.GP / Model.GPRobust GP regression (RBF / Matérn / Periodic + ARD) / outlier-robust GP
Model.MultiGP / Model.MultiOutput Multi-output GP / a unified API for multi-output regression
Model.RFF Large-scale GP approximation via Random Fourier Features

Time series

Module Role
Model.TimeSeries Entry point for the ARIMA family
Model.VAR / Model.GARCH / Model.StateSpace Vector autoregression / GARCH / state-space models (Kalman filter)

Survival & reliability

Module Role
Model.Survival Kaplan-Meier / Cox proportional hazards
Model.AFT / Model.CompetingRisks Accelerated failure time models / competing risks (CIF)
Model.Weibull Weibull MLE (with censoring support) + B_p life + Wald confidence intervals
Model.Reliability Accelerated life testing (Arrhenius / Eyring / Inverse Power Law)
Model.ReliabilityBlockDiagram System reliability for series / parallel / k-of-n configurations

Causal inference

Module Role
Model.LiNGAM.Direct / .ICA / .Pairwise / .Parce Structure estimation using non-Gaussianity (DirectLiNGAM / ICA-LiNGAM, etc.)
Model.LiNGAM.VAR / .Bootstrap / .MultiGroup Time-series variant / bootstrap confidence / simultaneous multi-group estimation
Model.DAG DAG representation and search
Stat.Causal.PropensityScore / .IPW / .DoublyRobust / .CATE Propensity score / IPW / doubly robust estimation / conditional average treatment effect

Miscellaneous

Module Role
Model.FitYByX Equivalent of JMP's "Fit Y by X" — auto-selects a method from the combination of variable types
Stat.ModelSelect Model selection via AIC / BIC
Optim.BayesOpt Bayesian optimization (GP + acquisition function). Placed in this layer because it uses GP

Using it standalone

If you do not need the umbrella package, you can depend on this package directly. Since the FitResult result type lives in the core layer, you also need hanalyze-core explicitly:

build-depends: hanalyze-models, hanalyze-core, hmatrix
import qualified Numeric.LinearAlgebra as LA
import Hanalyze.Model.Core (FitResult (..))
import Hanalyze.Model.LM   (fitLM)

main :: IO ()
main = do
  let x = LA.fromLists [ [1, 1.0], [1, 2.0], [1, 3.0], [1, 4.0], [1, 5.0] ]
      y = LA.fromLists [ [2.1], [3.9], [6.2], [7.8], [10.1] ]
      fit = fitLM x y
  print (LA.toLists (coefficients fit))
  print (LA.toList (rSquared fit))
  -- [[5.000000000000132e-2],[1.9899999999999998]]
  -- [0.9973053289009771]

You must add the intercept column (1) yourself. To build a model matrix from a formula, use Model.Formula.

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 minimize dependencies.

repository README