Previous: Analyses Overview | Technical Reference | Next: Univariate Analysis
FittingAnalysis is a screening analysis: it fits the fifteen configured distribution families independently by maximum likelihood and reports AIC, BIC, and a plotting-position RMSE for each successful fit. It does not perform Bayesian updating, quantify model-form uncertainty, or establish that the lowest-criterion family is physically correct. Its defensible use is to identify plausible candidates for the fuller analyses described in Univariate Analysis.
The default DistributionList contains Exponential, Gamma, Generalized Extreme Value, Generalized Logistic, Generalized Normal, Generalized Pareto, Gumbel, Kappa Four, Ln-Normal, Logistic, Log-Normal, Log-Pearson Type III, Normal, Pearson Type III, and Weibull, in that order. The list contents are mutable, so a caller may screen a scientifically justified subset. The analysis creates one FittedDistribution result per configured candidate.
The input is a complete DataFrame. Exact, uncertain, interval-censored, and perception-threshold records therefore enter through the likelihood in Data Frame and Observation Likelihood; this is not an exact-data-only fit.
Let candidate family
FittingAnalysis constructs a UnivariateDistribution, applies its data-derived defaults and bounds, disables the optional Jeffreys scale term, and invokes MaximumLikelihood with OptimizationMethod.DifferentialEvolution. The optimizer receives DataLogLikelihood, not LogLikelihood, so parameter and quantile priors are excluded. For this workflow, Hessian computation is disabled, the iteration limit is 10,000, and the function-evaluation limit is 100,000. A successful optimizer status is necessary but not sufficient for a published result: AIC and BIC must be finite. RMSE is unavailable (NaN) when the number of plotted observations does not exceed the fitted parameter count; this does not discard an otherwise successful fit.
Each candidate is fitted in a separate Parallel.For iteration. A failure in one family is caught and stored in that candidate's ErrorMessage; it does not abort the remaining fits. IsEstimated is true when at least one candidate has FitSucceeded == true. Partial success therefore produces a usable screening result, while an all-failed run leaves IsEstimated false and reports an unsuccessful completion event. Reviewers should inspect each candidate because the outer flag does not imply that every family fitted successfully.
For
and
where DataFrame.TotalRecordLength() supplies
For exact, uncertain, and interval records, FittingAnalysis pairs each stored representative value
The Numerics helper includes all
Neither AIC nor BIC measures tail plausibility, structural adequacy, or compliance with a regulatory method. RMSE is in the units of the modeled variable and therefore cannot be compared across differently scaled datasets.
The following code is compiled as part of RMC.BestFit.Tests. It validates the configuration, runs all configured candidates, removes failures, and orders successful fits by AIC.
private static async Task<IReadOnlyList<FittedDistribution>> FitCandidateFamilies(
global::RMC.BestFit.Models.DataFrame dataFrame)
{
var analysis = new FittingAnalysis(dataFrame);
var validation = analysis.Validate();
if (!validation.IsValid)
{
throw new InvalidOperationException(
string.Join(Environment.NewLine, validation.ValidationMessages));
}
await analysis.RunAsync();
return analysis.FittedDistributions
.Where(result => result.FitSucceeded)
.OrderBy(result => result.AIC)
.ToArray();
}For flood-frequency practice, screen only families whose support and tail behavior are compatible with the phenomenon. Compare high-return-period quantiles and parameter-bound proximity, not merely the first row of an AIC sort. A narrow AIC difference is not evidence that extrapolated quantiles are practically interchangeable.
RunAsync validates the data frame and probability ordinates, raises the preview event, creates a cancellation token, clears prior results, and starts the parallel fits. Cancellation prevents queued iterations from starting and prevents completed iterations from being stored after the token is observed. The completion event distinguishes cancellation, success, and an outer exception.
Changing the data frame clears fits. Changing ProbabilityOrdinates does not refit because those ordinates are consumed by presentation rather than the MLE. ToXElement() stores the ordinates, outer estimated flag, and each FittedDistribution; the raw data frame remains external and must be supplied to the deserializing constructor.
- All candidates are optimized inside their configured finite parameter bounds. A solution at a bound warrants scrutiny.
- Differential evolution is stochastic. A single successful run does not rule out another optimum; repeat difficult fits or use an independently configured estimator.
- Representative values for uncertain and interval observations are used only in the RMSE display statistic; the likelihood itself integrates or intervals over those observations.
- Perception-threshold counts affect the likelihood and effective record length but do not enter the plotting-position RMSE vector.
- The family list includes highly flexible models. Information criteria penalize parameter count but do not protect against scientifically implausible tail extrapolation.
- The verification report distinguishes analytical formula checks, independent fitted optima, synthetic recovery, and published examples. These are different forms of evidence.
| Concern | Implementation |
|---|---|
| Candidate orchestration | Analyses/DistributionFitting/FittingAnalysis.cs |
| Result DTO and XML | Models/DistributionFitting/FittedDistribution.cs |
| MLE objective and status | Estimation/MaximumLikelihood.cs |
| Family likelihoods | Models/UnivariateDistribution/UnivariateDistribution.cs |
| AIC, BIC, RMSE helpers | Numerics/Data/Statistics/GoodnessOfFit.cs |
| Documentation compile gate | RMC.BestFit.Tests/Documentation/TechnicalReferenceDocumentationTests.cs |
The existing computational verification project contains family-specific estimator comparisons, but it is intentionally not executed by the documentation gate. See the distribution verification matrix for the evidence map.
[1] H. Akaike, “A new look at the statistical model identification,” IEEE Transactions on Automatic Control, vol. 19, no. 6, pp. 716–723, 1974.
[2] G. Schwarz, “Estimating the dimension of a model,” Annals of Statistics, vol. 6, no. 2, pp. 461–464, 1978.
[3] K. P. Burnham and D. R. Anderson, Model Selection and Multimodel Inference, 2nd ed. New York, NY, USA: Springer, 2002.
Previous: Analyses Overview | Technical Reference | Next: Univariate Analysis