View source: R/kernel_functions.R
boundary_kernel | R Documentation |
This function computes boundary kernel weights for a given time period t
within a dataset
of size T
. It adjusts the kernel weights near the boundaries to account for edge effects,
ensuring that the weights sum to one.
boundary_kernel(t, r, iT, h, kernel_func)
t |
An integer specifying the current time period for which the kernel weights are computed. |
r |
An integer representing the reference time period. |
iT |
An integer indicating the total number of time periods in the dataset. |
h |
A numeric value representing the bandwidth parameter for the kernel function. |
kernel_func |
A function representing the kernel used for weighting. |
The boundary kernel function adjusts kernel weights near the start and end of the dataset to mitigate edge effects commonly encountered in kernel-based methods. The function performs the following steps:
Scales the difference between the current time t
and reference time r
by the
product of total time periods T
and bandwidth h
.
Applies the kernel function to the scaled difference and adjusts by the bandwidth.
Determines if the current time period is within the lower or upper boundary regions based on
T_h = \lfloor T \times h \rfloor
.
Computes the integral of the kernel function over the adjusted limits to ensure the weights sum to one in boundary regions.
A numeric scalar representing the boundary-adjusted kernel weight for the given time period.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.