merton.core.model¶
MertonModel — sklearn-style orchestrator over the calibration registry.
Classes¶
Configure and apply a Merton calibration. |
Functions¶
|
Functional shortcut: |
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.pdreturns physical PD (requiressharpe_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
- fit(firm: merton.core.firm.Firm) merton.core.result.MertonResult[source]¶
Calibrate the model for
firmand return aMertonResult.
- 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