Posterior statistics
The methods listed below are defined in src/stats.jl
.
StatsBase.autocor
— Functionautocor(
chains;
append_chains = true,
demean = true,
[lags,]
kwargs...,
)
Compute the autocorrelation of each parameter for the chain.
The default lags
are [1, 5, 10, 50]
, upper-bounded by n - 1
where n
is the number of samples used in the estimation.
Setting append_chains=false
will return a vector of dataframes containing the autocorrelations for each chain.
DataAPI.describe
— Functiondescribe(io, chains[;
q = [0.025, 0.25, 0.5, 0.75, 0.975],
etype = :bm,
kwargs...])
Print the summary statistics and quantiles for the chain.
Statistics.mean
— Functionmean(chains[, params; kwargs...])
Calculate the mean of a chain.
StatsBase.summarystats
— Functionfunction summarystats(
chains;
sections = _default_sections(chains),
append_chains= true,
autocov_method::AbstractAutocovMethod = AutocovMethod(),
maxlag = 250,
kwargs...
)
Compute the mean, standard deviation, Monte Carlo standard error, bulk- and tail- effective sample size, and $\widehat{R}$ diagnostic for each parameter in the chain.
Setting append_chains=false
will return a vector of dataframes containing the summary statistics for each chain.
When estimating the effective sample size, autocorrelations are computed for at most maxlag
lags.
Statistics.quantile
— Functionquantile(chains[; q = [0.025, 0.25, 0.5, 0.75, 0.975], append_chains = true, kwargs...])
Compute the quantiles for each parameter in the chain.
Setting append_chains=false
will return a vector of dataframes containing the quantiles for each chain.
MCMCChains.hpd
— Functionhpd(chn::Chains; alpha::Real=0.05, kwargs...)
Return the highest posterior density interval representing 1-alpha
probability mass.
Note that this will return a single interval and will not return multiple intervals for discontinuous regions.
Examples
julia> val = rand(500, 2, 3);
julia> chn = Chains(val, [:a, :b]);
julia> hpd(chn)
HPD
parameters lower upper
Symbol Float64 Float64
a 0.0554 0.9944
b 0.0114 0.9460