nelson_estim {termstrc} | R Documentation |
Zero-coupon yield curve estimation with the parametric Nelson and Siegel (1987) method and the Svensson (1994) extension.
nelson_estim(group, bonddata, matrange = "all", method = "Nelson/Siegel", fit = "prices", weights = "duration", startparam, control = list(eval.max = 1000, iter.max= 500))
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() . |
group
group
can be either a vector of bond groups or a scalar.bonddata
str()
to explore the structure of the example data sets.startparam
control
nlminb
.
The function nelson_estim
returns an object of the class "nelson"
. The object
contains the following items (mainly lists):
group |
group of bonds (e.g. countries) used for the estimation. |
matrange |
"none" or a vector with the maturity range. |
method |
estimation method ("Nelson/Siegel" or "Svensson" ). |
fit |
objective function ("prices" , or "yields" ). |
weights |
weighting of the errors used in the optimization ("none" or "duration" ). |
n_group |
length of object group , i.e. the number of countries. |
spot |
zero-coupon yield curves as object of the class "spot_curves" . |
spread |
spread curves as object of the class "s_curves" . |
forward |
forward curves as object of the class "fwr_curves" . |
discount |
discount curves as object of the class "df_curves" . |
expoints |
extrapolation points for Nelson/Siegel method. |
cf |
cashflow matrices. |
m |
maturity matrices. |
p |
dirty prices. |
phat |
estimated bond prices. |
perrors |
pricing errors and maturities as object of the class "error" . |
y |
bond yields. |
yhat |
one list for each group with the theoretical bond yields calculated with the estimated bond prices phat . |
yerrors |
yield errors and maturities as object of the class "error" . |
opt_result |
optimization results from nlminb , e.g. optimal parameters, convergence info. |
An error message concerning the function uniroot()
is in general caused by wrongly specified start parameters.
For objects of the class "spot_curves"
, "s_curves"
, "df_curves"
, "fwr_curves"
, "error"
appropriate plot methods are offered. For objects of the class "nelson"
print, summary and plot methods are available. Another term structure estimation method is provided by the function splines_estim
.
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.
print.nelson
, summary.nelson
, plot.nelson
, splines_estim
, plot.spot_curves
, plot.s_curves
, plot.df_curves
, plot.fwr_curves
, plot.error
, uniroot
.
# 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")