Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding help to kde method #121

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/univariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down