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 Details.

b1

Slope term in yield curve equation, Defaults is 0.05. See Details.

b2

Curvature term in yield curve equation, Defaults is 2. See Details.

t1

Scaling parameter in yield curve equation, Defaults is 0.75. See Details.

t2

Scaling parameter in yield curve equation, Defaults is 125. See Details.

linear

Linear term in yield curve evolution, Defaults is -0.55. See Details.

quadratic

Quadratic term in yield curve evolution. Defaults is 0.55. See Details.

cubic

Cubic term in yield curve evolution. Defaults is -0.55. See Details.

time

Numeric value.

maturity

Numeric value. Maturity in years.

Details

The initial curve at time zero is generated from the following equation

Yield_{i, 0} = b_0 + b_1 * ((1 - \exp(-\tau_i / t_1)) / (\tau_i / t_1)) + b_2 * ((1 - \exp(-\tau_i / t_2)) / (\tau_i / t_2) - \exp(-\tau_i / t_2))

where \tau_i 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,

Yield_{i, time} = Yield_{i, 0} * (1 + linear * time + quadratic * time^2 + cubic * time^3)

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. See Examples for a example with the code to visually inspect the yield curves.

get_yield_at()

Numeric vector.

get_yield_at_vec()

Numeric vector.

Functions

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

ycevo_data()

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))


[Package ycevo version 0.2.0 Index]