Skip to content

Commit

Permalink
Adding help to kde method (#121)
Browse files Browse the repository at this point in the history
* Update univariate.jl

* Update src/univariate.jl

Co-authored-by: Tamas K. Papp <[email protected]>

* Update src/univariate.jl

Co-authored-by: Tamas K. Papp <[email protected]>

---------

Co-authored-by: Tamas K. Papp <[email protected]>
  • Loading branch information
jaksle and tpapp authored Jan 29, 2024
1 parent ab69a51 commit 93437e0
Showing 1 changed file with 14 additions and 0 deletions.
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

0 comments on commit 93437e0

Please sign in to comment.