Closed th0br0 closed 5 years ago
For now you can try the package https://github.com/TuringLang/MCMCChains.jl which built plotting functions on top of Mamba chains which utilize the Plots.jl package.
@th0br0: Plots, including mean plots, seem to be working properly for the mcmc output generated by the tutorial example run in Julia 1.1 and with Gadfly 1.0.1. Could you provide an example that will reproduce the error.
@bdeonovic I had some user-error with unqualified usage of e.g. hpd
that caused me to pick Mamba over MCMCChains due to inference issues, but in hindsight I might just as well switch back.
@brian-j-smith below snippet repros the error for me consistently:
using CmdStan
using StatsPlots
using Mamba
using StanMamba
using Gadfly
model= "
data {
int<lower=1> N;
vector[N] y;
}
parameters {
real alpha;
real<lower=0> sigma;
}
model {
y ~ normal(alpha, sigma);
}";
stanmodel = Stanmodel(name="repro", monitors = ["alpha","sigma"],model=model,
output_format=:mambachains);
data = Dict("N" => 25, "y" => 2:2:50);
_, sim, _ = stan(stanmodel, data; diagnostics=false);
Gadfly.draw(Mamba.plot(sim, :mean))
This seems to work using MCMCChain.plot:
using CmdStan
using StatsPlots
#using Mamba
#using StanMamba
#using Gadfly
using StanMCMCChain, MCMCChain
gr(size=(400,400))
ProjDir = @__DIR__
cd(ProjDir) do
model= "
data {
int<lower=1> N;
vector[N] y;
}
parameters {
real alpha;
real<lower=0> sigma;
}
model {
y ~ normal(alpha, sigma);
}";
stanmodel = Stanmodel(name="repro", monitors = ["alpha","sigma"],model=model,
# output_format=:mambachains);
output_format=:mcmcchain);
data = Dict("N" => 25, "y" => 2:2:50);
_, sim, _ = stan(stanmodel, data; diagnostics=false);
#Gadfly.draw(Mamba.plot(sim, :mean))
describe(sim) |> display
# Plot the chains
MCMCChain.plot(sim)
savefig("test01.pdf")
end
We are doing a lot of work on MCMCChain right now. The new MCMCChains.jl has not yet been registered.
Yeah, MCMChain.meanplot
works fine as a replacement. If Mamba.jl is being deprecated, I'll just close this issue. Thanks!
I sure hope Mamba.jl will never be deprecated. It is a very solid, full Julia mcmc package with performance that is often comparable to CmdStan. I feel bad I haven't had the time to redo the 7 or 8 original Stan.jl examples in StanMamba.jl yet (and your remark is a wake-up call for me).
Similarly, at some point I will do the StatisticalRethinking models in MambaModels, although for those I will use the new MCMCChains.jl, not Gadfly.jl.
Thanks for the kind words @goedman. As the maintainer and main developer of Mamba, I can say that there are no plans to deprecate the package.
Using Mamba 0.12.0 & Gadfly 1.0.1 drawing of the mean plots fails with below error:
Reason for this is that the
y
data vector has length (e.g. 4000) whereasx
andcolour
only contain 12 elements whereas cummean returns a 1000x4 Array.Using Julia 1.1