merton.calibration.covariance

MLE asymptotic standard errors and delta-method propagation.

When a calibrator returns the observed Fisher information (the Hessian of the negative log-likelihood at the MLE), this module turns it into:

  • the asymptotic covariance of the parameter estimates,

  • standard errors and Wald confidence intervals for each parameter,

  • propagated standard errors / CIs for derived quantities (DD, PD, spread) via the delta method.

The delta method gives Var[g(θ)] J · Σ · J^T where J = ∂g/∂θ is the Jacobian of g at θ̂ and Σ is the asymptotic covariance of θ̂.

Classes

ConfInt

Symmetric (or empirical) confidence interval for a single quantity.

Functions

cov_from_hessian(→ numpy.ndarray)

Invert an observed-Fisher-information matrix to a covariance.

standard_errors(→ merton._typing.FloatArray)

Per-parameter standard errors = sqrt(diag(Σ)).

wald_ci(→ ConfInt)

Symmetric Wald CI estimate ± z · se.

delta_method(→ tuple[float, float])

Apply the delta method to a scalar function g of the parameters.

Module Contents

class merton.calibration.covariance.ConfInt[source]

Symmetric (or empirical) confidence interval for a single quantity.

lower: float[source]
upper: float[source]
level: float[source]
method: str[source]
se: float | None = None[source]
as_tuple() tuple[float, float][source]
merton.calibration.covariance.cov_from_hessian(hessian: numpy.ndarray) numpy.ndarray[source]

Invert an observed-Fisher-information matrix to a covariance.

Adds a tiny ridge for numerical stability if the matrix is nearly singular; raises MertonError if it can’t be inverted at all.

merton.calibration.covariance.standard_errors(cov: numpy.ndarray) merton._typing.FloatArray[source]

Per-parameter standard errors = sqrt(diag(Σ)).

merton.calibration.covariance.wald_ci(estimate: float, se: float, *, level: float = 0.95, method: str = 'asymptotic') ConfInt[source]

Symmetric Wald CI estimate ± z · se.

merton.calibration.covariance.delta_method(g: collections.abc.Callable[[numpy.ndarray], float], theta: numpy.ndarray, cov: numpy.ndarray, *, eps: float | None = None) tuple[float, float][source]

Apply the delta method to a scalar function g of the parameters.

Returns (g(theta), se_g) where se_g² = J · Σ · Jᵀ and J is the gradient of g computed by central finite differences.