naginterfaces.library.interp.dim1_​monconv_​disc

naginterfaces.library.interp.dim1_monconv_disc(negfor, yfor, x, y, lam=0.2)[source]

dim1_monconv_disc computes, for a given set of data points, the forward values and other values required for monotone convex interpolation as defined in Hagan and West (2008). This form of interpolation is particularly suited to the construction of yield curves in Financial Mathematics but can be applied to any data where it is desirable to preserve both monotonicity and convexity.

For full information please refer to the NAG Library document for e01ce

https://support.nag.com/numeric/nl/nagdoc_30/flhtml/e01/e01cef.html

Parameters
negforbool

Determines whether or not to allow negative forward rates.

Negative forward rates are permitted.

Forward rates calculated must be non-negative.

yforbool

Determines whether the array contains values, , or discrete forward rates .

contains the discrete forward rates , for .

contains the values , for .

xfloat, array-like, shape

, the (possibly unordered) set of data points.

yfloat, array-like, shape

If , the discrete forward rates corresponding to the data points , for .

If , the data values corresponding to the data points , for .

lamfloat, optional

, the amelioration (smoothing) parameter. Forward rates are first computed using (2) and then, if , a limiting filter is applied which depends on neighbouring discrete forward values. This filter has a smoothing effect on the curve that increases with .

Returns
commdict, communication object

Communication structure.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, contains duplicate data points.

Notes

dim1_monconv_disc computes, for a set of data points, , for , the discrete forward rates, , and the instantaneous forward rates, , which are used in a monotone convex interpolation method that attempts to preserve both the monotonicity and the convexity of the original data. The monotone convex interpolation method is due to Hagan and West and is described in Hagan and West (2006), Hagan and West (2008) and West (2011).

The discrete forward rates are defined simply, for ordered data, by

The discrete forward rates, if pre-computed, may be supplied instead of , in which case the original values are computed using the inverse of (1).

The data points need not be ordered on input (though must correspond to ); a set of ordered and scaled values are calculated from and stored.

In its simplest form, the instantaneous forward rates, , at the data points are computed as linear interpolations of the :

If it is required, as a constraint, that these values should never be negative then a limiting filter is applied to as described in Section 3.6 of West (2011).

An ameliorated (smoothed) form of this linear interpolation for the forward rates is implemented using the amelioration (smoothing) parameter . For , equation (2) is used (with possible post-process filtering); for , the ameliorated method described fully in West (2011) is used.

The values computed by dim1_monconv_disc are used by dim1_monconv_eval() to compute, for a given value , the monotone convex interpolated (or extrapolated) value and the corresponding instantaneous forward rate ; the curve gradient at can be derived as for .

References

Hagan, P S and West, G, 2006, Interpolation methods for curve construction, Applied Mathematical Finance (13(2)), 89–129

Hagan, P S and West, G, 2008, Methods for constructing a yield curve, WILLMOTT Magazine (May), 70–81

West, G, 2011, The monotone convex method of interpolation, Financial Modelling Agency