Skip to main content

solow_glm/
lib.rs

1//! # solow-glm
2//!
3//! Generalized linear models: exponential-dispersion [`Family`] distributions,
4//! [`Link`] functions, and the [`Glm`] estimator (iteratively reweighted least
5//! squares). Validated against an authoritative reference.
6//!
7//! ```
8//! use ndarray::{array, Array1};
9//! use solow_glm::{Family, Glm};
10//!
11//! // Poisson regression with an intercept.
12//! let x = array![[1.0, 0.0], [1.0, 1.0], [1.0, 2.0], [1.0, 3.0], [1.0, 4.0]];
13//! let y: Array1<f64> = array![1.0, 2.0, 4.0, 7.0, 12.0];
14//! let res = Glm::new(y, x, Family::Poisson).unwrap().fit().unwrap();
15//! assert!(res.converged);
16//! ```
17
18mod family;
19mod glm;
20mod links;
21mod regularized;
22mod tweedie;
23
24pub use family::Family;
25pub use glm::{Glm, GlmResults};
26pub use links::Link;
27pub use regularized::{GammaRegressor, PoissonRegressor, TweedieRegressor};
28pub use tweedie::TweedieGlm;