Newer
Older
#using AbstractMCMC
using Random, Distributions, StatsBase
import StatsBase: sample
import Distributions: logpdf
import Base: length, eltype, convert
export SimpleLogDensity
export propose, CyclicWalk
export MetropolisHastings
export flatten
export ksdist
include("utils.jl")
include("chain.jl")
include("proposal.jl")
include("model.jl")
include("sampler.jl")
#Test
#=
using CairoMakie
σ = .1
w = CyclicWalk(-1,1,.5)
e = SimpleLogDensity(Normal(0, σ))
fig = Figure(); ax = Axis(fig[1,1])
x = collect(-1:1e-3:1)
#y = exp.( e.(x) ); y = y/(2 * mean(y))
y = e.(x)
lines!(ax, x, y)
#s = MetropolisHastings(e, w)
#@time c = sample(s, 100000)
#hist!(ax, flatten(c).states, normalization=:pdf)
display(fig)
=#