merton.core.result¶
MertonResult — the frozen container returned by every fit.
The result captures the calibrated state (asset_value, asset_vol) plus
derived quantities (DD, PD). Heavy derived outputs (Greeks, term structures,
confidence intervals, summaries) are lazy methods so callers only pay for what
they need.
Classes¶
The output of fitting a single firm. |
Module Contents¶
- class merton.core.result.MertonResult[source]¶
The output of fitting a single firm.
- asset_value, asset_vol
Calibrated firm asset value and asset volatility.
- n_iter, converged
Diagnostics from the solver.
- log_likelihood, covariance_, residuals_
Statistical output for MLE methods (
Nonefor others).
- covariance_: numpy.ndarray | None = None[source]¶
- residuals_: numpy.ndarray | None = None[source]¶
- classmethod from_calibration(firm: merton.core.firm.Firm, asset_value: float | merton._typing.FloatArray, asset_vol: float, *, method: str, asset_drift: float | None = None, n_iter: int = 0, converged: bool = True, log_likelihood: float | None = None, covariance: numpy.ndarray | None = None, residuals: numpy.ndarray | None = None, diagnostics: dict[str, Any] | None = None) MertonResult[source]¶
- pd_term_structure(horizons: merton._typing.ArrayLike = (1 / 12, 3 / 12, 6 / 12, 1.0, 3.0, 5.0)) pandas.DataFrame[source]¶
Return a DataFrame of (horizon, DD, PD) across multiple horizons.
- implied_spread(lgd: float = 0.6, *, in_bps: bool = True) float | merton._typing.FloatArray[source]¶
Implied credit spread (bps by default) at
firm.horizon.
- physical_pd(sharpe_ratio: float) float | merton._typing.FloatArray[source]¶
Convert risk-neutral PD to physical PD using the supplied Sharpe ratio.
- confidence_interval(level: float = 0.95, method: str = 'asymptotic', *, quantities: tuple[str, Ellipsis] = ('asset_vol', 'asset_drift', 'dd', 'pd')) dict[str, Any][source]¶
Confidence intervals for fitted parameters and derived quantities.
- Parameters:
level – Confidence level (e.g. 0.95).
method –
"asymptotic"uses the MLE observed Fisher information (requirescovariance_to be set, e.g. frommethod='duan_mle')."bootstrap"uses theBootstrapResultstashed indiagnostics_['bootstrap'](requiresMertonModel(n_bootstrap=...)).quantities – Names to report. Supported:
"asset_vol","asset_drift","dd","pd".
- greeks() merton.greeks.equity.GreeksResult[source]¶
Compute all closed-form Greeks at the calibrated operating point.
- to_pandas() pandas.DataFrame[source]¶
Single-row DataFrame summarising the fit.