View source: R/nelson_siegel.R
| yc_nelson_siegel | R Documentation |
Estimate a Nelson-Siegel (1987) yield curve model from observed maturity-rate pairs. The model decomposes the yield curve into three factors: level, slope, and curvature.
yc_nelson_siegel(
maturities,
rates,
tau_init = 1,
weights = NULL,
type = c("zero", "par", "forward"),
date = NULL
)
maturities |
Numeric vector of maturities in years. |
rates |
Numeric vector of observed yields as decimals. |
tau_init |
Numeric. Initial value for the decay parameter tau. Default is 1. |
weights |
Optional numeric vector of weights for each observation.
Must be the same length as |
type |
Character. Rate type: |
date |
Optional Date for the curve. |
The Nelson-Siegel model is:
r(m) = \beta_0 + \beta_1 \frac{1 - e^{-m/\tau}}{m/\tau} +
\beta_2 \left(\frac{1 - e^{-m/\tau}}{m/\tau} - e^{-m/\tau}\right)
A yc_curve object with method = "nelson_siegel" and
params containing beta0, beta1, beta2, and tau.
Nelson, C.R. and Siegel, A.F. (1987). Parsimonious Modeling of Yield Curves. The Journal of Business, 60(4), 473–489. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1086/296409")}
maturities <- c(0.25, 0.5, 1, 2, 3, 5, 7, 10, 20, 30)
rates <- c(0.052, 0.050, 0.048, 0.045, 0.043, 0.042, 0.041,
0.040, 0.042, 0.043)
fit <- yc_nelson_siegel(maturities, rates)
fit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.