I just started experimenting with Distributions.jl and StatsPlots.jl, and made a basic mistake, writing density(Normal()) instead of density(rand(Normal(), 100_000)) or plot(Normal()). When executing
It’s strange that density!(Normal(), label="density()") doesn’t throw an error, because StatsPlots.density! is a generic function with 1 method.
?density # or density!
displays that
density(x)
density!(x)
make a line plot of a kernel density estimate of x, where x is an AbstractVector of samples for probability density estimation.
Or you passed a distribution, not a sample from that distribution.
That is my understanding, although it is bit tricky for me to follow: StatsPlots has a lot of explicit calls to that @shorthand macro, but I didn’t see the one for density.