Code
# fit models
stat_chain = sample(stat_mod, NUTS(), MCMCThreads(), 10_000, 4)
nonstat_chain = sample(nonstat_mod, NUTS(), MCMCThreads(), 10_000, 4)
pdo_chain = sample(pdo_mod, NUTS(), MCMCThreads(), 10_000, 4)
stat_est = mean(stat_chain)[:, 2]
nonstat_est = mean(nonstat_chain)[:, 2]
pdo_est = mean(pdo_chain)[:, 2]
stat_bayes = loglikelihood(stat_mod, (μ = stat_est[1], σ = stat_est[2], ξ = stat_est[3]))
nonstat_bayes = loglikelihood(nonstat_mod, (a = nonstat_est[1], b = nonstat_est[2], σ = nonstat_est[3], ξ = nonstat_est[4]))
pdo_bayes = loglikelihood(pdo_mod, (a = pdo_est[1], b = pdo_est[2], σ = pdo_est[3], ξ = pdo_est[4]))
stat_ll = mean([loglikelihood(stat_mod, row) for row in eachrow(DataFrame(stat_chain))])
nonstat_ll = mean([loglikelihood(nonstat_mod, row) for row in eachrow(DataFrame(nonstat_chain))])
pdo_ll = mean([loglikelihood(pdo_mod, row) for row in eachrow(DataFrame(pdo_chain))])
stat_dic = 2 * stat_ll - stat_bayes
nonstat_dic = 2 * nonstat_ll - nonstat_bayes
pdo_dic = 2 * pdo_ll - pdo_bayes
model_dic = DataFrame(Model=["Stationary", "Time", "PDO"], AIC=trunc.(Int64, round.(-2 * [stat_aic, nonstat_aic, pdo_aic]; digits=0)), DIC=trunc.(Int64, round.(-2 * [stat_dic, nonstat_dic, pdo_dic]; digits=0)))┌ Warning: Only a single thread available: MCMC chains are not sampled in parallel └ @ AbstractMCMC ~/.julia/packages/AbstractMCMC/kwj9g/src/sample.jl:384 Sampling (1 thread) 0%| | ETA: N/A ┌ Info: Found initial step size └ ϵ = 0.0015625 ┌ Info: Found initial step size └ ϵ = 0.05 Sampling (1 thread) 25%|███████▊ | ETA: 0:00:28 Sampling (1 thread) 50%|███████████████▌ | ETA: 0:00:11 ┌ Info: Found initial step size └ ϵ = 0.00625 ┌ Info: Found initial step size └ ϵ = 0.0125 Sampling (1 thread) 75%|███████████████████████▎ | ETA: 0:00:04 Sampling (1 thread) 100%|███████████████████████████████| Time: 0:00:13 Sampling (1 thread) 100%|███████████████████████████████| Time: 0:00:13 ┌ Warning: Only a single thread available: MCMC chains are not sampled in parallel └ @ AbstractMCMC ~/.julia/packages/AbstractMCMC/kwj9g/src/sample.jl:384 Sampling (1 thread) 0%| | ETA: N/A ┌ Info: Found initial step size └ ϵ = 0.00625 ┌ Info: Found initial step size └ ϵ = 0.0125 Sampling (1 thread) 25%|███████▊ | ETA: 0:00:18 Sampling (1 thread) 50%|███████████████▌ | ETA: 0:00:08 ┌ Info: Found initial step size └ ϵ = 0.05 ┌ Info: Found initial step size └ ϵ = 0.05 Sampling (1 thread) 75%|███████████████████████▎ | ETA: 0:00:03 Sampling (1 thread) 100%|███████████████████████████████| Time: 0:00:12 Sampling (1 thread) 100%|███████████████████████████████| Time: 0:00:12 ┌ Warning: Only a single thread available: MCMC chains are not sampled in parallel └ @ AbstractMCMC ~/.julia/packages/AbstractMCMC/kwj9g/src/sample.jl:384 Sampling (1 thread) 0%| | ETA: N/A ┌ Info: Found initial step size └ ϵ = 0.025 ┌ Info: Found initial step size └ ϵ = 0.2 Sampling (1 thread) 25%|███████▊ | ETA: 0:00:12 Sampling (1 thread) 50%|███████████████▌ | ETA: 0:00:06 ┌ Info: Found initial step size └ ϵ = 0.2 ┌ Info: Found initial step size └ ϵ = 0.2 Sampling (1 thread) 75%|███████████████████████▎ | ETA: 0:00:03 Sampling (1 thread) 100%|███████████████████████████████| Time: 0:00:09 Sampling (1 thread) 100%|███████████████████████████████| Time: 0:00:09
| Row | Model | AIC | DIC |
|---|---|---|---|
| String | Int64 | Int64 | |
| 1 | Stationary | 1421 | 1421 |
| 2 | Time | 1413 | 1413 |
| 3 | PDO | 1418 | 1419 |