vis_kernel() visualises kernel weights assigned to the intervals
surrounding specific grid points using the Epanechnikov
kernel function and given bandwidths.
vis_kernel(data, x = NULL, hx = NULL, tau = NULL, ht = NULL, ...)A ggplot2::ggplot() object.
Bond data. If x and hx are not NULL, data
needs to include one time index column qdate. If tau and
ht are not NULL, data needs to include one column of time to
maturity in days tupq.
Time grids at which the discount curve is evaluated. Should be
specified using the same class of object as the quotation date (qdate)
column in data.
Numeric vector. Bandwidth parameters corresponding to each time
point x.
Numeric vector. Time-to-maturities in years where
discount function and yield curve will be estimated for each of time points x.
See Details.
Numeric vector. Bandwidth parameters corresponding to each value of
time-to-maturities tau. See Details.
Specification of an additional covariate, taking the form of var = list(grid, bandwidth), where var is the name of the covariate in
data, grid is the values at which the yield curve is estimated,
similar to x, and bandwidth is the bandwidth parameter corresponding to
each of the grid values, similar to hx.
If x and hx are provided, the kernel weights assigned to the intervals
surrounding each of time points x will be plotted.
If tau and ht are provided, the kernel weights assigned to the intervals
surrounding each of time-to-maturities tau will be plotted.
If the grid and bandwidth of a covariate are provided in ..., the
kernel weights of that covariate will be plotted.
The kernel weights can only be plotted in one dimension (time, time-to-maturity, or covariate) at a time.
ycevo_data(), ycevo()
bonds <- ycevo_data()
vis_kernel(bonds, x = lubridate::ymd("2023-06-01"), hx = 0.2)
Run the code above in your browser using DataLab