knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of ycevo
is to provide means for the non-parametric estimation of the discount function and yield curve of bonds.
If you use any data or code from the ycevo
package CRAN release in a publication, please use the following citation:
Bonsoo Koo, and Yangzhuoran Fin Yang (2024). ycevo: Non-Parametric Estimation of the Yield Curve Evolution. R package version 0.2.1. https://CRAN.R-project.org/package=ycevo.
The package provides code used in Koo, La Vecchia, & Linton (2021). Please use the following citation if you use any result from the paper.
Koo, B., La Vecchia, D., & Linton, O. (2021). Estimation of a nonparametric model for bond prices from cross-section and time series information. Journal of Econometrics, 220(2), 562-588.
The package is in active development and it have been experiencing substantial changes. Since the existing forks have remained inactive for several years, significant modifications have been implemented through rebase. It is advisable for any existing forks to undergo the rebase process.
git remote add upstream https://github.com/bonsook/ycevo.git git fetch upstream git rebase upstream/master git push origin master --force
You can install the released version of ycevo from CRAN with:
install.packages("ycevo")
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("bonsook/ycevo")
library(ycevo) library(lubridate) ## Simulate set.seed(1) bonds <- ycevo_data() bonds
#| eval: false ## Estimate at specified time points x <- seq(ymd("2023-03-01"), ymd("2023-08-01"), by = "1 month") res <- ycevo(bonds, x) ## Supports parallel processing and progress bar # future::plan(future::multisession) # res <- progressr::with_progress(ycevo(bonds, x))
#| echo: false x <- seq(ymd("2023-03-01"), ymd("2023-08-01"), by = "1 month") future::plan(future::multisession) res <- ycevo(bonds, x)
res
## Predict augment(res) ## Plot autoplot(res)
#| eval: false ## Compare to the true yield curve curve_true <- list() for(i in seq_along(x)) { curve_true[[i]] <- tibble( tau=1:20, qdate = x[[i]], .yield = get_yield_at((x[[i]] - ymd("2023-01-01"))/365, tau), .discount = exp(-tau * .yield)) } curve_true <- bind_rows(curve_true) curve_true <- pivot_longer( curve_true, c(.discount, .yield), names_to = ".est", values_to = ".value") autoplot(res) + geom_line(data = curve_true, linetype = "dashed")
This package is free and open source software, licensed under GPL-3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.