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

MertonResult

The output of fitting a single firm.

Module Contents

class merton.core.result.MertonResult[source]

The output of fitting a single firm.

firm[source]

The input Firm.

asset_value, asset_vol

Calibrated firm asset value and asset volatility.

asset_drift[source]

Calibrated drift (only set by MLE/time-series methods).

default_point[source]

Resolved default threshold from the firm’s chosen formula.

dd[source]

Distance-to-default at firm.horizon.

pd[source]

Risk-neutral probability of default at firm.horizon.

method[source]

Name of the calibrator used.

n_iter, converged

Diagnostics from the solver.

log_likelihood, covariance_, residuals_

Statistical output for MLE methods (None for others).

diagnostics_[source]

Free-form bag of solver-specific telemetry.

firm: merton.core.firm.Firm[source]
asset_value: float | merton._typing.FloatArray[source]
asset_vol: float[source]
asset_drift: float | None = None[source]
default_point: float | merton._typing.FloatArray[source]
dd: float[source]
pd: float[source]
dd_series: merton._typing.FloatArray | None = None[source]
pd_series: merton._typing.FloatArray | None = None[source]
asset_value_series: merton._typing.FloatArray | None = None[source]
method: str = 'unknown'[source]
n_iter: int = 0[source]
converged: bool = True[source]
log_likelihood: float | None = None[source]
covariance_: numpy.ndarray | None = None[source]
residuals_: numpy.ndarray | None = None[source]
diagnostics_: dict[str, Any][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 (requires covariance_ to be set, e.g. from method='duan_mle'). "bootstrap" uses the BootstrapResult stashed in diagnostics_['bootstrap'] (requires MertonModel(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_dict() dict[str, Any][source]
to_pandas() pandas.DataFrame[source]

Single-row DataFrame summarising the fit.

to_polars() Any[source]

Return the result as a Polars DataFrame (requires polars installed).

to_excel(path: str, *, sheet: str = 'Merton') None[source]

Write the result to an Excel workbook.

summary() str[source]