Expand description
Generalized Linear Models (GLM)
This module implements Generalized Linear Models, which extend linear regression to response variables with non-normal distributions.
§Key Components
- Distribution Families: Gaussian, Binomial, Poisson, Gamma, Inverse Gaussian
- Link Functions: Identity, Logit, Log, Inverse, etc.
- IRLS Algorithm: Iteratively Reweighted Least Squares for estimation
- Model Diagnostics: Deviance, Pearson chi-squared, AIC, BIC
§Example Usage
use so_models::glm::{GLM, Family, Link};
use so_core::data::DataFrame;
use so_core::formula::Formula;
// Create a logistic regression model
let model = GLM::new()
.family(Family::Binomial)
.link(Link::Logit)
.intercept(true);
// Example data would be needed to fit the model
// let formula = Formula::parse("y ~ x1 + x2").unwrap();
// let data = DataFrame::from_series(...).unwrap();
// let results = model.fit_formula(&formula, &data).unwrap();§References
- McCullagh, P., & Nelder, J. A. (1989). Generalized Linear Models.
- R’s
glm()function and statsmodels’ GLM implementation.
Re-exports§
pub use family::Family;pub use family::Link;pub use family::is_valid_link;pub use model::GLM;pub use model::GLMModelBuilder;pub use results::GLMResults;