using Mamba # Data schools_dat = Dict{Symbol, Any}( :J => 8, :y => [28, 8, -3, 7, -1, 1, 18, 12], :sigma => [15, 10, 16, 11, 9, 11, 10, 18]) # Model model = Model( y = Stochastic(1, (theta, sigma)->MvNormal(theta, sigma), false ), theta = Logical(1,(mu, tau, eta)->mu + tau*eta,false), eta = Stochastic(1, ()-> MvNormal(8, 1.0)), mu = Stochastic(()-> Normal(0, 100)), tau = Stochastic(() -> Rayleigh(100)) ) # Initial Values inits = [ Dict(:y=>schools_dat[:y], :eta=>rand(Normal(0,1),8), :mu =>rand(Normal(0,1)), :tau => rand(Rayleigh(1)) )for i in 1:4 ] ## Sampling Scheme scheme = [NUTS([:mu,:eta]),Slice(:tau,3)] setsamplers!(model, scheme) ## MCMC Simulations sim = mcmc(model, schools_dat, inits, 1000,burnin=500,thin=1, chains=4) describe(sim) p=plot(sim) draw(p)