Moment-based parameter estimation and distribution suitability screening.
Provides method-of-moments initial parameter estimates for distributions and a prefilter to screen out distributions that are unsuitable for a given dataset based on sample statistics.
This is used before MLE fitting to quickly eliminate distributions where moment-based estimates yield invalid parameters (e.g., negative shape).
Moment-based parameter estimation and distribution suitability screening. Provides method-of-moments initial parameter estimates for distributions and a prefilter to screen out distributions that are unsuitable for a given dataset based on sample statistics. This is used before MLE fitting to quickly eliminate distributions where moment-based estimates yield invalid parameters (e.g., negative shape).
Set of all distributions supported by the prefilter.
Set of all distributions supported by the prefilter.
(gamma-moment-estimate mean variance)Estimate gamma distribution parameters using method of moments.
Parameters (returned): shape (k) = mean² / variance scale (θ) = variance / mean
Returns nil if estimates are invalid (non-positive mean or variance).
Reference: Johnson, Kotz & Balakrishnan (1994), Ch. 17
Estimate gamma distribution parameters using method of moments. Parameters (returned): shape (k) = mean² / variance scale (θ) = variance / mean Returns nil if estimates are invalid (non-positive mean or variance). Reference: Johnson, Kotz & Balakrishnan (1994), Ch. 17
(inverse-gaussian-moment-estimate mean variance)Estimate inverse Gaussian distribution parameters using method of moments.
Parameters: mu = mean lambda = mean³ / variance
Returns nil if mean is non-positive or variance is non-positive.
Reference: Johnson, Kotz & Balakrishnan (1994), Ch. 15
Estimate inverse Gaussian distribution parameters using method of moments. Parameters: mu = mean lambda = mean³ / variance Returns nil if mean is non-positive or variance is non-positive. Reference: Johnson, Kotz & Balakrishnan (1994), Ch. 15
(lognormal-moment-estimate mean variance)Estimate log-normal distribution parameters using method of moments.
Parameters (log-space): sigma² = log(1 + variance/mean²) mu = log(mean) - sigma²/2
Returns nil if mean is non-positive (log undefined) or variance is negative.
Reference: Johnson, Kotz & Balakrishnan (1994), Ch. 14
Estimate log-normal distribution parameters using method of moments. Parameters (log-space): sigma² = log(1 + variance/mean²) mu = log(mean) - sigma²/2 Returns nil if mean is non-positive (log undefined) or variance is negative. Reference: Johnson, Kotz & Balakrishnan (1994), Ch. 14
(moment-match-prefilter mean variance)(moment-match-prefilter mean variance distributions)Screen distributions for suitability based on sample moments.
Takes sample mean and variance (or computes them from data) and returns a map of distributions with their moment-based parameter estimates. Distributions where moment matching yields invalid parameters are excluded.
Parameters: mean - sample mean variance - sample variance distributions - (optional) set of distributions to check, defaults to all
Returns map from distribution keyword to {:params {...} :suitable? true/false} where :params contains the moment-estimated parameters.
Example: (moment-match-prefilter 100.0 400.0) ;; => {:gamma {:params {:shape 25.0 :scale 4.0} :suitable? true} ;; :lognormal {:params {:mu 4.58 :sigma 0.198} :suitable? true} ;; ...}
(moment-match-prefilter -5.0 10.0) ;; => {:gamma {:params nil :suitable? false} ;; :lognormal {:params nil :suitable? false} ;; ...} ; negative mean makes all distributions unsuitable
Screen distributions for suitability based on sample moments.
Takes sample mean and variance (or computes them from data) and returns
a map of distributions with their moment-based parameter estimates.
Distributions where moment matching yields invalid parameters are excluded.
Parameters:
mean - sample mean
variance - sample variance
distributions - (optional) set of distributions to check, defaults to all
Returns map from distribution keyword to {:params {...} :suitable? true/false}
where :params contains the moment-estimated parameters.
Example:
(moment-match-prefilter 100.0 400.0)
;; => {:gamma {:params {:shape 25.0 :scale 4.0} :suitable? true}
;; :lognormal {:params {:mu 4.58 :sigma 0.198} :suitable? true}
;; ...}
(moment-match-prefilter -5.0 10.0)
;; => {:gamma {:params nil :suitable? false}
;; :lognormal {:params nil :suitable? false}
;; ...} ; negative mean makes all distributions unsuitable(suitable-distributions mean variance)(suitable-distributions mean variance distributions)Return the set of distributions suitable for the given sample statistics.
This is a convenience function that calls moment-match-prefilter and returns only the distribution keywords that are suitable.
Parameters: mean - sample mean variance - sample variance distributions - (optional) set of distributions to check, defaults to all
Returns set of suitable distribution keywords.
Return the set of distributions suitable for the given sample statistics. This is a convenience function that calls moment-match-prefilter and returns only the distribution keywords that are suitable. Parameters: mean - sample mean variance - sample variance distributions - (optional) set of distributions to check, defaults to all Returns set of suitable distribution keywords.
(unsuitable-distributions mean variance)(unsuitable-distributions mean variance distributions)Return the set of distributions unsuitable for the given sample statistics.
This is a convenience function that calls moment-match-prefilter and returns only the distribution keywords that are not suitable.
Parameters: mean - sample mean variance - sample variance distributions - (optional) set of distributions to check, defaults to all
Returns set of unsuitable distribution keywords.
Return the set of distributions unsuitable for the given sample statistics. This is a convenience function that calls moment-match-prefilter and returns only the distribution keywords that are not suitable. Parameters: mean - sample mean variance - sample variance distributions - (optional) set of distributions to check, defaults to all Returns set of unsuitable distribution keywords.
(weibull-moment-estimate mean variance)Estimate Weibull distribution parameters using method of moments.
Uses the coefficient of variation (CV = σ/μ) to estimate the shape parameter via a simple approximation, then derives scale from the mean.
Approximation for shape (valid for CV < 1): k ≈ 1.2 / CV for moderate CV values
For more accurate estimation, uses Newton-Raphson iteration on: CV² = Γ(1+2/k)/Γ²(1+1/k) - 1
Returns nil if mean is non-positive, variance is non-positive, or if CV is too large (> 2, suggesting heavy-tailed distribution).
Reference: Cohen & Whitten (1988), Parameter Estimation in Reliability
Estimate Weibull distribution parameters using method of moments. Uses the coefficient of variation (CV = σ/μ) to estimate the shape parameter via a simple approximation, then derives scale from the mean. Approximation for shape (valid for CV < 1): k ≈ 1.2 / CV for moderate CV values For more accurate estimation, uses Newton-Raphson iteration on: CV² = Γ(1+2/k)/Γ²(1+1/k) - 1 Returns nil if mean is non-positive, variance is non-positive, or if CV is too large (> 2, suggesting heavy-tailed distribution). Reference: Cohen & Whitten (1988), Parameter Estimation in Reliability
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |