| yc_fit | R Documentation |
Unified interface for fitting a yield curve using different methods.
Dispatches to yc_nelson_siegel(), yc_svensson(), or
yc_cubic_spline().
yc_fit(
maturities,
rates,
method = c("nelson_siegel", "svensson", "cubic_spline"),
type = c("zero", "par", "forward"),
date = NULL,
...
)
maturities |
Numeric vector of maturities in years. |
rates |
Numeric vector of observed yields as decimals. |
method |
Character. Fitting method: |
type |
Character. Rate type: |
date |
Optional Date for the curve. |
... |
Additional arguments passed to the fitting function. |
A yc_curve object.
maturities <- c(0.25, 0.5, 1, 2, 5, 10, 30)
rates <- c(0.052, 0.050, 0.048, 0.045, 0.042, 0.040, 0.043)
fit <- yc_fit(maturities, rates, method = "nelson_siegel")
fit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.