Learn R Programming

fixedincome (version 0.0.5)

prepare_interpolation: Create the interpolation function

Description

Creates the interpolation function to a SpotRateCurve object.

Usage

prepare_interpolation(object, x, ...)

Value

A Interpolation object with the slot func properly defined. This slot is set with a function (closure) that executes the interpolation method.

Arguments

object

a Interpolation object.

x

a SpotRateCurve object.

...

additional arguments. Currently unused.

This method is used internally when the interpolation is set to a curve. It uses the current state of the curve to build the interpolation function. This is similar to call approxfun and splinefun to create functions that perform interpolation of the given data points.

This method shouldn't be directly called, it is for internal use only.

Examples

Run this code
terms <- c(1, 11, 26, 27, 28)
rates <- c(0.0719, 0.056, 0.0674, 0.0687, 0.07)
curve <- spotratecurve(rates, terms, "discrete", "actual/365", "actual")
prepare_interpolation(interp_flatforward(), curve)

Run the code above in your browser using DataLab