Skip to content

Commit

Permalink
Merge branch 'master' into dw/abstractffts
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion authored May 30, 2024
2 parents 29b595d + 45b3291 commit 5e0a937
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
AbstractFFTs = "0.5, 1"
Distributions = "0.23, 0.24, 0.25"
DocStringExtensions = "0.8, 0.9"
Interpolations = "0.9, 0.10, 0.11, 0.12, 0.13, 0.14"
FFTW = "1"
Interpolations = "0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15"
StatsBase = "0.33, 0.34"
Test = "<0.0.1, 1"
julia = "1"

[extras]
Expand Down
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 5e0a937

Please sign in to comment.