R package ‘ycinterextra’ is now available on CRAN

ycinterextra, an R package for yield curve or zero-coupon prices interpolation and extrapolation is now available on CRAN.

The yield curve models currently available are Nelson-Siegel, Svensson, Smith-Wilson, and Hermite cubic splines. The output can be either rates or prices, no matter the input data type (prices or rates).

Here is a simple example of use of this package, featuring Svensson and Smith-Wilson interpolation.


# Yield to maturities
txZC <- c(0.01422, 0.01309, 0.0138, 0.01549, 0.01747, 
0.0194, 0.02104, 0.02236, 0.02348, 0.02446, 0.02535, 
0.02614, 0.02679, 0.02727, 0.0276, 0.02779, 0.02787, 
0.02786, 0.02776, 0.02762, 0.02745, 0.02727, 0.02707,
0.02686, 0.02663, 0.0264, 0.02618, 0.02597, 0.02578, 

# Observed maturities
u <- 1:30

# Output maturities
t <- seq(from = 1, to = 30, by = 0.5)

# Svensson interpolation
ycSV <- ycinter(yM = txZC, matsin = u, matsout = t, 
method = "SV", typeres = "rates")

# Smith-Wilson interpolation
ycSW <- ycinter(yM = txZC, matsin = u, matsout = t, 
method = "SW", typeres = "rates")

The residuals for each model can be obtained with :


## Time Series:
## Start = 1 
## End = 30 
## Frequency = 1 
## [1]  1.485e-04 -2.080e-04 -2.107e-04  7.469e-06  2.051e-04  3.095e-04
## [7]  2.317e-04  1.890e-05 -1.773e-04 -2.924e-04 -2.877e-04 -1.920e-04
## [13] -6.796e-05  3.148e-05  1.043e-04  1.402e-04  1.514e-04  1.420e-04
## [19]  9.859e-05  5.967e-05  2.558e-05  8.246e-06 -9.032e-06 -2.176e-05
## [25] -4.445e-05 -6.077e-05 -6.366e-05 -5.550e-05 -2.817e-05  3.688e-05


## Time Series:
## Start = 1 
## End = 30 
## Frequency = 1 
## [1] 4.007e-13 3.915e-13 3.963e-13 3.983e-13 3.985e-13 4.134e-13 4.232e-13
## [8] 4.288e-13 4.608e-13 4.423e-13 4.430e-13 4.428e-13 4.366e-13 4.378e-13
## [15] 4.290e-13 4.241e-13 4.150e-13 4.084e-13 4.003e-13 3.925e-13 3.859e-13
## [22] 3.726e-13 3.606e-13 3.491e-13 3.368e-13 3.249e-13 3.128e-13 3.011e-13
## [29] 2.893e-13 2.784e-13

Some diagnostic plots can also be drawn with the following command :


Diagnostic plot from ycinterextra


Filed under Uncategorized

Yield curve interpolation and extrapolation

R package ycinterextra achieves yield curve or zero-coupon bonds prices interpolation/extrapolation.

The methods currently available are Nelson-Siegel, Svensson, Smith-Wilson for both interpolation and extrapolation, and Hermite cubic spline for extrapolation.



Leave a comment

Filed under Uncategorized

A demo of R package ESG v0.1

The package ESG is a simple Economic Scenario Generator designed with R, for the purpose of actuarial valuations. The first version v0.1 can be found on CRAN repository :


An example of use of  this package, featuring short rate and equity projection, as well as a Best Estimate liability valuation, can be found here.

The files that have been used for this example can be found here, at the bottom of the page.

Future versions will include Martingale tests, inflation, a more flexible correlation structure…

Feedbacks are welcome !

Leave a comment

Filed under Uncategorized

mcGlobaloptim: Global optimization using Monte Carlo and Quasi Monte Carlo simulation

For the purpose of Market Consistent actuarial valuation, we need to calibrate our models to market data. Traditional optimization methods based only on gradient (Newton, quasi-Newton…) fail, or provide volatile results. Indeed, they search for a solution in a local neighborhood, while objective functions might exhibit multiple local minima. The R package mcGlobaloptim achieves global optimization, combining Monte Carlo and Quasi-Monte Carlo simulation with local searches. The local searches can be speeded-up by the use of your computer’s (multiple) cores.

Currently, the function multiStartoptim generates pseudo-random and quasi-random numbers within the search domain specified by its bounds. Local searches are then performed by a user-selected method, either on the whole set of numbers generated as starting points, or only on the points lying under the objective function’s median. When (and only when) a high number of local searches are to be performed, parallel computation can be used to speed-up the search

Leave a comment

October 28, 2013 · 6:34 pm