For pedagogical reasons, I will add a sliding-window estimator (for a rectangular kernel) to eda_dens. The estimate will take on the form:
strict_kde <- function(x, y, bw) {
n <- length(y)
sapply(x, function(x0) {
sum(abs(y - x0) <= (bw/2) ) / (n * bw)
})
}
where x is a vector of x values for which density values are to be computed , y is the batch of values whose density is estimated and bw is the full bandwidth of the rectangular kernel.
For pedagogical reasons, I will add a sliding-window estimator (for a rectangular kernel) to
eda_dens. The estimate will take on the form:where
xis a vector of x values for which density values are to be computed ,yis the batch of values whose density is estimated andbwis the full bandwidth of the rectangular kernel.