fit_gmm

fit_gmm(model, optimizer='BFGS', strategy='Iterative', max_gmm_iterations=0)

Generalized method of moments fit (Bulletin 17C).

Fit a :func:~corehydropy.model_bulletin17c model by the generalized method of moments and return a fit carrying the parameter estimates, the sandwich covariance, and the J-statistic overidentification test. Wraps the shared C++ GeneralizedMethodOfMoments ported from USACE-RMC RMC.BestFit – the same estimator :func:~corehydropy.bulletin17c_analysis builds on. IGMMModel (the interface GMM fits against) has exactly one implementation, Bulletin17CDistribution, so fit_gmm takes only a :func:~corehydropy.model_bulletin17c model; unlike :func:fit_mle/:func:fit_map there is no plain-sequence-plus-distribution convenience path.

Parameters

Name Type Description Default
model Model A :func:~corehydropy.model_bulletin17c object. required
optimizer str One of "BFGS" (matching GeneralizedMethodOfMoments’s own class default), "NelderMead", "Brent", "Powell", "DifferentialEvolution", "MultilevelSingleLinkage". "BFGS"
strategy ('Iterative', 'OneStep', 'TwoStep') GMM estimation strategy. "Iterative"
max_gmm_iterations int Maximum number of GMM iterations; 0 keeps the estimator’s own default cap. 0

Returns

Name Type Description
Fit A fit with .method == "GMM". Bulletin 17C is always just-identified (as many moment conditions as parameters), so .j_stat_pval is structurally None – there is no over-identified case to report a p-value for (see docs/upstream-csharp-issues.md). .gmm_iterations, .converged_within_tolerance, and .optimizer_fallback_count carry the estimator’s own bookkeeping. See :func:quantile_variance for the delta-method variance of a fitted quantile, and :func:fit_diagnostics for leverage/influence diagnostics off a GMM fit.

See Also

fit_mle, fit_map, fit_bayesian, fit_diagnostics, quantile_variance, bulletin17c_analysis

Examples

>>> from corehydropy import fit_gmm, model_bulletin17c, quantile_variance
>>> peaks = [12500, 15300, 8900, 22100, 18700, 14200, 9800, 28500, 17400, 11600]
>>> f = fit_gmm(model_bulletin17c(peaks))
>>> sorted(f.parameters)
>>> quantile_variance(f, 0.01) > 0
True