1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//! High-level crate for Rust-native GAMLSS.
//!
//! `gamlss` re-exports the typed core, ready-made distribution families,
//! spline/predictor building blocks, special functions and target transforms.
//! The primary approach is a low-level typed API through [`core`], [`family`],
//! [`spline`] and [`transform`].
//!
//! When the `formula` feature is enabled, the `formula` namespace is also
//! available. This layer is an experimental optional convenience API: it compiles
//! curated high-level builder specifications into typed core models, but is not
//! the primary API and does not promise to cover all distributions, links and
//! parameterizations from the low-level crates.
//!
//! The `bayes` feature enables normalized coefficient priors and posterior
//! potentials through the `bayes` namespace. It is intentionally disabled by
//! default so non-Bayesian users do not acquire that API surface.
//!
//! The `rand` feature enables the sampling API in [`family`] and corresponds to
//! the `gamlss-family/rand` feature.
//! The `multivariate` feature enables optional multivariate distribution
//! families in [`family`].
//!
//! # Key features
//!
//! - typed [`core::ParameterBlock`] for each distribution parameter;
//! - [`core::ParameterBlocks`] for automatic layout offsets in the common
//! beta vector;
//! - unweighted and weighted models via [`core::Gamlss::try_new`] and
//! [`core::Gamlss::try_new_weighted`];
//! - prediction API for training rows and compatible prediction blocks;
//! - post-fit diagnostics namespace via [`diagnostics`];
//! - optional normalized coefficient priors and posterior potentials with the
//! `bayes` feature;
//! - experimental formula builders via `formula::ModelSpec` when the
//! `formula` feature is enabled.
//!
//! # Example
//!
//! ```
//! use gamlss::prelude::*;
//!
//! let y = [0.0, 1.0, 2.0];
//! let weights = [1.0, 0.5, 1.0];
//!
//! let blocks = ParameterBlocks::try_new((
//! ParameterBlock::<Mu, _, _>::linear(
//! DenseDesign::from_rows(&[[1.0, 0.0], [1.0, 1.0], [1.0, 2.0]]),
//! NoPenalty,
//! 0,
//! ),
//! ParameterBlock::<Sigma, _, _>::linear(
//! DenseDesign::intercept(y.len()),
//! NoPenalty,
//! 0,
//! ),
//! ))?;
//!
//! let model = Gamlss::try_new_weighted(
//! gamlss::family::NormalMuSigma::new(),
//! blocks,
//! &y,
//! &weights,
//! )?;
//!
//! let parameters = model.initial_parameters()?;
//! let fitted_theta = model.predict_theta(¶meters)?;
//! assert_eq!(fitted_theta.len(), y.len());
//! # Ok::<_, gamlss::core::ModelError>(())
//! ```
//!
/// Lightweight Bayesian potentials and normalized coefficient priors.
pub use gamlss_bayes as bayes;
/// Typed core abstractions.
pub use gamlss_core as core;
/// Post-fit diagnostics utilities.
pub use gamlss_diagnostics as diagnostics;
/// Distributions and likelihood implementations.
pub use gamlss_family as family;
/// Special functions and numerical helpers.
pub use gamlss_special as special;
/// Spline bases and penalties.
pub use gamlss_spline as spline;
/// Transform layer for response/target preprocessing.
pub use gamlss_transform as transform;
/// Experimental optional formula/builder layer.
pub use gamlss_formula as formula;
/// Most commonly used imports.