merton.extensions.longstaff_schwartz¶
Longstaff-Schwartz (1995) two-factor structural model.
Generalises Merton by letting the risk-free rate evolve stochastically
under a Vasicek process. Asset value V_t follows GBM and the short
rate r_t follows mean-reverting Ornstein-Uhlenbeck:
Default occurs at the first time V_t hits a constant barrier K in
[0, T]. Allowing stochastic rates widens credit spreads in regimes
where \mathrm{Corr}(\Delta r, \Delta V) < 0 — when rates spike,
asset values fall, pushing the firm closer to its barrier.
Implementation¶
Closed-form PDs only exist for special parameter combinations. The
practical path is Monte Carlo simulation of correlated
(V_t, r_t) paths with first-passage tracking. We expose
longstaff_schwartz_pd_mc() for the MC estimator and
LongstaffSchwartzModel for a calibrated single-firm fit.
References
Longstaff, F. A., Schwartz, E. S. (1995). A Simple Approach to Valuing Risky Fixed and Floating Rate Debt. Journal of Finance 50 (3), 789-819.
Classes¶
Vasicek short-rate parametrisation: |
|
Calibrated single-firm Longstaff-Schwartz model. |
Functions¶
|
Monte Carlo first-passage PD over |
|
Closed-form first-passage PD under the zero-correlation special |
Module Contents¶
- class merton.extensions.longstaff_schwartz.VasicekParams[source]¶
Vasicek short-rate parametrisation:
dr = κ(θ - r) dt + η dW.
- merton.extensions.longstaff_schwartz.longstaff_schwartz_pd_mc(*, asset_value: float, asset_vol: float, barrier: float, T: float, vasicek: VasicekParams, correlation: float = 0.0, dividend_yield: float = 0.0, n_paths: int = 50000, n_steps: int = 252, seed: int | None = None) tuple[float, float][source]¶
Monte Carlo first-passage PD over
[0, T].- Returns:
The MC point estimate and its standard error (≈
\sqrt{p(1-p)/N}).- Return type:
pd, stderr
- merton.extensions.longstaff_schwartz.longstaff_schwartz_pd_analytic(*, asset_value: float, asset_vol: float, barrier: float, T: float, vasicek: VasicekParams, dividend_yield: float = 0.0) float[source]¶
Closed-form first-passage PD under the zero-correlation special case: rates and asset value are independent, so the Vasicek rate process only matters for discounting (not for the default trigger). This reduces to the standard Black-Cox formula with a deterministic drift equal to the unconditional mean of
r_t.
- class merton.extensions.longstaff_schwartz.LongstaffSchwartzModel(*, vasicek: VasicekParams, correlation: float = 0.0, mc_paths: int = 20000, mc_steps: int = 252, mc_seed: int | None = None, tol: float = 1e-08, max_iter: int = 200)[source]¶
Bases:
merton.extensions.base.StructuralModelCalibrated single-firm Longstaff-Schwartz model.
Inputs the user supplies on top of the
Firm:vasicek— short-rate parametrisation.correlation— between asset and rate shocks.mc_paths,mc_steps,mc_seed— Monte Carlo controls.
- fit(firm: merton.core.firm.Firm) merton.extensions.base.StructuralResult[source]¶
Return a
StructuralResultforfirm.