Learn R Programming

termstrc (version 1.1.1)

nelson_estim: Zero-coupon Yield Curve Estimation with the Nelson/Siegel, Svensson Method

Description

Zero-coupon yield curve estimation with the parametric Nelson and Siegel (1987) method and the Svensson (1994) extension.

Usage

nelson_estim(group,
             bonddata,
             matrange = "all",
             method = "Nelson/Siegel",
             fit = "prices",
             weights = "duration",
             startparam,
             control = list(eval.max = 1000, iter.max= 500))

Arguments

group
vector defining the group of bonds used for the estimation, e.g. c("GERMANY","AUSTRIA").
bonddata
a data set of bonds in list format.
matrange
use "all" for no restrictions, or restrict the maturity range used for the estimation with c(lower,upper).
method
"Nelson/Siegel" or "Svensson".
fit
use "prices" ("yields") for minimizing the squared pricing (yield) errors.
weights
weighting of the errors used in the optimization ("none" or "duration").
startparam
matrix of start parameters, for the Nelson/Siegel (Svensson) method 4 (6) parameters for each each group are required (one row per group).
control
list of control parameters for the function nlminb().

Value

  • The function nelson_estim returns an object of the class "nelson". The object contains the following items (mainly lists):
  • groupgroup of bonds (e.g. countries) used for the estimation.
  • matrange"none" or a vector with the maturity range.
  • methodestimation method ("Nelson/Siegel" or "Svensson").
  • fitobjective function ("prices", or "yields").
  • weightsweighting of the errors used in the optimization ("none" or "duration").
  • n_grouplength of object group, i.e. the number of countries.
  • spotzero-coupon yield curves as object of the class "spot_curves".
  • spreadspread curves as object of the class "s_curves".
  • forwardforward curves as object of the class "fwr_curves".
  • discountdiscount curves as object of the class "df_curves".
  • expointsextrapolation points for Nelson/Siegel method.
  • cfcashflow matrices.
  • mmaturity matrices.
  • pdirty prices.
  • phatestimated bond prices.
  • perrorspricing errors and maturities as object of the class "error".
  • ybond yields.
  • yhatone list for each group with the theoretical bond yields calculated with the estimated bond prices phat.
  • yerrorsyield errors and maturities as object of the class "error".
  • opt_resultoptimization results from nlminb, e.g. optimal parameters, convergence info.

Details

  • group
{The first element of the vector will be used as the reference country for the spread curve calculation. group can be either a vector of bond groups or a scalar.} bonddata{The package is designed to work with a certain list data structure. For more information use the function str() to explore the structure of the example data sets.}

startparam{A matrix of start parameters must be provided for the estimation. Due to the possible existence of multiple local minima, a great effort should be invested in finding a good start parameter set. For rolling estimation procedures, the previous optimal parameters should be used as inputs for the next iteration.}

control{Please refer to the documentation of the function nlminb.}

References

Charles R. Nelson and Andrew F. Siegel (1987): Parsimonious Modeling of Yield Curves. The Journal of Business, 60(4):473--489.

Lars E.O. Svensson (1994): Estimating and Interpreting Forward Interest Rates: Sweden 1992 -1994. Technical Reports 4871, National Bureau of Economic Research.

See Also

print.nelson, summary.nelson, plot.nelson, splines_estim, plot.spot_curves, plot.s_curves, plot.df_curves, plot.fwr_curves, plot.error, uniroot.

Examples

Run this code
# load data set
data(eurobonds)

# define countries, for which the estimation 
# of the zero-coupon yield curves will be carried out
group <- c("GERMANY", "AUSTRIA", "ITALY")

# define data set
bonddata <- eurobonds

# set maturity range
matrange <- c(2,12)

# define the used method
method <- "Nelson/Siegel"

# the weighted squared price errors will be minimized
fit <- "prices"
weights <- "duration"

# naive start parameters
b <- matrix(rep(c(0,0,0, 1),3),nrow=3,byrow=TRUE)
rownames(b) <- group
colnames(b) <- c("beta0","beta1","beta2","tau1")

# perform estimation
x <- nelson_estim(group, bonddata, matrange, 
                  method, fit, weights, startparam=b)

# prints the obtained parameters of the estimation
print(x)

# goodness of fit measures
summary(x)

# plots the zero-coupon yield curves for each country 
plot(x,errors="none")

# plots all zero-coupon yield curves togther
plot(x,multiple=TRUE, errors="none")

# spread curve splot
plot(x,ctype="spread",errors="none")

# price error plot for all countries
plot(x,ctype="none")

Run the code above in your browser using DataLab