I am not sure if this is a bug, or my ignorance but running
using Distributions
using Gadfly
using KernelDensity
n = 300
dx = rand(TruncatedNormal(1., 20., 0, Inf),n)
x = cumsum(dx)
dx_kde = kde(dx)
dx_kde_midpoints = kde(dx, minimum(dx):maximum(dx)*2)
plot(x=1:n, y=x, Geom.line)
plot(x = dx_kde.x, y = dx_kde.density,Geom.line)
plot(x = dx_kde_midpoints.x, y = dx_kde_midpoints.density, Geom.line)
Gives the following two plots (in the same order as the code)
I really just wanted to truncate it to the left, which seems to work. No matter how high or low I set the upper limit in the kde(Array, Range) call, I get that jump in the end.
I am not sure if this is a bug, or my ignorance but running
Gives the following two plots (in the same order as the code)
I really just wanted to truncate it to the left, which seems to work. No matter how high or low I set the upper limit in the
kde(Array, Range)
call, I get that jump in the end.