ycevo_data: Simulate bond data

View source: R/simulation.R

ycevo_dataR Documentation

Simulate bond data

Description

Simulate bond transaction data at each weekday throughout the year 2023, following the extended version of Nelson & Siegel model (Nelson, C. R., & Siegel, A. F., 1987).

Usage

ycevo_data(
  n = 40,
  b0 = 0,
  b1 = 0.05,
  b2 = 2,
  t1 = 0.75,
  t2 = 125,
  linear = -0.55,
  quadratic = 0.55,
  cubic = -0.55
)

Arguments

n

The number of bonds of each maturity to simulation

b0

Level term in yield curve equation, Defaults to 0. See Details.

b1

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

b2

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

t1

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

t2

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

linear

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

quadratic

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

cubic

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

Details

n bonds for each of the following maturities are simulated: 20, 10, 5, 3, 2 and 0.8 years. The face value of all bonds is 100. Bonds with 0.8 years of maturity are similar to the US Treasury bills with no coupon. Bonds with maturity between 2 and 10 years correspond to the US Treasury notes. Their coupon rates are simulated from an Epanechnikov distribution with mean 4, and the distance from the mean to the boundary is 2.65. Bonds with maturity of 20 years corresponds to the US Treasury bonds. Their coupon rates are simulated from an Epanechnikov distribution with mean 7.5, and the distance from the mean to the boundary is 2.65. Coupons are payable every 6 months.

We artificially "observe" quotation data of bonds on every weekday through out 2023, starting with 2 Jan 2023. To ensure an adequate number of transactions are observed for the estimation of the yield curve, the earliest bond is issued prior to the beginning of 2023, determined by the length of maturity of that type of bond, such that the last payment can still be observed at the beginning of 2023. For example, the first bond with 20 years of maturity is issued at the beginning of 2003. The last bond within a type is issued at the end of 2023. The rest of the bonds have issue dates spread evenly in between.

The initial yield at the beginning of 2023 is generated from the following equation

Yield_{i, 0} = b_0 + b_1 * ((1 - \exp(-\tau_i / t_1)) / (\tau / 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 in years. The yield curve at quotation time t is obtained by multiplying this curve by the cubic equation,

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

so the yield curve slowly changes over different quotation dates. The time t is a value between 0 and 1, the proportion of time that has passed by a quotation date, identifying the progression through 2023. For example, the time t corresponding to 31 Mar 2023 is 0.25.

The discount function is then derived from the yield curve,

d_t(\tau) = \exp(-\tau y_t(\tau))

to discount all the future cash flows of a bond and calculate the price of that bond at the quotation date.

Value

A tibble::tibble() object with 5 variables

qdate

The quotation date of a bond in a Date() class.

id

The unique identifier of a bond.

price

The price of a bond.

tupq

The remaining time until the given cash flow in days.

pdint

The payment amount of the cash flow. For a non-coupon-paying bond, the only cash flow occurs on the maturity date with a payment of 100, i.e., the face value of the bond. For a coupon-paying bond, the stream of cash flows includes the coupon payable on the interest payment date before maturity and the face value 100 plus the coupon payment for the last cash flow on the maturity date.

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

get_yield_at()

Examples

ycevo_data()


FinYang/ycevo documentation built on April 10, 2024, 8:17 a.m.