Open m-wells opened 5 years ago
Something like this is needed. Just to mention one reason: the pointwise sampling variance of the density estimate typically depends on both the bandwidth and the shape of the kernel (see Silverman 1986 ch. 3.3)
I was thinking of instead changing the UnivariateKDE
object to include the kernel, something like:
mutable struct UnivariateKDE{R<:AbstractRange} <: AbstractKDE
"Gridpoints for evaluating the density."
x::R
"Kernel density at corresponding gridpoints `x`."
density::Vector{Float64}
"Kernel"
dist::UnivariateDistribution
end
Then, the output of the kde_lscv()
could be
UnivariateKDE(k.x, dens, dist)
I created a new function that returns the bandwidth found from kde_lscv.