Skip to content

Commit

Permalink
Update univariate.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jaksle committed Jan 15, 2024
1 parent ab69a51 commit bc24f1a
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; [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)
Expand Down

0 comments on commit bc24f1a

Please sign in to comment.