[ Info: Precompiling ProbabilityModels [59565fc0-be2d-11e8-2072-153e94501fdd]
    Defined model: ITPModel.
    Unknowns: Y₂, domains, μh₁, μᵣ₁, μh₂, σ, σᵦ, δh, θ, μᵣ₂, ρ, Y₁, κ, L, σh, βᵣ₂, t, βᵣ₁.

139.603945 seconds (38.07 M allocations: 2.006 GiB, 0.89% gc time)
 66.961468 seconds (116.55 k allocations: 13.740 MiB, 0.04% gc time)
8×3 Array{Float64,2}:
  616.689   406.505   548.714
  832.051   188.539  1732.89 
  858.075   802.705  2000.0  
  703.933   682.391  2000.0  
  404.327   778.768  1989.7  
   47.2013  177.933   105.798
  577.57    549.395   133.807
 1018.51    749.38   2000.0  

converged = vec(sum(ess, dims=2)) .> 1000 = Bool[1, 1, 1, 1, 1, 0, 1, 1]

not_converged = .!(converged) = Bool[0, 0, 0, 0, 0, 1, 0, 0]

NUTS_statistics.(chains[not_converged]) = DynamicHMC.NUTS_Statistics{Float64,DataStructures.Accumulator{DynamicHMC.Termination,Int64},DataStructures.Accumulator{Int64,Int64}}[Hamiltonian Monte Carlo sample of length 2000
  acceptance rate mean: 0.79, min/25%/median/75%/max: 0.0 0.77 0.93 0.98 1.0
  termination: AdjacentDivergent => 11% AdjacentTurn => 13% DoubledTurn => 76%
  depth: 1 => 0% 2 => 3% 3 => 4% 4 => 2% 5 => 2% 6 => 82% 7 => 7% 8 => 0%
]

NUTS_statistics.(chains[converged]) = DynamicHMC.NUTS_Statistics{Float64,DataStructures.Accumulator{DynamicHMC.Termination,Int64},DataStructures.Accumulator{Int64,Int64}}[Hamiltonian Monte Carlo sample of length 2000
  acceptance rate mean: 0.82, min/25%/median/75%/max: 0.0 0.78 0.94 0.98 1.0
  termination: AdjacentDivergent => 5% AdjacentTurn => 2% DoubledTurn => 93%
  depth: 2 => 0% 3 => 1% 4 => 1% 5 => 3% 6 => 95% 7 => 0%
, Hamiltonian Monte Carlo sample of length 2000
  acceptance rate mean: 0.86, min/25%/median/75%/max: 0.0 0.86 0.96 0.99 1.0
  termination: AdjacentDivergent => 6% AdjacentTurn => 13% DoubledTurn => 82%
  depth: 2 => 0% 3 => 2% 4 => 1% 5 => 1% 6 => 32% 7 => 64% 8 => 0%
, Hamiltonian Monte Carlo sample of length 2000
  acceptance rate mean: 0.9, min/25%/median/75%/max: 0.0 0.89 0.96 0.99 1.0
  termination: AdjacentDivergent => 2% AdjacentTurn => 1% DoubledTurn => 97%
  depth: 4 => 0% 5 => 1% 6 => 4% 7 => 96% 8 => 0%
, Hamiltonian Monte Carlo sample of length 2000
  acceptance rate mean: 0.89, min/25%/median/75%/max: 0.0 0.88 0.96 0.98 1.0
  termination: AdjacentDivergent => 2% AdjacentTurn => 8% DoubledTurn => 90%
  depth: 4 => 0% 5 => 1% 6 => 97% 7 => 2%
, Hamiltonian Monte Carlo sample of length 2000
  acceptance rate mean: 0.91, min/25%/median/75%/max: 0.0 0.9 0.97 0.99 1.0
  termination: AdjacentDivergent => 1% AdjacentTurn => 16% DoubledTurn => 83%
  depth: 4 => 0% 5 => 0% 6 => 90% 7 => 10%
, Hamiltonian Monte Carlo sample of length 2000
  acceptance rate mean: 0.72, min/25%/median/75%/max: 0.0 0.61 0.89 0.97 1.0
  termination: AdjacentDivergent => 12% AdjacentTurn => 2% DoubledTurn => 86%
  depth: 1 => 0% 2 => 3% 3 => 3% 4 => 3% 5 => 4% 6 => 86% 7 => 0%
, Hamiltonian Monte Carlo sample of length 2000
  acceptance rate mean: 0.92, min/25%/median/75%/max: 0.0 0.91 0.97 0.99 1.0
  termination: AdjacentDivergent => 1% AdjacentTurn => 20% DoubledTurn => 79%
  depth: 4 => 0% 5 => 0% 6 => 51% 7 => 48% 8 => 0%
]

size(poi_chain) = (3,)
"Major Quantiles for paramter with true values: -3.0:"
2×5 Array{Float64,2}:
  0.05      0.25      0.5       0.75      0.95    
 -3.35436  -2.36298  -1.76197  -1.15517  -0.182754
"Major Quantiles for paramter with true values: 9.0:"
2×5 Array{Float64,2}:
 0.05     0.25     0.5       0.75     0.95  
 8.11733  9.17716  9.77978  10.4057  11.3609
"Major Quantiles for paramter with true values: 0.7:"
2×5 Array{Float64,2}:
 0.05      0.25      0.5       0.75      0.95    
 0.696718  0.700276  0.702734  0.705351  0.708993
[ Info: Precompiling StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd]

File /Users/rob/.julia/dev/DynamicHMCModels/scripts/ProbabilityModels/ITP/tmp/itp1.stan will be updated.


Inference for Stan model: itp1_model
4 chains: each with iter=(2000,2000,2000,2000); warmup=(0,0,0,0); thin=(1,1,1,1); 8000 iterations saved.

Warmup took (2776, 99, 2702, 3422) seconds, 2.5 hours total
Sampling took (6669, 222, 6687, 6633) seconds, 5.6 hours total

                    Mean     MCSE   StdDev        5%       50%       95%  N_Eff  N_Eff/s    R_hat
lp__            -1.0e+07  1.2e+07  1.8e+07  -4.3e+07  -1.1e+04  -1.1e+04    2.0  9.9e-05  3.7e+01
accept_stat__    9.9e-01  7.9e-04  3.5e-02   9.5e-01   1.0e+00   1.0e+00   2012  1.0e-01  1.0e+00
stepsize__       6.4e-03      nan  3.8e-03   4.1e-06   8.9e-03   9.5e-03    nan      nan  4.6e+14
treedepth__      7.6e+00      nan  2.5e+00   3.0e+00   9.0e+00   9.0e+00    nan      nan  5.4e+00
n_leapfrog__     3.9e+02  1.5e+02  2.2e+02   7.0e+00   5.1e+02   5.1e+02    2.0  1.0e-04  8.2e+00
divergent__      6.3e-04      nan  2.5e-02   0.0e+00   0.0e+00   0.0e+00    nan      nan  1.0e+00
energy__         1.0e+07  1.2e+07  1.8e+07   1.1e+04   1.1e+04   4.3e+07    2.0  9.9e-05  3.7e+01
muh[1]          -1.1e+00  8.6e-01  1.5e+00  -3.4e+00  -1.4e+00   9.0e-01    3.2  1.6e-04  1.6e+00
muh[2]           7.3e+00  3.0e+00  4.4e+00  -9.4e-02   9.4e+00   1.1e+01    2.1  1.0e-04  4.7e+00
rho              5.3e-01  2.2e-01  3.1e-01  -9.9e-03   7.0e-01   7.1e-01    2.0  9.9e-05  9.7e+01
...
sigma[9]         1.4e+00  8.2e-02  1.2e-01   1.3e+00   1.4e+00   1.6e+00    2.0  1.0e-04  9.5e+00

Samples were drawn using hmc with nuts.
For each parameter, N_Eff is a crude measure of effective sample size,
and R_hat is the potential scale reduction factor on split chains (at 
convergence, R_hat=1).

10111.246658 seconds (24.61 M allocations: 1.205 GiB, 0.01% gc time)

Inference for Stan model: itp1_model
4 chains: each with iter=(2000,2000,2000,2000); warmup=(0,0,0,0); thin=(1,1,1,1); 8000 iterations saved.

Warmup took (3110, 3199, 3351, 78) seconds, 2.7 hours total
Sampling took (6840, 7573, 6761, 191) seconds, 5.9 hours total

                    Mean     MCSE   StdDev        5%       50%       95%  N_Eff  N_Eff/s    R_hat
lp__            -2.1e+08  2.6e+08  3.6e+08  -8.6e+08  -1.1e+04  -1.1e+04    2.0  9.4e-05  7.4e+01
accept_stat__    9.9e-01  4.5e-04  3.9e-02   9.6e-01   1.0e+00   1.0e+00   7779  3.6e-01  1.0e+00
stepsize__       5.7e-03  2.4e-03  3.4e-03   2.2e-06   7.6e-03   8.6e-03    2.0  9.4e-05  3.5e+14
treedepth__      7.5e+00      nan  2.7e+00   2.0e+00   9.0e+00   9.0e+00    nan      nan  5.1e+00
n_leapfrog__     4.0e+02  1.6e+02  2.4e+02   3.0e+00   5.1e+02   5.1e+02    2.2  1.1e-04  2.9e+00
divergent__      6.3e-04      nan  2.5e-02   0.0e+00   0.0e+00   0.0e+00    nan      nan  1.0e+00
energy__         2.1e+08  2.6e+08  3.6e+08   1.1e+04   1.1e+04   8.6e+08    2.0  9.4e-05  7.4e+01
muh[1]          -1.6e+00  2.8e-01  1.1e+00  -3.5e+00  -1.4e+00  -2.6e-01     14  6.7e-04  1.1e+00
muh[2]           7.3e+00  3.0e+00  4.3e+00   1.4e-01   9.4e+00   1.1e+01    2.1  9.8e-05  4.6e+00
rho              5.2e-01  2.2e-01  3.1e-01  -1.6e-02   7.0e-01   7.1e-01    2.0  9.4e-05  9.9e+01
...
sigma[9]         1.1e+00  3.4e-01  4.9e-01   2.4e-01   1.4e+00   1.4e+00    2.0  9.4e-05  3.9e+01

Samples were drawn using hmc with nuts.
For each parameter, N_Eff is a crude measure of effective sample size,
and R_hat is the potential scale reduction factor on split chains (at 
convergence, R_hat=1).

10798.697912 seconds (8.70 M allocations: 405.750 MiB, 0.00% gc time)

Object of type Chains, with data of type 2000×146×6 Array{Float64,3}

Iterations        = 1:2000
Thinning interval = 1
Chains            = 1, 2, 3, 4, 5, 6
Samples per chain = 2000
betaraw           = betaraw.1.1, betaraw.2.1, betaraw.1.2, betaraw.2.2, betaraw.1.3, betaraw.2.3, betaraw.1.4, betaraw.2.4, betaraw.1.5, betaraw.2.5, betaraw.1.6, betaraw.2.6, betaraw.1.7, betaraw.2.7, betaraw.1.8, betaraw.2.8, betaraw.1.9, betaraw.2.9
kappa             = kappa.1, kappa.2, kappa.3, kappa.4, kappa.5, kappa.6, kappa.7, kappa.8, kappa.9
muraw             = muraw.1.1, muraw.2.1, muraw.1.2, muraw.2.2, muraw.1.3, muraw.2.3, muraw.1.4, muraw.2.4
L                 = L.1.1, L.2.1, L.3.1, L.4.1, L.5.1, L.6.1, L.7.1, L.8.1, L.9.1, L.1.2, L.2.2, L.3.2, L.4.2, L.5.2, L.6.2, L.7.2, L.8.2, L.9.2, L.1.3, L.2.3, L.3.3, L.4.3, L.5.3, L.6.3, L.7.3, L.8.3, L.9.3, L.1.4, L.2.4, L.3.4, L.4.4, L.5.4, L.6.4, L.7.4, L.8.4, L.9.4, L.1.5, L.2.5, L.3.5, L.4.5, L.5.5, L.6.5, L.7.5, L.8.5, L.9.5, L.1.6, L.2.6, L.3.6, L.4.6, L.5.6, L.6.6, L.7.6, L.8.6, L.9.6, L.1.7, L.2.7, L.3.7, L.4.7, L.5.7, L.6.7, L.7.7, L.8.7, L.9.7, L.1.8, L.2.8, L.3.8, L.4.8, L.5.8, L.6.8, L.7.8, L.8.8, L.9.8, L.1.9, L.2.9, L.3.9, L.4.9, L.5.9, L.6.9, L.7.9, L.8.9, L.9.9
sigma             = sigma.1, sigma.2, sigma.3, sigma.4, sigma.5, sigma.6, sigma.7, sigma.8, sigma.9
theta             = theta.1, theta.2, theta.3, theta.4, theta.5, theta.6, theta.7, theta.8, theta.9
internals         = lp__, accept_stat__, stepsize__, treedepth__, n_leapfrog__, divergent__, energy__
parameters        = muh.1, muh.2, rho
sigma_beta        = sigma_beta, sigma_h

-------------------------

julia> describe(chns_itp, sections=[:internals])
2-element Array{ChainDataFrame,1}

Summary Statistics

│ Row │ parameters │ mean     │ std        │ naive_se   │ mcse       │ ess     │
│     │ Symbol     │ Float64  │ Float64    │ Float64    │ Float64    │ Any     │
├─────┼────────────┼──────────┼────────────┼────────────┼────────────┼─────────┤
│ 1   │ muh.1      │ -1.81285 │ 1.14118    │ 0.0104175  │ 0.0199422  │ 12000.0 │
│ 2   │ muh.2      │ 9.77948  │ 1.1523     │ 0.010519   │ 0.0204296  │ 12000.0 │
│ 3   │ rho        │ 0.702844 │ 0.00381966 │ 3.48686e-5 │ 6.20015e-5 │ 12000.0 │

Quantiles

│ Row │ parameters │ 2.5%     │ 25.0%    │ 50.0%    │ 75.0%    │ 97.5%    │
│     │ Symbol     │ Float64  │ Float64  │ Float64  │ Float64  │ Float64  │
├─────┼────────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│ 1   │ muh.1      │ -4.14123 │ -2.46862 │ -1.80394 │ -1.15061 │ 0.439377 │
│ 2   │ muh.2      │ 7.37031  │ 9.13042  │ 9.79898  │ 10.4611  │ 12.02    │
│ 3   │ rho        │ 0.695152 │ 0.700284 │ 0.702863 │ 0.705434 │ 0.710236 │

-------------------------

julia> describe(chns_itp, sections=[:internals])
2-element Array{ChainDataFrame,1}

Summary Statistics

│ Row │ parameters    │ mean       │ std        │ naive_se    │ mcse        │ ess     │
│     │ Symbol        │ Float64    │ Float64    │ Float64     │ Float64     │ Any     │
├─────┼───────────────┼────────────┼────────────┼─────────────┼─────────────┼─────────┤
│ 1   │ accept_stat__ │ 0.987972   │ 0.0177439  │ 0.000161978 │ 0.000328735 │ 12000.0 │
│ 2   │ divergent__   │ 0.0        │ 0.0        │ 0.0         │ 0.0         │ 12000.0 │
│ 3   │ energy__      │ 11246.0    │ 10.1169    │ 0.0923543   │ 0.167905    │ 12000.0 │
│ 4   │ lp__          │ -11199.1   │ 7.38799    │ 0.0674429   │ 0.124345    │ 12000.0 │
│ 5   │ n_leapfrog__  │ 522.776    │ 78.6515    │ 0.717987    │ 2.44133     │ 12000.0 │
│ 6   │ stepsize__    │ 0.00802054 │ 0.00104081 │ 9.50121e-6  │ 9.54065e-5  │ 12000.0 │
│ 7   │ treedepth__   │ 9.00242    │ 0.0841313  │ 0.000768011 │ 0.00140026  │ 12000.0 │

Quantiles

│ Row │ parameters    │ 2.5%       │ 25.0%      │ 50.0%      │ 75.0%      │ 97.5%     │
│     │ Symbol        │ Float64    │ Float64    │ Float64    │ Float64    │ Float64   │
├─────┼───────────────┼────────────┼────────────┼────────────┼────────────┼───────────┤
│ 1   │ accept_stat__ │ 0.941934   │ 0.984589   │ 0.994243   │ 0.998261   │ 0.999933  │
│ 2   │ divergent__   │ 0.0        │ 0.0        │ 0.0        │ 0.0        │ 0.0       │
│ 3   │ energy__      │ 11227.5    │ 11239.0    │ 11245.5    │ 11252.6    │ 11267.2   │
│ 4   │ lp__          │ -11214.5   │ -11203.8   │ -11198.6   │ -11193.9   │ -11185.6  │
│ 5   │ n_leapfrog__  │ 511.0      │ 511.0      │ 511.0      │ 511.0      │ 511.0     │
│ 6   │ stepsize__    │ 0.00642041 │ 0.00718884 │ 0.00809765 │ 0.00885598 │ 0.0094627 │
│ 7   │ treedepth__   │ 9.0        │ 9.0        │ 9.0        │ 9.0        │ 9.0       │

