From 93437e00dd3c0c070b0934ec5554b83108144381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=9Al=C4=99zak?= <128084860+jaksle@users.noreply.github.com> Date: Mon, 29 Jan 2024 11:27:51 +0100 Subject: [PATCH] Adding help to kde method (#121) * Update univariate.jl * Update src/univariate.jl Co-authored-by: Tamas K. Papp * Update src/univariate.jl Co-authored-by: Tamas K. Papp --------- Co-authored-by: Tamas K. Papp --- src/univariate.jl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/univariate.jl b/src/univariate.jl index cba5181d..5f71a809 100644 --- a/src/univariate.jl +++ b/src/univariate.jl @@ -147,6 +147,20 @@ function conv(k::UnivariateKDE, dist::UnivariateDistribution) end # main kde interface methods + +""" + + kde(data; kwargs...) + kde((xdata, ydata); kwargs...) + +Kernel density estimation method. Returns 1D or 2D KDE object. The grid used and the values of the estimated density can be obtained from fields `.x` and `.density` respectively. To obtain kde values at points different than the initial grid use the `pdf` method. + +The keyword arguments are +* `boundary`: the lower and upper limits of the kde, tuple in 1D case, tuple of tuples in 2D case, +* `npoints`: the number of interpolation points to use, +* `kernel = Normal`: the distributional family from [Distributions.jl](https://github.com/JuliaStats/Distributions.jl), +* `bandwidth`: the bandwidth of the kernel; default is calculated using Silverman's rule. +""" function kde(data::AbstractVector{<:Real}, weights::Weights, midpoints::R, dist::UnivariateDistribution) where R<:AbstractRange k = tabulate(data, midpoints, weights) conv(k,dist)