merton.core.model

MertonModel — sklearn-style orchestrator over the calibration registry.

Classes

MertonModel

Configure and apply a Merton calibration.

Functions

fit(→ merton.core.result.MertonResult)

Functional shortcut: MertonModel(method=...).fit(firm).

Module Contents

class merton.core.model.MertonModel(*, method: str | None = None, physical_measure: bool = False, sharpe_ratio: float | None = None, tol: float | None = None, max_iter: int | None = None, backend: str | None = None, random_state: int | None = None, n_bootstrap: int = 0, block_length: int | None = None)[source]

Configure and apply a Merton calibration.

Parameters:
  • method – Name of a registered calibrator. Default: "vassalou_xing".

  • physical_measure – If True, result.pd returns physical PD (requires sharpe_ratio).

  • sharpe_ratio – Asset-class Sharpe ratio used for the physical-measure adjustment.

  • tol – Numerical tolerances passed to the underlying calibrator (where the calibrator supports them).

  • max_iter – Numerical tolerances passed to the underlying calibrator (where the calibrator supports them).

  • backend – Force a specific array backend.

  • random_state – Seed for any stochastic component (e.g. bootstrap CIs).

Examples

>>> from merton import Firm, MertonModel
>>> firm = Firm(equity=100, debt_short=20, debt_long=30, equity_vol=0.30)
>>> result = MertonModel(method="jmr_iterative").fit(firm)
>>> result.dd > 0
True
method = 'vassalou_xing'[source]
physical_measure = False[source]
sharpe_ratio = None[source]
tol[source]
max_iter[source]
backend = None[source]
random_state = None[source]
n_bootstrap = 0[source]
block_length = None[source]
fit(firm: merton.core.firm.Firm) merton.core.result.MertonResult[source]

Calibrate the model for firm and return a MertonResult.

get_params(deep: bool = True) dict[str, Any][source]

Return the configured hyper-parameters.

set_params(**params: Any) MertonModel[source]
merton.core.model.fit(firm: merton.core.firm.Firm, *, method: str | None = None, **kwargs: Any) merton.core.result.MertonResult[source]

Functional shortcut: MertonModel(method=...).fit(firm).

Examples

>>> from merton import Firm, fit
>>> firm = Firm(equity=100, debt_short=20, debt_long=30, equity_vol=0.30)
>>> result = fit(firm)
>>> result.dd > 0
True