Baytes.PrintedParameterType
struct PrintedParameter{A<:Tuple, B<:Tuple}

Contains several useful information for sampled parameter.

Fields

  • tagged::Tuple: Unique tagged parameter of all kernels.

  • printed::Tuple: Parameter names based on their dimension

Baytes.SampleInfoType
struct SampleInfo{A<:Baytes.PrintedParameter, U<:UpdateBool, B<:UpdateBool}

Contains several useful information for constructing sampler.

Fields

  • printedparam::Baytes.PrintedParameter: Parameter settings for printing.

  • iterations::Int64: Total number of sampling iterations.

  • burnin::Int64: Burnin iterations.

  • thinning::Int64: Number of consecutive samples taken for diagnostics output.

  • Nalgorithms::Int64: Number of algorithms used while sampling.

  • Nchains::Int64: Number of chains used while sampling.

  • captured::UpdateBool: Boolean if sampler need to be updated after a proposal run. This is the case for, e.g. PMCMC., or for adaptive tempering.

  • tempered::UpdateBool: Boolean if temperature is adapted for target function.

Baytes.TraceType
struct Trace{C<:TraceSummary, A<:NamedTuple, B}

Contains sampling chain and diagnostics for given algorithms.

Fields

  • val::Array{Vector{A}, 1} where A<:NamedTuple: Model samples ~ out vector for corresponding chain, inner vector for iteration

  • diagnostics::Vector: Algorithm diagnostics ~ out vector for corresponding chain, inner vector for iteration

  • summary::TraceSummary: Information about trace used for postprocessing.

Baytes.TraceSummaryType
struct TraceSummary{A<:TemperingMethod, B<:Union{DataTune, Vector{<:DataTune}}, D<:SampleDefault, S<:SampleInfo}

Contains useful information for post-sampling analysis. Also allows to continue sampling with given sampler.

Fields

  • tempertune::TemperingMethod: Tuning container for temperature tempering

  • datatune::Union{DataTune, Vector{<:DataTune}}: Tuning container for data tempering

  • default::SampleDefault: Default settings used for sample function

  • info::SampleInfo: Information about trace used for postprocessing.

  • progress::ProgressMeter.Progress: Progress Log while sampling.

Baytes.TraceTransformType
struct TraceTransform{T<:ModelWrappers.Tagged, P}

Contains arguments for trace to extract parameter from a 'Trace'.

Fields

  • tagged::ModelWrappers.Tagged: Contains parameter where output information is printed.

  • paramnames::Any: Parameter names based on tagged model parameter.

  • chains::Vector{Int64}: Chain indices that are used for output diagnostics.

  • algorithms::Vector{Int64}: Algorithm indices that are used for output diagnostics.

  • burnin::Int64: Number of burnin steps before output diagnostics are taken.

  • thinning::Int64: Number of steps that are set between 2 consecutive samples.

  • maxiterations::Int64: Maximum number of iterations to be collected for each chain.

  • effective_iterations::StepRange{Int64, Int64}: StepRange for indices of effective samples

Baytes.TransformInfoType
struct TransformInfo

Contains arguments for trace to extract parameter. Used to construct a 'TraceTransform'.

Fields

  • chains::Vector{Int64}: Chain indices that are used for output diagnostics.

  • algorithms::Vector{Int64}: Algorithm indices that are used for output diagnostics.

  • burnin::Int64: Number of burnin steps before output diagnostics are taken.

  • thinning::Int64: Number of steps that are set between 2 consecutive samples.

  • maxiterations::Int64: Maximum number of iterations to be collected for each chain.

  • effective_iterations::StepRange{Int64, Int64}: StepRange for indices of effective samples

Base.summaryFunction
summary(trace, algorithmᵛ, transform)
summary(trace, algorithmᵛ, transform, printdefault)

Print summary of parameter chain and diagnostics to REPL.

Examples

Baytes.chainsummaryFunction
chainsummary(trace, transform)
chainsummary(trace, transform, printdefault)

Return summary for trace parameter chains. 'printdefault' defines quantiles and number of digits for printing.

Examples

Baytes.constructMethod
construct(tempering, model, chains)

Construct a Tempering tuning struct with the appropriate type for model parameter.

Examples

Baytes.constructMethod
construct(model, datatune, chains, args)

Construct separate models and data tuning container for each chain.

Examples

Baytes.constructMethod
construct(
    _rng,
    model,
    data,
    default,
    tempering,
    datatune,
    chains,
    updatesampler,
    args
)

Construct chains MCMC chains and initiate all algorithms stated in args separately. A separate model for each chain is provided to avoid pointer issues. If args is a single SMC algorithm, chains will not be separately allocated but instead used within the algorithm. Note that smc still works as intended if used alongside other mcmc sampler in args.

Examples

Baytes.diagnosticsbufferMethod
diagnosticsbuffer(diagtypes, iterations, Nchains, args)

Return buffer vector of type diagtypes. Comes from function infer.

Examples

Baytes.flatten_chainvalsMethod
flatten_chainvals(trace, transform)

Flatten Vector of Parameter NamedTuples into a Matrix, where each row represents draws for a single parameter.

Examples

Baytes.get_chaindiagnosticsMethod
get_chaindiagnostics(
    diagnostics,
    chain,
    Nalgorithm,
    effective_iterations
)

Obtain parameter diagnostics from trace at chain chain, excluding first burnin samples.

Examples

Baytes.get_chainvalsMethod
get_chainvals(val, chain, effective_iterations)

Return a view of a specific index 'chain' for Vector of Parameter chains of NamedTuples with index 'effective_iterations'.

Examples

Baytes.is_stuckMethod
is_stuck(arr3D)

Check if any parameter has been stuck at each iteration in any chain, in which case chainsummary will skip computations.

Examples

Baytes.maxiterationsMethod
maxiterations(datatune, iterations)

Obtain maximum number of iterations based on datatune. This will always be user input, except if rolling/expanding data is used, in which case iterations are capped.

Examples

Baytes.merge_chainvalsMethod
merge_chainvals(trace, transform)

Merge Vector of Parameter chains of NamedTuples into a single vector.

Examples

Baytes.mergediagnosticsMethod
mergediagnostics(
    paramdiagnostic,
    paramquantiles,
    chainparamdiagnostic
)

Merge all statistics for all parameter.

Examples

Baytes.paramquantilesMethod
paramquantiles(vec, printdefault)

Compute quantiles provided by printdefault for parameter.

Examples

Baytes.printchainsummaryFunction
printchainsummary(model, trace, transform, backend)
printchainsummary(
    model,
    trace,
    transform,
    backend,
    printdefault;
    kwargs...
)

Add a ModelWrapper struct 'model' as a function argument to print model.val as "true" parameter in table.

Examples

Baytes.printchainsummaryFunction
printchainsummary(trace, transform, backend)
printchainsummary(
    trace,
    transform,
    backend,
    printdefault;
    kwargs...
)

Print summary for trace parameter chains. backend may be Val(:text), or Val(:latex).

Examples

Baytes.printdiagnosticssummaryFunction
printdiagnosticssummary(
    trace,
    algorithmᵛ,
    transform,
    backend
)
printdiagnosticssummary(
    trace,
    algorithmᵛ,
    transform,
    backend,
    printdefault;
    kwargs...
)

Return summary for trace parameter diagnostics, backend may be Val(:text), or Val(:latex).

Examples

Baytes.printedparamMethod
printedparam(datatune, sym, algorithm)

Obtain all parameter where output diagnostics can be printed. Separate step to showparam in case parameter is increasing over time and cannot be printed

Examples

Baytes.progressMethod
progress(report, info)

Return Progress struct with arguments from info for sampling session.

Examples

Baytes.savechainsummaryFunction
savechainsummary(trace, transform)
savechainsummary(trace, transform, printdefault)
savechainsummary(trace, transform, printdefault, name)

Save summary for trace parameter chains as html file.

Examples

Baytes.savechainsummaryFunction
savechainsummary(model, trace, transform)
savechainsummary(model, trace, transform, printdefault)
savechainsummary(
    model,
    trace,
    transform,
    printdefault,
    name
)

Add a ModelWrapper struct 'model' as a function argument to save model.val as "true" parameter in table.

Examples

Baytes.savetraceFunction
savetrace(trace, model, algorithm)
savetrace(trace, model, algorithm, name)

Save trace, model and algorithm to current working directory with name 'name'.

Examples

Baytes.showparamMethod
showparam(model, datatune, constructor)

Return all unique targetted parameter, and parameter where diagnostics will be printed. Separate to get_sym.

Examples

Baytes.trace_to_2DArrayMethod
trace_to_2DArray(trace, transform)

Change trace.val to 2d Array. First dimension is iterations*chains, second number of parameter.

Examples

Baytes.trace_to_2DArrayᵤMethod
trace_to_2DArrayᵤ(trace, transform)

Change trace.val to 2d Array in unconstrained space. First dimension is iterations*chains, second number of parameter.

Examples

Baytes.trace_to_3DArrayMethod
trace_to_3DArray(trace, transform)

Change trace.val to 3d Array that is consistent with MCMCCHains dimensons. First dimension is iterations, second number of parameter, third number of chains.

Examples

Baytes.trace_to_3DArrayᵤMethod
trace_to_3DArrayᵤ(trace, transform)

Change trace.val to 3d Array in unconstrained space that is consistent with MCMCCHains dimensons. First dimension is iterations, second number of parameter, third number of chains.

Examples

Baytes.trace_to_crosschainmeanMethod
trace_to_crosschainmean(trace, transform)

Change trace.val to 3d Array and return Posterior mean as NamedTuple and as Vector for each parameter for each MCMC iteration across MCMC kernels

Examples

Baytes.trace_to_posteriormeanMethod
trace_to_posteriormean(mod_array, transform)

Change trace.val to 3d Array and return Posterior mean as NamedTuple and as Vector

Examples

Baytes.updateMethod
update(datatune, temperingadaption, smc)

Check if we can capture results from last proposal step. Typically only possible if a single MCMC or SMC step applied.

Examples

BaytesCore.inferMethod
infer(_rng, diagnostics, algorithmsᵛ, model, data)

Infer types of all Diagnostics container.

Examples

BaytesCore.propose!Method
propose!(_rng, trace, algorithmᵛ, modelᵛ, data)

Propose new parameter for each model in modelᵛ given data with algorithms algorithmᵛ. A separate model for each chain is provided to avoid pointer issues. If args is a single SMC algorithm, chains will not be separately allocated but instead used within the algorithm. Note that smc still works as intended if used alongside other mcmc sampler in args.

Examples

BaytesCore.update!Method
update!(tempertune, trace, algorithm, iter)

Update tempering tune based on output diagnostics of last kernels in each chain.

Examples

StatsBase.sample!Method
sample!(iterations, _rng, model, data, trace, algorithmᵛ)

Continue sampling with all algorithms in algorithm.

Examples

StatsBase.sampleMethod
sample(_rng, model, data, args; default)

Sample model parameter given data with args algorithm. Default sampling arguments given in default keyword.

Examples