DynamicNelsonSiegelResult.curve#
- DynamicNelsonSiegelResult.curve(date_index, maturities=None)[source]#
The fitted curve at one date, on any maturity grid.
- Parameters:
- Return type:
- Returns:
Fitted yields at those maturities.
- Raises:
SpecificationError – If a requested maturity is not strictly positive.
Example
A pure-level date prices every maturity at the level; a negative slope makes the curve rise with maturity:
>>> import numpy as np >>> paths = np.tile([5.0, -1.5, 0.0], (30, 1)) >>> res = DynamicNelsonSiegelResult( ... panel=np.zeros((30, 4)), maturities=np.array([1.0, 2.0, 5.0, 10.0]), ... decay=0.6, decay_fixed=True, mu=np.zeros(3), ar=np.full(3, 0.9), ... state_innovation_cov=np.eye(3), measurement_var=np.full(4, 0.01), ... factors=paths, factor_cov=np.tile(np.eye(3), (30, 1, 1)), ... llf=0.0, nobs=30, n_params=16.0, ... ) >>> fine = res.curve(-1, maturities=np.linspace(0.25, 30.0, 50)) >>> fine.shape, bool(np.all(np.diff(fine) > 0)), bool(fine[-1] < 5.0) ((50,), True, True) >>> res.curve(0, maturities=[0.0, 1.0]) Traceback (most recent call last): cultivars.exceptions.SpecificationError: maturities must be strictly positive.