fit_mle() and fit_map() fits get profile-likelihood confidence intervals; a fit_bayesian()
fit gets posterior credible intervals. fit_gmm() has no interval surface (see below).
Usage
# S3 method for class 'corehydro_fit'
confint(object, parm, level = 0.95, ...)Arguments
- object
a
corehydro_fitfromfit_mle(),fit_map(), orfit_bayesian().- parm
optional subset of parameters (by name or position); every parameter by default.
- level
confidence (MLE/MAP) or credible (Bayesian) level.
- ...
unused; present for generic consistency.
Details
For fit_mle()/fit_map(): when the fit already carries a profile block at the requested
level (built with fit_mle(..., profile = TRUE) or a prior confint() call), those bounds are
reused; otherwise the identical fit is re-run with profiling turned on, following the
lazy-rebuild precedent of ch_estimation_bic_ (corehydror/src/estimation.cpp) – a
deterministic optimizer reproduces the identical point estimate, so the rebuild's confidence
intervals are the ones the original fit would have carried had profile = TRUE been requested
at the matching level up front.
For fit_bayesian(): $summary's lower/upper columns are already the posterior credible
interval at the fit's own $credible_level (the credible_level argument, 0.9 by default).
When the requested level matches, those columns are returned directly; otherwise the
identical seeded chain is re-run with credible_interval_width set to level (the same
lazy-rebuild precedent as the profile path above – re-sampling with an identical seed
reproduces the same chain bit-for-bit, so only the post-hoc credible-interval quantile
computation changes). Because confint()'s own default is 0.95 (the base R confint
convention) and a fit's default is 0.9, a bare confint(f) on a Bayesian fit re-runs the
chain; fit_bayesian(..., credible_level = 0.95) avoids that.
fit_gmm() is method-of-moments and has no likelihood or posterior to draw an interval from;
calling confint() on one errors. Use quantile_variance() for the delta-method variance of a
fitted quantile instead.
Examples
peaks <- c(12500, 15300, 8900, 22100, 18700, 14200, 9800, 28500, 17400, 11600)
f <- fit_mle(model_univariate("Normal", peaks))
confint(f, level = 0.9)
#> lower upper
#> Mean (µ) 12926.295 18873.705
#> Std Dev (σ) 4119.201 8691.657