generate_yield {ycevo} | R Documentation |
Generate a yield curve with cubic time evolution
Description
Generate a yield curve using the extended version of Nelson & Siegel model
(Nelson, C. R., & Siegel, A. F., 1987). This has been used in the simulation
setting (Equation (30)) of Koo, B., La Vecchia, D., & Linton, O. (2021). See
Details
and References
.
Usage
generate_yield(
n_qdate = 12,
periods = 36,
b0 = 0,
b1 = 0.05,
b2 = 2,
t1 = 0.75,
t2 = 125,
linear = -0.55,
quadratic = 0.55,
cubic = -0.55
)
get_yield_at(
time,
maturity,
b0 = 0,
b1 = 0.05,
b2 = 2,
t1 = 0.75,
t2 = 125,
linear = -0.55,
quadratic = 0.55,
cubic = -0.55
)
get_yield_at_vec(
time,
maturity,
b0 = 0,
b1 = 0.05,
b2 = 2,
t1 = 0.75,
t2 = 125,
linear = -0.55,
quadratic = 0.55,
cubic = -0.55
)
Arguments
n_qdate |
Integer. Number of quotation dates to use in the data. Defaults to 12. |
periods |
Integer. Maximum number of time-to-maturity periods in 10 years that the yield curve is estimated for each quotation date. Defaults to 36 |
b0 |
Level term in yield curve equation, Defaults is 0. See
|
b1 |
Slope term in yield curve equation, Defaults is 0.05. See
|
b2 |
Curvature term in yield curve equation, Defaults is 2. See
|
t1 |
Scaling parameter in yield curve equation, Defaults is 0.75. See
|
t2 |
Scaling parameter in yield curve equation, Defaults is 125. See
|
linear |
Linear term in yield curve evolution, Defaults is -0.55. See
|
quadratic |
Quadratic term in yield curve evolution. Defaults is 0.55.
See |
cubic |
Cubic term in yield curve evolution. Defaults is -0.55. See
|
time |
Numeric value. |
maturity |
Numeric value. Maturity in years. |
Details
The initial curve at time zero is generated from the following equation
where is the time to maturity, usually measured in years. This
defines the yield curve for the quotation date = 0. The yield curve for
quotation dates
time
is obtained by multiplying this curve
by the cubic equation,
so the yield curve slowly changes over different quotation dates.
Value
generate_yield()
-
Numeric matrix. Each column contains the yield curve values at a point in time (a quotation date). Each row contains the yield curve values for a time-to-maturity. For example, the number in the second column third row is the yield at the second quotation date, for the third time-to-maturity ranking from shortest to longest. See
Details
for the equation to generate a yield curve. SeeExamples
for a example with the code to visually inspect the yield curves.
get_yield_at()
Numeric vector.
get_yield_at_vec()
Numeric vector.
Functions
-
get_yield_at()
: Return the yield at specific points in time of specific maturities. -
get_yield_at_vec()
: Deprecated. Vectorised version ofget_yield_at()
. Useget_yield_at()
instead.
References
Nelson, C. R., & Siegel, A. F. (1987). Parsimonious Modeling of Yield Curves. The Journal of Business, 60(4), 473-489.
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.
See Also
Examples
out <- generate_yield()
# plots
library(ggplot2)
out <- data.frame(out)
colnames(out) <- 1:12
out <- dplyr::mutate(out, time = 1:36)
out <- tidyr::pivot_longer(out, -time, names_to = "qdate", values_to = "yield")
ggplot(out) +
geom_line(aes(x=time, y=yield, color = qdate))