nelson_estim {termstrc} | R Documentation |
Term structure and credit spread estimation according to Nelson and Siegel (1987), and Svensson (1994).
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,newline
e.g. c("GERMANY","AUSTRIA") . |
bonddata |
a data set of bonds in a 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 minimising the squared price (yield) error. |
weights |
If a weighted minimisation of the squared price deviation is required, use "duration" , otherwise "none" . |
startparam |
a 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 provided data sets.startparam
control
mlimnb
.
The function nelson_estim
returns an object of the class "nelson"
. The object
contains the following items (mainly lists):
group |
vector consisting of the bond groups used for the estimation. |
matrange |
either "none" or a vector with the maturity range. |
method |
the chosen estimation method ("Nelson/Siegel" or "Svensson" ) . |
fit |
the chosen objective function ("prices" , or "yields" ). |
weights |
type of weighting used in the optimisation ("none" or "duration" ). |
n_group |
the number of groups used for the optimisation. |
spot |
one list for each group with an object of the class "spot_curves" . |
spread |
one list for each group with an object of the class "s_curves" . |
forward |
one list for each group with an object of the class "fwr_curves" . |
discount |
one list for each group with an object of the class "df_curves" . |
expoints |
one list for each group with the extrapolation points. |
cf |
one list for each group with the cashflows matrix. |
m |
one list for each group with the maturity matrix. |
p |
one list for each group with the dirty prices. |
phat |
one list for each group with the estimated bond prices. |
perrors |
one list for each group with an object of the class "error" containing the price errors of the bonds and the associated maturities. |
y |
one list for each group with the bond yields and the associated maturities. |
yhat |
one list for each group with the theoretical bond yields calculated with the estimated bond prices phat . |
yerrors |
one list for each group with an object of the class "error" containing the yield errors of the bonds and the associated maturities. |
opt_result |
one liste for each group with the optimal parameter vector obtained from the optimisation and further information concerning the optimisation. |
An error message concerning the function uniroot
is in general due to 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")