JuliaStats / KernelDensity.jl

Kernel density estimators for Julia
Other
175 stars 40 forks source link

get bandwidth obtained from kde_lscv #68

Open m-wells opened 5 years ago

m-wells commented 5 years ago

I created a new function that returns the bandwidth found from kde_lscv.

PaulSoderlind commented 4 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)