using LinearAlgebra, Random, Statistics
include("conjugate.jl"); include("model.jl"); include("accounting.jl")
# How often does the 90% interval contain the truth? 2,000 datasets x 1,000 draws.
t = truth()
function covers(d)
    P = posteriors(d)
    D = [account_draw(P) for _ in 1:1000]
    [quantile(getfield.(D, f), 0.05) <= getfield(t, f) <= quantile(getfield.(D, f), 0.95) for f in keys(t)]
end
Random.seed!(11)
C = reduce(hcat, [covers(simulate(156)) for _ in 1:2000])
for (f, x) in zip(keys(t), mean(C, dims = 2)); println(rpad(f, 16), round(x, digits = 2)); end
