You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that Jags.jl sometimes truncates the error messages. For example, I had a model with a vector of parameters and inadvertently supplied a single value for initialization. I recieved the following message:
RUNTIME ERROR:
Dimension mismatch in values supplied for mu
I couldn't figure out the error so I ran the model through R, which provide more information and I was able to quickly identify the problem. Here is the full error message:
Error in setParameters(init.values[[i]], i) : RUNTIME ERROR:
Dimension mismatch in values supplied for mu
Here is a MWE:
ENV["JAGS_HOME"] = "usr/bin/jags" #your path here
using Jags, StatsPlots, Random, Distributions
cd(@__DIR__)
ProjDir = pwd()
Random.seed!(3431)
y = rand(Normal(0,1),50)
Model = "
model {
for (i in 1:length(y)) {
y[i] ~ dnorm(mu[i],sigma);
}
for(i in 1:length(y)){
mu[i] ~ dnorm(0, 1/sqrt(10));
}
sigma ~ dt(0,1,1) T(0, );
}
"
monitors = Dict(
"mu" => true,
"sigma" => true,
)
inits = [
Dict("mu"=>.0,"sigma"=>1.0)
]
jagsmodel = Jagsmodel(
name="Gaussian",
model=Model ,
monitor=monitors,
ncommands=4, nchains=1,
#deviance=true, dic=true, popt=true,
pdir=ProjDir
)
println("\nJagsmodel that will be used:")
jagsmodel |> display
data = Dict{String, Any}(
"y" => y,
)
inits = [
Dict("mu" => 0.0,"sigma" => 1.0,
".RNG.name" => "base::Mersenne-Twister")
]
println("Input observed data dictionary:")
data |> display
println("\nInput initial values dictionary:")
inits |> display
println()
#######################################################################################
# Estimate Parameters
#######################################################################################
sim = jags(jagsmodel, data, inits, ProjDir)
sim = sim[5001:end,:,:]
The text was updated successfully, but these errors were encountered:
Hi Chris, yes, I see the problem as well. Once back in CO I’ll take a look at this and the other issue ( #23 ). It’s difficult right now, while traveling, to set aside 2 days or so to fix both issues. I expect to be back early November.
Hi Rob-
I noticed that Jags.jl sometimes truncates the error messages. For example, I had a model with a vector of parameters and inadvertently supplied a single value for initialization. I recieved the following message:
I couldn't figure out the error so I ran the model through R, which provide more information and I was able to quickly identify the problem. Here is the full error message:
Here is a MWE:
The text was updated successfully, but these errors were encountered: