Skip to main content

stats_claw/distributions/
types.rs

1//! Plain-data parameter structs for the library's statistical constructs.
2//!
3//! Each struct carries only the parameters (and any descriptive string fields)
4//! that identify a construct; all numerics live in the behaviour traits and
5//! inherent methods implemented for these types in the sibling modules. The
6//! structs derive `Default` so callers build them with struct-update syntax and
7//! set only the fields they care about.
8//!
9//! This file is produced mechanically by the `carve` tool from the source
10//! project; edit the carve inputs rather than this file.
11
12/// Beta distribution on a bounded support with two shape parameters.
13#[derive(Debug, Clone, Default)]
14pub struct BetaDistribution {
15    /// Alpha shape parameter.
16    pub alpha_parameter: f64,
17    /// Beta shape parameter.
18    pub beta_parameter: f64,
19    /// Lower bound of distribution support.
20    pub support_lower_bound: f64,
21    /// Upper bound of distribution support.
22    pub support_upper_bound: f64,
23    /// Unique name identifying a distribution.
24    pub distribution_name: String,
25    /// Free-text description.
26    pub description: String,
27}
28
29/// Distribution of successes over a fixed number of Bernoulli trials.
30#[derive(Debug, Clone, Default)]
31pub struct BinomialDistribution {
32    /// Number of trials.
33    pub number_of_trials: i64,
34    /// Probability of success per trial.
35    pub success_probability: f64,
36    /// Unique name identifying a distribution.
37    pub distribution_name: String,
38    /// Free-text description.
39    pub description: String,
40}
41
42/// Heavy-tailed distribution with location and scale and undefined mean.
43#[derive(Debug, Clone, Default)]
44pub struct CauchyDistribution {
45    /// Location parameter.
46    pub location: f64,
47    /// Scale parameter.
48    pub scale: f64,
49    /// Unique name identifying a distribution.
50    pub distribution_name: String,
51    /// Free-text description.
52    pub description: String,
53}
54
55/// Chi-squared distribution parameterized by degrees of freedom.
56#[derive(Debug, Clone, Default)]
57pub struct ChiSquaredDistribution {
58    /// Degrees of freedom.
59    pub degrees_of_freedom: i64,
60    /// Unique name identifying a distribution.
61    pub distribution_name: String,
62    /// Free-text description.
63    pub description: String,
64}
65
66/// Distribution of waiting times at a constant rate.
67#[derive(Debug, Clone, Default)]
68pub struct ExponentialDistribution {
69    /// Rate parameter.
70    pub rate_parameter: f64,
71    /// Unique name identifying a distribution.
72    pub distribution_name: String,
73    /// Free-text description.
74    pub description: String,
75}
76
77/// F distribution parameterized by numerator and denominator degrees of
78#[derive(Debug, Clone, Default)]
79pub struct FDistribution {
80    /// Numerator degrees of freedom.
81    pub numerator_df: i64,
82    /// Denominator degrees of freedom.
83    pub denominator_df: i64,
84    /// Unique name identifying a distribution.
85    pub distribution_name: String,
86    /// Free-text description.
87    pub description: String,
88}
89
90/// Gamma distribution with shape and scale parameters.
91#[derive(Debug, Clone, Default)]
92pub struct GammaDistribution {
93    /// Shape parameter.
94    pub shape_parameter: f64,
95    /// Scale parameter.
96    pub scale_parameter: f64,
97    /// Unique name identifying a distribution.
98    pub distribution_name: String,
99    /// Free-text description.
100    pub description: String,
101}
102
103/// Double-exponential distribution with location and scale.
104#[derive(Debug, Clone, Default)]
105pub struct LaplaceDistribution {
106    /// Location parameter.
107    pub location: f64,
108    /// Scale parameter.
109    pub scale: f64,
110    /// Unique name identifying a distribution.
111    pub distribution_name: String,
112    /// Free-text description.
113    pub description: String,
114}
115
116/// Distribution whose logarithm is normally distributed.
117#[derive(Debug, Clone, Default)]
118pub struct LogNormalDistribution {
119    /// Mean of the log values.
120    pub mean_log_value: f64,
121    /// Standard deviation of the log values.
122    pub std_log_value: f64,
123    /// Unique name identifying a distribution.
124    pub distribution_name: String,
125    /// Free-text description.
126    pub description: String,
127}
128
129/// Gaussian distribution parameterized by mean and standard deviation.
130#[derive(Debug, Clone, Default)]
131pub struct NormalDistribution {
132    /// Mean parameter of a distribution.
133    pub mean: f64,
134    /// Standard deviation parameter.
135    pub standard_deviation: f64,
136    /// Variance parameter.
137    pub variance: f64,
138    /// Named parameterization scheme.
139    pub parameterization: String,
140    /// Unique name identifying a distribution.
141    pub distribution_name: String,
142    /// Free-text description.
143    pub description: String,
144}
145
146/// Distribution of event counts at a fixed rate.
147#[derive(Debug, Clone, Default)]
148pub struct PoissonDistribution {
149    /// Rate parameter.
150    pub rate_parameter: f64,
151    /// Unique name identifying a distribution.
152    pub distribution_name: String,
153    /// Free-text description.
154    pub description: String,
155}
156
157/// Student t distribution parameterized by degrees of freedom.
158#[derive(Debug, Clone, Default)]
159pub struct TDistribution {
160    /// Degrees of freedom.
161    pub degrees_of_freedom: i64,
162    /// Unique name identifying a distribution.
163    pub distribution_name: String,
164    /// Free-text description.
165    pub description: String,
166}
167
168/// Uniform distribution over a bounded interval.
169#[derive(Debug, Clone, Default)]
170pub struct UniformDistribution {
171    /// Lower bound value.
172    pub lower_bound: f64,
173    /// Upper bound value.
174    pub upper_bound: f64,
175    /// Unique name identifying a distribution.
176    pub distribution_name: String,
177    /// Free-text description.
178    pub description: String,
179}
180
181/// Weibull distribution with shape and scale parameters.
182#[derive(Debug, Clone, Default)]
183pub struct WeibullDistribution {
184    /// Shape parameter.
185    pub shape_parameter: f64,
186    /// Scale parameter.
187    pub scale_parameter: f64,
188    /// Unique name identifying a distribution.
189    pub distribution_name: String,
190    /// Free-text description.
191    pub description: String,
192}