From bc24f1a4a26bb2ebcfb86589118a025533197f19 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, 15 Jan 2024 20:15:37 +0100 Subject: [PATCH 1/3] Update univariate.jl --- src/univariate.jl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/univariate.jl b/src/univariate.jl index cba5181d..d9dae572 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; [options]) + kde((xdata, ydata); [options]) + +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 optional 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) From d46dd064503f505e61542d7b3465d05bfad4696b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=9Al=C4=99zak?= <128084860+jaksle@users.noreply.github.com> Date: Tue, 16 Jan 2024 13:36:20 +0100 Subject: [PATCH 2/3] Update src/univariate.jl Co-authored-by: Tamas K. Papp --- src/univariate.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/univariate.jl b/src/univariate.jl index d9dae572..242f1a92 100644 --- a/src/univariate.jl +++ b/src/univariate.jl @@ -155,7 +155,7 @@ end 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 optional keyword arguments are +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), From ccbba39b4f1655bb8fe5b803aa2243109dba834d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=9Al=C4=99zak?= <128084860+jaksle@users.noreply.github.com> Date: Tue, 16 Jan 2024 13:36:26 +0100 Subject: [PATCH 3/3] Update src/univariate.jl Co-authored-by: Tamas K. Papp --- src/univariate.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/univariate.jl b/src/univariate.jl index 242f1a92..5f71a809 100644 --- a/src/univariate.jl +++ b/src/univariate.jl @@ -150,8 +150,8 @@ end """ - kde(data; [options]) - kde((xdata, ydata); [options]) + 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.