Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ uuid = "f3b207a7-027a-5e70-b257-86293d7955fd"
version = "0.14.30"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Clustering = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
DataValues = "e7dc6d0d-1eca-5fa6-8ad6-5aecde8b7ea5"
Expand Down
2 changes: 1 addition & 1 deletion src/StatsPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Clustering: Hclust, nnodes
using Interpolations
import MultivariateStats: MDS, eigvals, projection, principalvars,
principalratio, transform

using AbstractFFTs: fft, ifft
import KernelDensity
@recipe f(k::KernelDensity.UnivariateKDE) = k.x, k.density
@recipe f(k::KernelDensity.BivariateKDE) = k.x, k.y, permutedims(k.density)
Expand Down
6 changes: 3 additions & 3 deletions src/hist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ function bkfe(gcounts, drv, bandwidth, range_x)
## Obtain kernel weights

tau = 4 + drv
L = min(floor(tau*h/delta), M)
L = min(Int(fld(tau*h, delta)), M)

lvec = 0:L
arg = lvec .* delta/h

kappam = pdf(Normal(),arg)/(h^(drv+1))
kappam = pdf.(Normal(),arg) ./ h^(drv+1)
hmold0, hmnew = ones(length(arg)), ones(length(arg))
hmold1 = arg

Expand All @@ -227,7 +227,7 @@ function bkfe(gcounts, drv, bandwidth, range_x)

## Now combine weights and counts to obtain estimate
## we need P >= 2L+1L, M: L <= M.
P = 2^(ceil(log(M+L+1)/log(2)))
P = nextpow(2, M+L+1)
kappam = [kappam; zeros(P-2*L-1); reverse(kappam[2:end])]
Gcounts = [gcounts; zeros(P-M)]
kappam = fft(kappam)
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ end # testset
]
end

@testset "Histogram" begin
data = randn(1000)
@test 0.3 < StatsPlots.wand_bins(data) < 0.4
end

@testset "Distributions" begin
@testset "univariate" begin
@testset "discrete" begin
Expand Down