diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 5fbe9b9e..956509ef 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-18T11:44:57","documenter_version":"1.8.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.2","generation_timestamp":"2024-12-06T15:21:09","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/chains/index.html b/dev/chains/index.html index b371b323..1a37dd7e 100644 --- a/dev/chains/index.html +++ b/dev/chains/index.html @@ -1,464 +1,5 @@ -Chains · MCMCChains.jl - - - - - - -

Chains

The methods listed below are defined in src/chains.jl.

MCMCChains.ChainsMethod
Chains(c::Chains, section::Union{Symbol,AbstractString})
+Chains · MCMCChains.jl

Chains

The methods listed below are defined in src/chains.jl.

MCMCChains.ChainsMethod
Chains(c::Chains, section::Union{Symbol,AbstractString})
 Chains(c::Chains, sections)

Return a new chain with only a specific section or multiple sections pulled out.

Examples

julia> chn = Chains(rand(100, 2, 1), [:a, :b], Dict(:internals => [:a]));
 
 julia> names(chn)
@@ -470,7 +11,7 @@
 
 julia> names(chn2)
 1-element Vector{Symbol}:
- :a
source
Base.getMethod
Base.get(c::Chains, v::Symbol; flatten=false)
+ :a
source
Base.getMethod
Base.get(c::Chains, v::Symbol; flatten=false)
 Base.get(c::Chains, vs::Vector{Symbol}; flatten=false)

Return a NamedTuple with v as the key, and matching parameter names as the values.

Passing flatten=true will return a NamedTuple with keys ungrouped.

Example

julia> chn = Chains([1:2 3:4]);
 
 julia> get(chn, :param_1)
@@ -480,13 +21,13 @@
 (param_2 = [3; 4;;],)
 
 julia> get(chn, :param_1; flatten=true)
-(param_1 = 1,)
source
Base.getMethod
get(c::Chains; section::Union{Symbol,AbstractVector{Symbol}}, flatten=false)

Return all parameters in a given section(s) as a NamedTuple.

Passing flatten=true will return a NamedTuple with keys ungrouped.

Example

julia> chn = Chains([1:2 3:4], [:a, :b], Dict(:internals => [:a]));
+(param_1 = 1,)
source
Base.getMethod
get(c::Chains; section::Union{Symbol,AbstractVector{Symbol}}, flatten=false)

Return all parameters in a given section(s) as a NamedTuple.

Passing flatten=true will return a NamedTuple with keys ungrouped.

Example

julia> chn = Chains([1:2 3:4], [:a, :b], Dict(:internals => [:a]));
 
 julia> get(chn; section=:parameters)
 (b = [3; 4;;],)
 
 julia> get(chn; section=[:internals])
-(a = [1; 2;;],)
source
Base.namesMethod
names(chains::Chains, sections)

Return the parameter names of the sections in the chains.

source
Base.namesMethod
names(chains::Chains, section::Symbol)

Return the parameter names of a section in the chains.

source
Base.namesMethod
names(chains::Chains)

Return the parameter names in the chains.

source
Base.rangeMethod
range(chains::Chains)

Return the range of iteration indices of the chains.

source
Base.sortMethod
sort(c::Chains[; lt=NaturalSort.natural])

Return a new column-sorted version of c.

By default the columns are sorted in natural sort order.

source
MCMCChains.compute_durationMethod
compute_duration(c::Chains; start=start_times(c), stop=stop_times(c))

Calculate the compute time for all chains in seconds.

The duration is calculated as the sum of start - stop in seconds.

compute_duration is more useful in cases of parallel sampling, where wall_duration may understate how much computation time was utilitzed.

source
MCMCChains.get_paramsMethod
get_params(c::Chains; flatten=false)

Return all parameters packaged as a NamedTuple. Variables with a bracket in their name (as in "P[1]") will be grouped into the returned value as P.

Passing flatten=true will return a NamedTuple with keys ungrouped.

Example

julia> chn = Chains(1:5);
+(a = [1; 2;;],)
source
Base.namesMethod
names(chains::Chains, sections)

Return the parameter names of the sections in the chains.

source
Base.namesMethod
names(chains::Chains, section::Symbol)

Return the parameter names of a section in the chains.

source
Base.namesMethod
names(chains::Chains)

Return the parameter names in the chains.

source
Base.rangeMethod
range(chains::Chains)

Return the range of iteration indices of the chains.

source
Base.sortMethod
sort(c::Chains[; lt=NaturalSort.natural])

Return a new column-sorted version of c.

By default the columns are sorted in natural sort order.

source
MCMCChains.compute_durationMethod
compute_duration(c::Chains; start=start_times(c), stop=stop_times(c))

Calculate the compute time for all chains in seconds.

The duration is calculated as the sum of start - stop in seconds.

compute_duration is more useful in cases of parallel sampling, where wall_duration may understate how much computation time was utilitzed.

source
MCMCChains.get_paramsMethod
get_params(c::Chains; flatten=false)

Return all parameters packaged as a NamedTuple. Variables with a bracket in their name (as in "P[1]") will be grouped into the returned value as P.

Passing flatten=true will return a NamedTuple with keys ungrouped.

Example

julia> chn = Chains(1:5);
 
 julia> x = get_params(chn);
 
@@ -499,11 +40,11 @@
  2
  3
  4
- 5
source
MCMCChains.groupMethod
group(chains::Chains, name::Union{AbstractString,Symbol}; index_type::Symbol=:bracket)

Return a subset of the chain containing parameters with the same name, but a different index.

Bracket indexing format in the form of :name[index] is assumed by default. Use index_type=:dot for parameters with dot indexing, i.e. :sym.index.

source
MCMCChains.headerMethod
header(c::Chains; section=missing)

Return a string containing summary information for a Chains object. If the section keyword is used, this function prints only the relevant section header.

Example

# Printing the whole header.
+ 5
source
MCMCChains.groupMethod
group(chains::Chains, name::Union{AbstractString,Symbol}; index_type::Symbol=:bracket)

Return a subset of the chain containing parameters with the same name, but a different index.

Bracket indexing format in the form of :name[index] is assumed by default. Use index_type=:dot for parameters with dot indexing, i.e. :sym.index.

source
MCMCChains.headerMethod
header(c::Chains; section=missing)

Return a string containing summary information for a Chains object. If the section keyword is used, this function prints only the relevant section header.

Example

# Printing the whole header.
 header(chn)
 
 # Print only one section's header.
-header(chn, section = :parameter)
source
MCMCChains.max_stopMethod
max_stop(c::Chains)

Retrieve the maximum of the stop times (as DateTime) from chain.info.

It is assumed that the start times are stored in chain.info.stop_time as DateTime or unix timestamps of type Float64.

source
MCMCChains.min_startMethod
min_start(c::Chains)

Retrieve the minimum of the start times (as DateTime) from chain.info.

It is assumed that the start times are stored in chain.info.start_time as DateTime or unix timestamps of type Float64.

source
MCMCChains.namesingroupMethod
namesingroup(chains::Chains, sym::Union{AbstractString,Symbol}; index_type::Symbol=:bracket)

Return the parameters with the same name sym, but have a different index. Bracket indexing format in the form of :sym[index] is assumed by default. Use index_type=:dot for parameters with dot indexing, i.e. :sym.index.

If the chain contains a parameter of name :sym it will be returned as well.

Example

julia> chn = Chains(rand(100, 2, 2), ["A[1]", "A[2]"]);
+header(chn, section = :parameter)
source
MCMCChains.max_stopMethod
max_stop(c::Chains)

Retrieve the maximum of the stop times (as DateTime) from chain.info.

It is assumed that the start times are stored in chain.info.stop_time as DateTime or unix timestamps of type Float64.

source
MCMCChains.min_startMethod
min_start(c::Chains)

Retrieve the minimum of the start times (as DateTime) from chain.info.

It is assumed that the start times are stored in chain.info.start_time as DateTime or unix timestamps of type Float64.

source
MCMCChains.namesingroupMethod
namesingroup(chains::Chains, sym::Union{AbstractString,Symbol}; index_type::Symbol=:bracket)

Return the parameters with the same name sym, but have a different index. Bracket indexing format in the form of :sym[index] is assumed by default. Use index_type=:dot for parameters with dot indexing, i.e. :sym.index.

If the chain contains a parameter of name :sym it will be returned as well.

Example

julia> chn = Chains(rand(100, 2, 2), ["A[1]", "A[2]"]);
 
 julia> namesingroup(chn, :A)
 2-element Vector{Symbol}:
@@ -519,7 +60,7 @@
 julia> namesingroup(chn, :A; index_type=:dot)
 2-element Vector{Symbol}:
  Symbol("A.1")
- Symbol("A.2")
source
MCMCChains.replacenamesMethod
replacenames(chains::Chains, dict::AbstractDict)

Replace parameter names by creating a new Chains object that shares the same underlying data.

Examples

julia> chn = Chains(rand(100, 2, 2), ["one", "two"]);
+ Symbol("A.2")
source
MCMCChains.replacenamesMethod
replacenames(chains::Chains, dict::AbstractDict)

Replace parameter names by creating a new Chains object that shares the same underlying data.

Examples

julia> chn = Chains(rand(100, 2, 2), ["one", "two"]);
 
 julia> chn2 = replacenames(chn, "one" => "A");
 
@@ -533,5 +74,4 @@
 julia> names(chn3) 
 2-element Vector{Symbol}:
  :one
- :B
source
MCMCChains.resetrangeMethod
resetrange(chains::Chains)

Generate a new chain from chains with iterations indexed by 1:n, where n is the number of samples per chain.

The new chain and chains share the same data in memory.

source
MCMCChains.set_sectionMethod
set_section(chains::Chains, namemap)

Create a new Chains object from chains with the provided namemap mapping of parameter names.

Both chains share the same underlying data. Any parameters in the chain that are unassigned will be placed into the :parameters section.

source
MCMCChains.setinfoMethod
setinfo(c::Chains, n::NamedTuple)

Return a new Chains object with a NamedTuple type n placed in the info field.

Example

new_chn = setinfo(chn, NamedTuple{(:a, :b)}((1, 2)))
source
MCMCChains.setrangeMethod
setrange(chains::Chains, range::AbstractVector{Int})

Generate a new chain from chains with iterations indexed by range.

The new chain and chains share the same data in memory.

source
MCMCChains.start_timesMethod
start_times(c::Chains)

Retrieve the contents of c.info.start_time, or missing if no start_time is set.

source
MCMCChains.stop_timesMethod
stop_times(c::Chains)

Retrieve the contents of c.info.stop_time, or missing if no stop_time is set.

source
MCMCChains.wall_durationMethod
wall_duration(c::Chains; start=min_start(c), stop=max_stop(c))

Calculate the wall clock time for all chains in seconds.

The duration is calculated as stop - start, where as default stop is the latest stopping time and start is the earliest starting time.

source
- + :B
source
MCMCChains.resetrangeMethod
resetrange(chains::Chains)

Generate a new chain from chains with iterations indexed by 1:n, where n is the number of samples per chain.

The new chain and chains share the same data in memory.

source
MCMCChains.set_sectionMethod
set_section(chains::Chains, namemap)

Create a new Chains object from chains with the provided namemap mapping of parameter names.

Both chains share the same underlying data. Any parameters in the chain that are unassigned will be placed into the :parameters section.

source
MCMCChains.setinfoMethod
setinfo(c::Chains, n::NamedTuple)

Return a new Chains object with a NamedTuple type n placed in the info field.

Example

new_chn = setinfo(chn, NamedTuple{(:a, :b)}((1, 2)))
source
MCMCChains.setrangeMethod
setrange(chains::Chains, range::AbstractVector{Int})

Generate a new chain from chains with iterations indexed by range.

The new chain and chains share the same data in memory.

source
MCMCChains.start_timesMethod
start_times(c::Chains)

Retrieve the contents of c.info.start_time, or missing if no start_time is set.

source
MCMCChains.stop_timesMethod
stop_times(c::Chains)

Retrieve the contents of c.info.stop_time, or missing if no stop_time is set.

source
MCMCChains.wall_durationMethod
wall_duration(c::Chains; start=min_start(c), stop=max_stop(c))

Calculate the wall clock time for all chains in seconds.

The duration is calculated as stop - start, where as default stop is the latest stopping time and start is the earliest starting time.

source
diff --git a/dev/default_plot.svg b/dev/default_plot.svg index 333c381f..242a600d 100644 --- a/dev/default_plot.svg +++ b/dev/default_plot.svg @@ -1,394 +1,394 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/diagnostics/index.html b/dev/diagnostics/index.html index 72195401..3a4fe83d 100644 --- a/dev/diagnostics/index.html +++ b/dev/diagnostics/index.html @@ -1,464 +1,5 @@ -Diagnostics · MCMCChains.jl - - - - - - -

Diagnostics

MCMCDiagnosticTools.discretediagMethod
discretediag(chains::Chains{<:Real}; sections, kwargs...)

Discrete diagnostic where method can be [:weiss, :hangartner, :DARBOOT, MCBOOT, :billinsgley, :billingsleyBOOT].

source
MCMCDiagnosticTools.rstarMethod
rstar(rng=Random.GLOBAL_RNG, classifier, chains::Chains; kwargs...)

Compute the $R^*$ convergence diagnostic of the MCMC chains with the classifier.

The keyword arguments supported here are the same as those in rstar for arrays of samples and chain indices.

Examples

julia> using MLJBase, MLJDecisionTreeInterface, Statistics
+Diagnostics · MCMCChains.jl

Diagnostics

MCMCDiagnosticTools.discretediagMethod
discretediag(chains::Chains{<:Real}; sections, kwargs...)

Discrete diagnostic where method can be [:weiss, :hangartner, :DARBOOT, MCBOOT, :billinsgley, :billingsleyBOOT].

source
MCMCDiagnosticTools.rstarMethod
rstar(rng=Random.GLOBAL_RNG, classifier, chains::Chains; kwargs...)

Compute the $R^*$ convergence diagnostic of the MCMC chains with the classifier.

The keyword arguments supported here are the same as those in rstar for arrays of samples and chain indices.

Examples

julia> using MLJBase, MLJDecisionTreeInterface, Statistics
 
 julia> chains = Chains(fill(4.0, 100, 2, 3));

One can compute the distribution of the $R^*$ statistic with the probabilistic classifier.

julia> distribution = rstar(DecisionTreeClassifier(), chains);
 
@@ -471,5 +12,4 @@
 julia> value = rstar(decisiontree_deterministic, chains);
 
 julia> isapprox(value, 1; atol=0.2)
-true
source
MCMCDiagnosticTools.essMethod
ess(chains::Chains; duration=compute_duration, kwargs...)

Estimate the effective sample size.

ESS per second options include duration=MCMCChains.compute_duration (the default) and duration=MCMCChains.wall_duration.

source
MCMCDiagnosticTools.ess_rhatMethod
ess_rhat(chains::Chains; duration=compute_duration, kwargs...)

Estimate the effective sample size and the $\widehat{R}$ diagnostic

ESS per second options include duration=MCMCChains.compute_duration (the default) and duration=MCMCChains.wall_duration.

source
- +true
source
MCMCDiagnosticTools.essMethod
ess(chains::Chains; duration=compute_duration, kwargs...)

Estimate the effective sample size.

ESS per second options include duration=MCMCChains.compute_duration (the default) and duration=MCMCChains.wall_duration.

source
MCMCDiagnosticTools.ess_rhatMethod
ess_rhat(chains::Chains; duration=compute_duration, kwargs...)

Estimate the effective sample size and the $\widehat{R}$ diagnostic

ESS per second options include duration=MCMCChains.compute_duration (the default) and duration=MCMCChains.wall_duration.

source
diff --git a/dev/gadfly/ea9eaaaf.svg b/dev/gadfly/714faf7a.svg similarity index 78% rename from dev/gadfly/ea9eaaaf.svg rename to dev/gadfly/714faf7a.svg index c57c5808..23356775 100644 --- a/dev/gadfly/ea9eaaaf.svg +++ b/dev/gadfly/714faf7a.svg @@ -14,2902 +14,2902 @@ - - + + iteration - - - + + + 1 - + 2 - - + + - + - - + + chain - - - + + + - - + + 0 - + 50 - + 100 - - - - + + + + - - + + - + - + - + - + - - + + - + - + - + - - - - + + + + - - + + 100-1.3170073966224087 - - - + + + - - + + 99-0.40029943635033666 - - - + + + - - + + 980.6972595542907563 - - - + + + - - + + 97-0.02785112914556438 - - - + + + - - + + 961.7515935124939563 - - - + + + - - + + 95-0.7834646200290443 - - - + + + - - + + 94-1.6748886245113932 - - - + + + - - + + 930.7995427282249139 - - - + + + - - + + 920.23463374811805673 - - - + + + - - + + 911.293769717784966 - - - + + + - - + + 900.20646186508884512 - - - + + + - - + + 890.056262740305863 - - - + + + - - + + 881.7988458088762243 - - - + + + - - + + 870.06934477421655112 - - - + + + - - + + 86-0.15947801864590042 - - - + + + - - + + 85-1.4215279118772457 - - - + + + - - + + 84-0.7243430740097574 - - - + + + - - + + 830.27546822734094856 - - - + + + - - + + 820.14373571180540196 - - - + + + - - + + 810.11820990304244713 - - - + + + - - + + 801.04785677139905 - - - + + + - - + + 792.046826219090271 - - - + + + - - + + 780.6931774516533784 - - - + + + - - + + 770.23634933575411946 - - - + + + - - + + 76-1.9017315380575168 - - - + + + - - + + 75-0.6716639313516725 - - - + + + - - + + 740.16561303598530228 - - - + + + - - + + 731.8230219144963131 - - - + + + - - + + 72-0.6996125109601145 - - - + + + - - + + 710.26572718571270887 - - - + + + - - + + 70-0.6318776853297047 - - - + + + - - + + 69-1.2643200638210517 - - - + + + - - + + 681.2180309660309663 - - - + + + - - + + 671.207599651136355 - - - + + + - - + + 66-1.179310172506033 - - - + + + - - + + 65-0.5803486653961657 - - - + + + - - + + 64-1.5673105567040255 - - - + + + - - + + 63-0.6846532309561962 - - - + + + - - + + 62-0.09996933745614298 - - - + + + - - + + 61-0.22113054283049752 - - - + + + - - + + 600.023601396852706943 - - - + + + - - + + 59-0.9428845612205473 - - - + + + - - + + 581.1422321706271645 - - - + + + - - + + 57-0.8132592631864103 - - - + + + - - + + 560.3478988394302408 - - - + + + - - + + 550.0776076083118266 - - - + + + - - + + 549.003995354540034e-5 - - - + + + - - + + 530.34117637252767163 - - - + + + - - + + 52-1.6447947555655824 - - - + + + - - + + 511.3798903912177103 - - - + + + - - + + 50-0.057950125385393285 - - - + + + - - + + 49-1.5935910954027732 - - - + + + - - + + 48-0.8666356117956132 - - - + + + - - + + 470.7546892736809404 - - - + + + - - + + 46-0.516915979207887 - - - + + + - - + + 45-0.3968789358059078 - - - + + + - - + + 44-0.677952879128993 - - - + + + - - + + 430.6350953144896132 - - - + + + - - + + 421.7191582288176015 - - - + + + - - + + 410.9299691222852756 - - - + + + - - + + 400.3278482282465347 - - - + + + - - + + 39-0.8589604589573148 - - - + + + - - + + 380.8364380274230709 - - - + + + - - + + 370.8470692568665572 - - - + + + - - + + 36-0.33496314117612475 - - - + + + - - + + 35-2.228929694468137 - - - + + + - - + + 341.485039341191027 - - - + + + - - + + 33-0.9909198340836349 - - - + + + - - + + 320.04237259095788618 - - - + + + - - + + 310.25408821477268434 - - - + + + - - + + 302.102757531483797 - - - + + + - - + + 291.9018378096239243 - - - + + + - - + + 281.6504537238340808 - - - + + + - - + + 27-0.2149257768381886 - - - + + + - - + + 260.1679916079279958 - - - + + + - - + + 251.7515198504765537 - - - + + + - - + + 24-0.2840038654440679 - - - + + + - - + + 23-0.026663390100387662 - - - + + + - - + + 22-1.7038985995321474 - - - + + + - - + + 211.038522159025857 - - - + + + - - + + 20-0.06595387584872024 - - - + + + - - + + 19-0.2076437553115746 - - - + + + - - + + 181.3079348578610168 - - - + + + - - + + 171.2699752045539892 - - - + + + - - + + 16-0.17095725342097773 - - - + + + - - + + 15-1.3104536300681022 - - - + + + - - + + 14-0.6117288248632854 - - - + + + - - + + 13-0.4813367182763442 - - - + + + - - + + 12-1.1402671532526762 - - - + + + - - + + 111.4694189126971855 - - - + + + - - + + 10-0.8993403936196483 - - - + + + - - + + 91.320194125382146 - - - + + + - - + + 8-0.5210897985064225 - - - + + + - - + + 70.5421795776891958 - - - + + + - - + + 61.1430527046408987 - - - + + + - - + + 5-1.7053000154637998 - - - + + + - - + + 4-1.4347856048949175 - - - + + + - - + + 3-1.091609910127716 - - - + + + - - + + 20.40129707757664923 - - - + + + - - + + 1-0.048334548285784894 - - - + + + - - + + 1001.4366762359817762 - - - + + + - - + + 99-0.27695236221379405 - - - + + + - - + + 981.1176906357328824 - - - + + + - - + + 97-1.2822464762755095 - - - + + + - - + + 96-0.4235133898188647 - - - + + + - - + + 950.6795855307339771 - - - + + + - - + + 94-0.2913012227128743 - - - + + + - - + + 930.02293603210405277 - - - + + + - - + + 92-0.4256762334541209 - - - + + + - - + + 910.19373692167605475 - - - + + + - - + + 90-0.24333812013891884 - - - + + + - - + + 890.20190364782443823 - - - + + + - - + + 88-0.3525681037892463 - - - + + + - - + + 871.5469192067368922 - - - + + + - - + + 860.16238310335504091 - - - + + + - - + + 85-2.5922472485524723 - - - + + + - - + + 840.4204805117458879 - - - + + + - - + + 830.05074132073966857 - - - + + + - - + + 82-0.2646629387524596 - - - + + + - - + + 810.8277110005250106 - - - + + + - - + + 800.401333832487814 - - - + + + - - + + 790.4156677814949351 - - - + + + - - + + 780.22532822971800598 - - - + + + - - + + 77-0.09050580145153395 - - - + + + - - + + 761.4203438071308772 - - - + + + - - + + 750.32290760812887953 - - - + + + - - + + 74-0.2799081710936811 - - - + + + - - + + 730.8558339601919108 - - - + + + - - + + 720.775141207704635 - - - + + + - - + + 71-0.36162111046363865 - - - + + + - - + + 701.9364864617141557 - - - + + + - - + + 69-0.2175865393997627 - - - + + + - - + + 681.1926003140200372 - - - + + + - - + + 67-0.13275839324951963 - - - + + + - - + + 66-0.527485371415287 - - - + + + - - + + 650.33808644553539896 - - - + + + - - + + 64-0.6785980647909047 - - - + + + - - + + 63-1.11812885635664 - - - + + + - - + + 62-1.8332094514204258 - - - + + + - - + + 611.353529962046468 - - - + + + - - + + 60-0.5300325724641498 - - - + + + - - + + 59-2.142914281721973 - - - + + + - - + + 580.4527754970067588 - - - + + + - - + + 57-0.3462248564595316 - - - + + + - - + + 561.606867677487192 - - - + + + - - + + 55-0.46093048508323814 - - - + + + - - + + 54-0.5994624342683185 - - - + + + - - + + 53-1.0654494734333833 - - - + + + - - + + 52-0.5018756452659269 - - - + + + - - + + 510.1908345328088515 - - - + + + - - + + 501.3743205754505574 - - - + + + - - + + 490.9766336158526887 - - - + + + - - + + 48-0.5472075042190699 - - - + + + - - + + 47-1.6385042922765622 - - - + + + - - + + 46-1.1731892191910882 - - - + + + - - + + 450.012318553394717963 - - - + + + - - + + 441.0906344652111615 - - - + + + - - + + 43-0.6416526946477582 - - - + + + - - + + 420.4677845314450911 - - - + + + - - + + 410.1320383482645163 - - - + + + - - + + 40-0.3066449758522685 - - - + + + - - + + 390.1099962965732468 - - - + + + - - + + 38-1.2353191772453185 - - - + + + - - + + 370.2092977086822905 - - - + + + - - + + 360.9204370929735805 - - - + + + - - + + 352.3201136211436895 - - - + + + - - + + 34-0.4201832540131231 - - - + + + - - + + 33-0.33733229091944594 - - - + + + - - + + 32-2.139371812274496 - - - + + + - - + + 310.6804221598625804 - - - + + + - - + + 300.49284651602816437 - - - + + + - - + + 290.4307919416460598 - - - + + + - - + + 280.43434428320695867 - - - + + + - - + + 27-1.1085067647376519 - - - + + + - - + + 261.2007647471064902 - - - + + + - - + + 25-0.404748847963944 - - - + + + - - + + 24-0.5796515259221938 - - - + + + - - + + 230.10707007228253838 - - - + + + - - + + 221.2315247149004156 - - - + + + - - + + 21-0.05703182335572139 - - - + + + - - + + 200.03750681021624277 - - - + + + - - + + 190.5027519903361419 - - - + + + - - + + 180.2924546839750605 - - - + + + - - + + 17-0.7400982505064443 - - - + + + - - + + 160.048074780573415896 - - - + + + - - + + 15-0.2855224431546225 - - - + + + - - + + 14-0.12416743383726103 - - - + + + - - + + 13-1.1696984347807706 - - - + + + - - + + 120.6209298746604519 - - - + + + - - + + 11-1.4285468178456555 - - - + + + - - + + 100.2590370154245062 - - - + + + - - + + 91.2409330807365402 - - - + + + - - + + 81.4373617673978938 - - - + + + - - + + 7-1.9328588632207706 - - - + + + - - + + 60.9096181098283787 - - - + + + - - + + 5-0.535622996912645 - - - + + + - - + + 4-2.4599842138457295 - - - + + + - - + + 3-0.5438518614629236 - - - + + + - - + + 20.4101108122651928 - - - + + + - - + + 10.941406955003304 @@ -2920,2875 +2920,2875 @@ - - + + -4 - + -2 - + 0 - + 2 - + 4 - - + + B - - - - + + + + - - + + - + - + - + - + - - + + - + - + - + - - - - + + + + - - + + 1001.975678111290753 - - - + + + - - + + 99-1.148214894944383 - - - + + + - - + + 981.472041368106074 - - - + + + - - + + 97-0.11092530034855923 - - - + + + - - + + 960.7259532307466094 - - - + + + - - + + 95-0.3507861262216067 - - - + + + - - + + 94-0.6807046751186469 - - - + + + - - + + 931.2095936634569346 - - - + + + - - + + 92-0.6995458870194492 - - - + + + - - + + 910.4489884548577637 - - - + + + - - + + 901.0506991397216925 - - - + + + - - + + 89-0.41148570225372794 - - - + + + - - + + 880.5461944521664502 - - - + + + - - + + 87-2.5035167270593193 - - - + + + - - + + 86-0.2689183541064287 - - - + + + - - + + 85-0.4742626973194863 - - - + + + - - + + 840.19261896878385187 - - - + + + - - + + 83-0.1527497295540427 - - - + + + - - + + 820.38279018394923525 - - - + + + - - + + 81-0.6936248587932706 - - - + + + - - + + 800.3267683081896226 - - - + + + - - + + 79-0.7221304906165784 - - - + + + - - + + 780.847159866892365 - - - + + + - - + + 77-0.22798099366684765 - - - + + + - - + + 76-2.614427449667543 - - - + + + - - + + 750.20482024306092617 - - - + + + - - + + 74-3.523680851907596 - - - + + + - - + + 73-0.6127159506065392 - - - + + + - - + + 720.21680067657413898 - - - + + + - - + + 71-0.20284287945630028 - - - + + + - - + + 70-1.1792693340285716 - - - + + + - - + + 69-0.5199548163615003 - - - + + + - - + + 68-1.4051342918813192 - - - + + + - - + + 67-2.106542119187703 - - - + + + - - + + 66-1.1303673325719237 - - - + + + - - + + 65-1.9157728277280246 - - - + + + - - + + 64-0.45945858133064504 - - - + + + - - + + 63-0.12037498746539825 - - - + + + - - + + 620.039987330453786586 - - - + + + - - + + 610.11123853082358913 - - - + + + - - + + 60-1.5638502167572337 - - - + + + - - + + 590.6668723610785793 - - - + + + - - + + 580.1659225584306388 - - - + + + - - + + 57-0.626335088918323 - - - + + + - - + + 56-1.1607483441652193 - - - + + + - - + + 55-1.1509927035684273 - - - + + + - - + + 54-0.02086153477138904 - - - + + + - - + + 53-1.945666382687749 - - - + + + - - + + 520.07195940575935504 - - - + + + - - + + 51-0.24652630658494196 - - - + + + - - + + 50-1.4747934147016803 - - - + + + - - + + 49-0.22886593368631153 - - - + + + - - + + 48-0.011078282056609809 - - - + + + - - + + 47-1.8818384565623543 - - - + + + - - + + 46-1.1513160888929832 - - - + + + - - + + 45-0.5108013886371011 - - - + + + - - + + 44-0.20048970951530545 - - - + + + - - + + 43-1.028944700594261 - - - + + + - - + + 420.03299051340230315 - - - + + + - - + + 411.9201434658349528 - - - + + + - - + + 40-1.7584654204999675 - - - + + + - - + + 390.8795480434563197 - - - + + + - - + + 38-0.8139819317214846 - - - + + + - - + + 372.006516851124065 - - - + + + - - + + 36-0.8458923623756581 - - - + + + - - + + 350.23546360371899813 - - - + + + - - + + 34-0.3988460700692121 - - - + + + - - + + 33-0.14853892730600465 - - - + + + - - + + 32-1.0623038284827513 - - - + + + - - + + 31-1.3233016326858347 - - - + + + - - + + 300.5976636651258497 - - - + + + - - + + 290.7805137828509737 - - - + + + - - + + 28-0.7897891506068991 - - - + + + - - + + 27-1.0039903771723948 - - - + + + - - + + 26-0.9919763443329468 - - - + + + - - + + 25-2.0006269339365597 - - - + + + - - + + 24-0.9485510295399423 - - - + + + - - + + 23-0.8869047558327756 - - - + + + - - + + 221.2250485866919358 - - - + + + - - + + 210.7463870523534094 - - - + + + - - + + 200.7647290378600506 - - - + + + - - + + 191.3961315266833942 - - - + + + - - + + 180.44942506552056893 - - - + + + - - + + 17-0.17425915379390097 - - - + + + - - + + 16-2.1121744440732737 - - - + + + - - + + 15-0.969088497059294 - - - + + + - - + + 14-0.7963698061045712 - - - + + + - - + + 13-1.0174588264615183 - - - + + + - - + + 12-0.39094758418117787 - - - + + + - - + + 110.3492091063209483 - - - + + + - - + + 10-1.1033059771639697 - - - + + + - - + + 9-1.1135154756716357 - - - + + + - - + + 8-0.9882421284448939 - - - + + + - - + + 71.0271862840654467 - - - + + + - - + + 6-0.40438691858704967 - - - + + + - - + + 51.130349736357712 - - - + + + - - + + 4-0.4536805144639283 - - - + + + - - + + 31.001646754498137 - - - + + + - - + + 20.024529966504679514 - - - + + + - - + + 10.34002364317125844 - - - + + + - - + + 1001.0261537674110486 - - - + + + - - + + 99-1.1386220578824167 - - - + + + - - + + 98-0.32551754001843425 - - - + + + - - + + 970.5265509646904256 - - - + + + - - + + 961.9822600094629674 - - - + + + - - + + 951.3783455866052947 - - - + + + - - + + 941.2104050621967726 - - - + + + - - + + 931.1629645095923362 - - - + + + - - + + 92-0.21886169150055337 - - - + + + - - + + 910.8632727135140397 - - - + + + - - + + 900.8860169060631816 - - - + + + - - + + 891.2466638536688015 - - - + + + - - + + 88-0.7920084594361685 - - - + + + - - + + 870.9391569454657153 - - - + + + - - + + 86-0.6810560759211829 - - - + + + - - + + 85-0.35695935774844667 - - - + + + - - + + 840.5700403191802587 - - - + + + - - + + 830.45138100709520146 - - - + + + - - + + 82-0.7331355765401936 - - - + + + - - + + 81-0.7310274795358993 - - - + + + - - + + 80-0.41206555106298204 - - - + + + - - + + 79-1.1622837738587986 - - - + + + - - + + 780.38274271202161236 - - - + + + - - + + 77-0.16314968565688603 - - - + + + - - + + 76-1.3474195312441273 - - - + + + - - + + 750.13696450606798996 - - - + + + - - + + 74-0.21028986641893047 - - - + + + - - + + 73-0.12033555622545244 - - - + + + - - + + 720.5667037949179979 - - - + + + - - + + 71-0.07885178294130195 - - - + + + - - + + 70-0.00028074371317229863 - - - + + + - - + + 690.247243641605957 - - - + + + - - + + 680.08206552423782104 - - - + + + - - + + 670.19415397658620395 - - - + + + - - + + 661.632118419083142 - - - + + + - - + + 65-0.513961844662046 - - - + + + - - + + 640.4934457799790965 - - - + + + - - + + 63-0.20154084098111144 - - - + + + - - + + 62-0.7885304145371108 - - - + + + - - + + 61-0.9303369741712639 - - - + + + - - + + 60-0.41038892165818114 - - - + + + - - + + 59-0.07307073477244386 - - - + + + - - + + 58-2.333110133685771 - - - + + + - - + + 572.3617023280229525 - - - + + + - - + + 56-0.8007275113860813 - - - + + + - - + + 550.1622021950695987 - - - + + + - - + + 54-0.692138955076679 - - - + + + - - + + 530.5130100157724389 - - - + + + - - + + 520.6655884498532548 - - - + + + - - + + 511.2044410344593401 - - - + + + - - + + 500.38407262288739563 - - - + + + - - + + 491.4974133651402333 - - - + + + - - + + 480.2025544179143972 - - - + + + - - + + 47-0.5613653896321944 - - - + + + - - + + 46-2.089625540720649 - - - + + + - - + + 45-3.1617902231833055 - - - + + + - - + + 440.3442833133688682 - - - + + + - - + + 430.12412767158579842 - - - + + + - - + + 42-1.459171220162777 - - - + + + - - + + 41-0.8592340308346358 - - - + + + - - + + 401.0266343772677304 - - - + + + - - + + 390.33925973125550035 - - - + + + - - + + 381.1139581146452935 - - - + + + - - + + 37-0.30020633919555056 - - - + + + - - + + 361.4736086846619723 - - - + + + - - + + 35-0.277036339340699 - - - + + + - - + + 340.8752035332824267 - - - + + + - - + + 330.7229090947669345 - - - + + + - - + + 320.3352802748437375 - - - + + + - - + + 310.2346228137972106 - - - + + + - - + + 30-0.6568301437671541 - - - + + + - - + + 290.42034402756841993 - - - + + + - - + + 28-0.6368229112015493 - - - + + + - - + + 27-1.1919024176758877 - - - + + + - - + + 260.8178081866262508 - - - + + + - - + + 251.4245108924907135 - - - + + + - - + + 240.26436193065733476 - - - + + + - - + + 23-0.6400659919492891 - - - + + + - - + + 220.007898408677127015 - - - + + + - - + + 210.04371343633947624 - - - + + + - - + + 20-0.3022502908695568 - - - + + + - - + + 19-0.6393285691366652 - - - + + + - - + + 18-0.18000566696690332 - - - + + + - - + + 171.1182124037430563 - - - + + + - - + + 160.9638259731076578 - - - + + + - - + + 150.4610075462002879 - - - + + + - - + + 141.4361737542172333 - - - + + + - - + + 130.3662389078721804 - - - + + + - - + + 12-0.12074781596976425 - - - + + + - - + + 11-1.0225191576228692 - - - + + + - - + + 100.005282473185407888 - - - + + + - - + + 9-2.0823259238843836 - - - + + + - - + + 8-2.9644477368130304 - - - + + + - - + + 7-0.5757737320572894 - - - + + + - - + + 60.1492174679469838 - - - + + + - - + + 5-0.7161438288655582 - - - + + + - - + + 40.7711209725435901 - - - + + + - - + + 31.1544394785576542 - - - + + + - - + + 2-0.770567381794703 - - - + + + - - + + 11.6986463931452203 @@ -5799,35 +5799,35 @@ - - + + -4 - + -2 - + 0 - + 2 - + 4 - - + + A @@ -5836,8 +5836,8 @@ - - + + Sample value @@ -5845,13 +5845,13 @@ - + - + - + diff --git a/dev/gadfly/7a66dadd.svg b/dev/gadfly/a806feba.svg similarity index 82% rename from dev/gadfly/7a66dadd.svg rename to dev/gadfly/a806feba.svg index b606884a..668c36f7 100644 --- a/dev/gadfly/7a66dadd.svg +++ b/dev/gadfly/a806feba.svg @@ -14,262 +14,262 @@ - - + + value - - - + + + 1 - + 2 - + 3 - - + + - + - + - - + + chain - - - + + + - - + + -5 - + 0 - + 5 - - - - + + + + - - + + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - - + + 0.0 - + 0.1 - + 0.2 - + 0.3 - + 0.4 - + 0.5 - - + + B - - - - + + + + - - + + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - - + + 0.0 - + 0.1 - + 0.2 - + 0.3 - + 0.4 - + 0.5 - - + + A @@ -278,8 +278,8 @@ - - + + Density @@ -287,13 +287,13 @@ - + - + - + diff --git a/dev/gadfly/11b98d7c.svg b/dev/gadfly/ae4f12be.svg similarity index 78% rename from dev/gadfly/11b98d7c.svg rename to dev/gadfly/ae4f12be.svg index 7ee8089f..593f8416 100644 --- a/dev/gadfly/11b98d7c.svg +++ b/dev/gadfly/ae4f12be.svg @@ -14,115 +14,115 @@ - - + + Parameter - - - + + + - - + + B - - + + A - - + + -5 - + 0 - + 5 - - + + -5 - + 0 - + 5 - - - - + + + + - - + + - + - + - + - + - + - - + + - + - + - + - - - + + + @@ -130,52 +130,52 @@ - - - - + + + + - - + + - + - + - + - + - + - - + + - + - + - + - - - + + + @@ -183,91 +183,91 @@ - - + + 0.0 - + 0.1 - + 0.2 - + 0.3 - + 0.4 - + 0.5 - - + + 2 - - - - + + + + - - + + - + - + - + - + - + - - + + - + - + - + - - - + + + @@ -275,52 +275,52 @@ - - - - + + + + - - + + - + - + - + - + - + - - + + - + - + - + - - - + + + @@ -328,40 +328,40 @@ - - + + 0.0 - + 0.1 - + 0.2 - + 0.3 - + 0.4 - + 0.5 - - + + 1 @@ -370,8 +370,8 @@ - - + + Chain @@ -379,19 +379,19 @@ - + - + - + - + - + diff --git a/dev/gadfly/ac46473c.svg b/dev/gadfly/e90dc281.svg similarity index 83% rename from dev/gadfly/ac46473c.svg rename to dev/gadfly/e90dc281.svg index 98e4d42a..86ea94a1 100644 --- a/dev/gadfly/ac46473c.svg +++ b/dev/gadfly/e90dc281.svg @@ -14,15 +14,15 @@ - - + + A - + -5 @@ -39,134 +39,134 @@ - - - + + + 1 - + 2 - + 3 - - + + - + - + - - + + chain - - - - + + + + - - + + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - - + + 0.0 - + 0.1 - + 0.2 - + 0.3 - + 0.4 - + 0.5 - - + + Density @@ -174,7 +174,7 @@ - + diff --git a/dev/gadfly/index.html b/dev/gadfly/index.html index 6be03296..b6f0c6ec 100644 --- a/dev/gadfly/index.html +++ b/dev/gadfly/index.html @@ -1,464 +1,5 @@ -Gadfly.jl · MCMCChains.jl - - - - - - -

Gadfly.jl plots

To plot the Chains via Gadfly.jl, use the DataFrames constructor:

using DataFrames
+Gadfly.jl · MCMCChains.jl

Gadfly.jl plots

To plot the Chains via Gadfly.jl, use the DataFrames constructor:

using DataFrames
 using CategoricalArrays
 using Gadfly
 using MCMCChains
@@ -467,12 +8,11 @@
 df = DataFrame(chn)
 df[!, :chain] = categorical(df.chain)
 
-plot(df, x=:A, color=:chain, Geom.density, Guide.ylabel("Density"))
Example block output

Multiple parameters

Or, to show multiple parameters in one plot, use DataFrames.stack

sdf = stack(df, names(chn), variable_name=:parameter)
+plot(df, x=:A, color=:chain, Geom.density, Guide.ylabel("Density"))
Example block output

Multiple parameters

Or, to show multiple parameters in one plot, use DataFrames.stack

sdf = stack(df, names(chn), variable_name=:parameter)
 first(sdf, 5)
5×4 DataFrame
Rowiterationchainparametervalue
Int64Cat…StringFloat64
111A1.69865
221A-0.770567
331A1.15444
441A0.771121
551A-0.716144

and Gadfly.Geom.subplot_grid

plot(sdf, ygroup=:parameter, x=:value, color=:chain,
-    Geom.subplot_grid(Geom.density), Guide.ylabel("Density"))
Example block output

This is very flexible. For example, we can look at the first two chains only by using DataFrames.filter

first_chain = filter([:chain] => c -> c == 1 || c == 2, sdf)
+    Geom.subplot_grid(Geom.density), Guide.ylabel("Density"))
Example block output

This is very flexible. For example, we can look at the first two chains only by using DataFrames.filter

first_chain = filter([:chain] => c -> c == 1 || c == 2, sdf)
 
 plot(first_chain, xgroup=:parameter, ygroup=:chain, x=:value,
     Geom.subplot_grid(Geom.density, Guide.xlabel(orientation=:horizontal)),
-    Guide.xlabel("Parameter"), Guide.ylabel("Chain"))
Example block output

Trace

plot(first_chain, ygroup=:parameter, x=:iteration, y=:value, color=:chain,
-    Geom.subplot_grid(Geom.point), Guide.ylabel("Sample value"))
Example block output
- + Guide.xlabel("Parameter"), Guide.ylabel("Chain"))
Example block output

Trace

plot(first_chain, ygroup=:parameter, x=:iteration, y=:value, color=:chain,
+    Geom.subplot_grid(Geom.point), Guide.ylabel("Sample value"))
Example block output
diff --git a/dev/getting-started/index.html b/dev/getting-started/index.html index 44ff9f78..b3f959bc 100644 --- a/dev/getting-started/index.html +++ b/dev/getting-started/index.html @@ -1,464 +1,5 @@ -Getting started · MCMCChains.jl - - - - - - -

Getting started

Chains type

MCMCChains.ChainsType
Chains

Parameters:

  • value: An AxisArray object with axes iter × var × chains
  • logevidence : A field containing the logevidence.
  • name_map : A NamedTuple mapping each variable to a section.
  • info : A NamedTuple containing miscellaneous information relevant to the chain.

The info field can be set using setinfo(c::Chains, n::NamedTuple).

source

Indexing and parameter Names

Chains can be constructed with parameter names. For example, to create a chains object with

  • 500 samples,
  • 2 parameters (named a and b)
  • 3 chains

use

val = rand(500, 2, 3)
+Getting started · MCMCChains.jl

Getting started

Chains type

MCMCChains.ChainsType
Chains

Parameters:

  • value: An AxisArray object with axes iter × var × chains
  • logevidence : A field containing the logevidence.
  • name_map : A NamedTuple mapping each variable to a section.
  • info : A NamedTuple containing miscellaneous information relevant to the chain.

The info field can be set using setinfo(c::Chains, n::NamedTuple).

source

Indexing and parameter Names

Chains can be constructed with parameter names. For example, to create a chains object with

  • 500 samples,
  • 2 parameters (named a and b)
  • 3 chains

use

val = rand(500, 2, 3)
 chn = Chains(val, [:a, :b])
Chains MCMC chain (500×2×3 Array{Float64, 3}):
 
 Iterations        = 1:1:500
@@ -545,7 +86,7 @@
 julia> names(chn3) 
 2-element Vector{Symbol}:
  :one
- :B
source

Sections

Chains parameters are sorted into sections that represent groups of parameters, see MCMCChains.group. By default, every chain contains a parameters section, to which all unassigned parameters are assigned to. Chains can be assigned a named map during construction:

chn = Chains(rand(100, 4, 2), [:a, :b, :c, :d])
Chains MCMC chain (100×4×2 Array{Float64, 3}):
+ :B
source

Sections

Chains parameters are sorted into sections that represent groups of parameters, see MCMCChains.group. By default, every chain contains a parameters section, to which all unassigned parameters are assigned to. Chains can be assigned a named map during construction:

chn = Chains(rand(100, 4, 2), [:a, :b, :c, :d])
Chains MCMC chain (100×4×2 Array{Float64, 3}):
 
 Iterations        = 1:1:100
 Number of chains  = 2
@@ -608,7 +149,7 @@
 julia> namesingroup(chn, :A; index_type=:dot)
 2-element Vector{Symbol}:
  Symbol("A.1")
- Symbol("A.2")
source

The get Function

MCMCChains also provides a get function designed to make it easier to access parameters:

val = rand(6, 3, 1)
+ Symbol("A.2")
source

The get Function

MCMCChains also provides a get function designed to make it easier to access parameters:

val = rand(6, 3, 1)
 chn = Chains(val, [:a, :b, :c]);
 
 x = get(chn, :a)
(a = [0.4406973184362195; 0.06413541593814787; … ; 0.6564549998197146; 0.4260695808953028;;],)

You can also access the variables via getproperty:

x.a
2-dimensional AxisArray{Float64,2,...} with axes:
@@ -648,5 +189,4 @@
 DataFrame(chn)
6×4 DataFrame
Rowiterationchainab
Int64Int64Float64Float64
1110.5914240.0238958
2210.637220.117082
3310.3847310.152856
4120.5343290.0840422
5220.0200470.0846894
6320.1960540.576018

See also ?DataFrame and ?Array for more help.

Sampling Chains

MCMCChains overloads several sample methods as defined in StatsBase:

StatsBase.sampleMethod
sample([rng,] chn::Chains, [wv::AbstractWeights,] n; replace=true, ordered=false)

Sample n samples from the pooled (!) chain chn.

The keyword arguments replace and ordered determine whether sampling is performed with replacement and whether the sample is ordered, respectively. If specified, sampling probabilities are proportional to weights wv.

Note

If chn contains multiple chains, they are pooled (i.e., appended) before sampling. This ensures that even in this case exactly n samples are returned:

julia> chn = Chains(randn(11, 4, 3));
 
 julia> size(sample(chn, 7)) == (7, 4, 1)
-true
source

See ?sample for additional help on sampling. Alternatively, you can construct and sample from a kernel density estimator using KernelDensity.jl, see test/sampling_tests.jl.

- +true
source

See ?sample for additional help on sampling. Alternatively, you can construct and sample from a kernel density estimator using KernelDensity.jl, see test/sampling_tests.jl.

diff --git a/dev/index.html b/dev/index.html index 6bc7b9db..aba8b8be 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,462 +1,2 @@ -MCMCChains · MCMCChains.jl - - - - - - -
- +MCMCChains · MCMCChains.jl
diff --git a/dev/makie/baf55883.svg b/dev/makie/2146d5ca.svg similarity index 97% rename from dev/makie/baf55883.svg rename to dev/makie/2146d5ca.svg index ad1ed460..4f0a05bd 100644 --- a/dev/makie/baf55883.svg +++ b/dev/makie/2146d5ca.svg @@ -2,99 +2,99 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -156,92 +156,92 @@ - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + @@ -255,79 +255,79 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/dev/makie/36e9855a.svg b/dev/makie/552e1998.svg similarity index 97% rename from dev/makie/36e9855a.svg rename to dev/makie/552e1998.svg index 32c864a3..1dc3bb4d 100644 --- a/dev/makie/36e9855a.svg +++ b/dev/makie/552e1998.svg @@ -2,108 +2,108 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -165,92 +165,92 @@ - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + @@ -264,79 +264,79 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -355,13 +355,13 @@ - + - + - + diff --git a/dev/makie/d029bddd.svg b/dev/makie/599a972e.svg similarity index 98% rename from dev/makie/d029bddd.svg rename to dev/makie/599a972e.svg index a59c481f..558f140e 100644 --- a/dev/makie/d029bddd.svg +++ b/dev/makie/599a972e.svg @@ -2,61 +2,61 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -88,88 +88,88 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/dev/makie/index.html b/dev/makie/index.html index cf4183b1..8522dee5 100644 --- a/dev/makie/index.html +++ b/dev/makie/index.html @@ -1,464 +1,5 @@ -Makie.jl · MCMCChains.jl - - - - - - -

Makie.jl plots

This page shows an example of plotting MCMCChains.jl with Makie.jl. The example is meant to provide an useful basis to build upon. Let's define some random chain and load the required packages:

using MCMCChains
+Makie.jl · MCMCChains.jl

Makie.jl plots

This page shows an example of plotting MCMCChains.jl with Makie.jl. The example is meant to provide an useful basis to build upon. Let's define some random chain and load the required packages:

using MCMCChains
 
 chns = Chains(randn(300, 5, 3), [:A, :B, :C, :D, :E])
Chains MCMC chain (300×5×3 Array{Float64, 3}):
 
@@ -512,7 +53,7 @@
     end
 end
 
-fig
Example block output

Next, we can add a second row of plots next to it which show the density estimate for these samples:

for (i, param) in enumerate(params)
+fig
Example block output

Next, we can add a second row of plots next to it which show the density estimate for these samples:

for (i, param) in enumerate(params)
     ax = Axis(fig[i, 2]; ylabel=string(param))
     for chain in 1:n_chains
         values = chns[:, param, chain]
@@ -530,7 +71,6 @@
 axes = [only(contents(fig[i, 2])) for i in 1:length(params)]
 linkxaxes!(axes...)
 
-fig
Example block output

Finally, let's add a simple legend. Thanks to setting label above, this legend will have the right labels:

axislegend(first(axes))
-
-fig
Example block output
+fig
Example block output

Finally, let's add a simple legend. Thanks to setting label above, this legend will have the right labels:

axislegend(first(axes))
 
+fig
Example block output
diff --git a/dev/modelstats/index.html b/dev/modelstats/index.html index b096ddf0..36997cac 100644 --- a/dev/modelstats/index.html +++ b/dev/modelstats/index.html @@ -1,464 +1,5 @@ -Model selection · MCMCChains.jl - - - - - - -

Model selection

The methods listed below are defined in src/modelstats.jl.

MCMCChains.dicMethod
dic(chain::Chains, logpdf::Function) -> (DIC, pD)

Compute the deviance information criterion (DIC). (Smaller is better)

Note: DIC assumes that the posterior distribution is approx. multivariate Gaussian and tends to select overfitted models.

Returns:

  • DIC: The calculated deviance information criterion
  • pD: The effective number of parameters

Usage:

chn ... # sampling results
+Model selection · MCMCChains.jl

Model selection

The methods listed below are defined in src/modelstats.jl.

MCMCChains.dicMethod
dic(chain::Chains, logpdf::Function) -> (DIC, pD)

Compute the deviance information criterion (DIC). (Smaller is better)

Note: DIC assumes that the posterior distribution is approx. multivariate Gaussian and tends to select overfitted models.

Returns:

  • DIC: The calculated deviance information criterion
  • pD: The effective number of parameters

Usage:

chn ... # sampling results
 lpfun = function f(chain::Chains) # function to compute the logpdf values
     niter, nparams, nchains = size(chain)
     lp = zeros(niter + nchains) # resulting logpdf values
@@ -468,5 +9,4 @@
     return lp
 end
 
-DIC, pD = dic(chn, lpfun)
source
- +DIC, pD = dic(chn, lpfun)
source
diff --git a/dev/stats/index.html b/dev/stats/index.html index 4680255a..80b6addf 100644 --- a/dev/stats/index.html +++ b/dev/stats/index.html @@ -1,480 +1,21 @@ -Posterior statistics · MCMCChains.jl - - - - - - -

Posterior statistics

The methods listed below are defined in src/stats.jl.

StatsBase.autocorFunction
autocor(
+Posterior statistics · MCMCChains.jl

Posterior statistics

The methods listed below are defined in src/stats.jl.

StatsBase.autocorFunction
autocor(
     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.

source
DataAPI.describeFunction
describe(io, chains[;
+)

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.

source
DataAPI.describeFunction
describe(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.

source
StatsBase.summarystatsFunction
function 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.

source
Statistics.quantileFunction
quantile(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.

source
MCMCChains.hpdFunction
hpd(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);
+)

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.

source
Statistics.quantileFunction
quantile(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.

source
MCMCChains.hpdFunction
hpd(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)
@@ -483,5 +24,4 @@
       Symbol   Float64   Float64 
 
            a    0.0554    0.9944
-           b    0.0114    0.9460
source
- + b 0.0114 0.9460
source
diff --git a/dev/statsplots/88392595.svg b/dev/statsplots/13b635b9.svg similarity index 97% rename from dev/statsplots/88392595.svg rename to dev/statsplots/13b635b9.svg index 42c453dc..5c60fc61 100644 --- a/dev/statsplots/88392595.svg +++ b/dev/statsplots/13b635b9.svg @@ -1,70 +1,70 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/9573a2e4.svg b/dev/statsplots/1dbfc586.svg similarity index 76% rename from dev/statsplots/9573a2e4.svg rename to dev/statsplots/1dbfc586.svg index c115d187..fde5be36 100644 --- a/dev/statsplots/9573a2e4.svg +++ b/dev/statsplots/1dbfc586.svg @@ -1,623 +1,623 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/13f7a09c.svg b/dev/statsplots/2079574b.svg similarity index 82% rename from dev/statsplots/13f7a09c.svg rename to dev/statsplots/2079574b.svg index 9bc60660..7ce94296 100644 --- a/dev/statsplots/13f7a09c.svg +++ b/dev/statsplots/2079574b.svg @@ -1,266 +1,266 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/c9e3fc3a.svg b/dev/statsplots/3e5af3e8.svg similarity index 83% rename from dev/statsplots/c9e3fc3a.svg rename to dev/statsplots/3e5af3e8.svg index f796735b..0cd3c6fb 100644 --- a/dev/statsplots/c9e3fc3a.svg +++ b/dev/statsplots/3e5af3e8.svg @@ -1,68 +1,68 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/3894f484.svg b/dev/statsplots/6f1c8562.svg similarity index 87% rename from dev/statsplots/3894f484.svg rename to dev/statsplots/6f1c8562.svg index 3c56e8fb..350b76fc 100644 --- a/dev/statsplots/3894f484.svg +++ b/dev/statsplots/6f1c8562.svg @@ -1,150 +1,150 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/7ae4785e.svg b/dev/statsplots/7a2f5b40.svg similarity index 82% rename from dev/statsplots/7ae4785e.svg rename to dev/statsplots/7a2f5b40.svg index 2c8d3603..721f0de4 100644 --- a/dev/statsplots/7ae4785e.svg +++ b/dev/statsplots/7a2f5b40.svg @@ -1,266 +1,266 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/83e40bbe.svg b/dev/statsplots/7cb70f50.svg similarity index 83% rename from dev/statsplots/83e40bbe.svg rename to dev/statsplots/7cb70f50.svg index 620796c9..d9cb59cf 100644 --- a/dev/statsplots/83e40bbe.svg +++ b/dev/statsplots/7cb70f50.svg @@ -1,77 +1,77 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/4ef4cb49.svg b/dev/statsplots/965eb1e1.svg similarity index 84% rename from dev/statsplots/4ef4cb49.svg rename to dev/statsplots/965eb1e1.svg index 4ca84316..8560a8f7 100644 --- a/dev/statsplots/4ef4cb49.svg +++ b/dev/statsplots/965eb1e1.svg @@ -1,136 +1,136 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/95fffe48.svg b/dev/statsplots/a8a6129f.svg similarity index 85% rename from dev/statsplots/95fffe48.svg rename to dev/statsplots/a8a6129f.svg index d245eb1c..ba6d54ac 100644 --- a/dev/statsplots/95fffe48.svg +++ b/dev/statsplots/a8a6129f.svg @@ -1,132 +1,132 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/026855c1.svg b/dev/statsplots/a90632c4.svg similarity index 86% rename from dev/statsplots/026855c1.svg rename to dev/statsplots/a90632c4.svg index b75a61a8..d60cf2e8 100644 --- a/dev/statsplots/026855c1.svg +++ b/dev/statsplots/a90632c4.svg @@ -1,142 +1,142 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/ee7375a0.svg b/dev/statsplots/b84299bd.svg similarity index 62% rename from dev/statsplots/ee7375a0.svg rename to dev/statsplots/b84299bd.svg index 1e523525..ea925156 100644 --- a/dev/statsplots/ee7375a0.svg +++ b/dev/statsplots/b84299bd.svg @@ -1,1642 +1,1642 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - + + + + + + + + + + + diff --git a/dev/statsplots/4d8ef9d7.svg b/dev/statsplots/dcfa0af1.svg similarity index 85% rename from dev/statsplots/4d8ef9d7.svg rename to dev/statsplots/dcfa0af1.svg index 400a89bb..f5690657 100644 --- a/dev/statsplots/4d8ef9d7.svg +++ b/dev/statsplots/dcfa0af1.svg @@ -1,142 +1,142 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/51fd7429.svg b/dev/statsplots/f8ccbd74.svg similarity index 86% rename from dev/statsplots/51fd7429.svg rename to dev/statsplots/f8ccbd74.svg index 9d453a67..6ae8df0a 100644 --- a/dev/statsplots/51fd7429.svg +++ b/dev/statsplots/f8ccbd74.svg @@ -1,140 +1,140 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/statsplots/index.html b/dev/statsplots/index.html index c1462881..d2d1238e 100644 --- a/dev/statsplots/index.html +++ b/dev/statsplots/index.html @@ -1,464 +1,5 @@ -StatsPlots.jl · MCMCChains.jl - - - - - - -

StatsPlots.jl

MCMCChains implements many functions for plotting via StatsPlots.jl.

Simple example

The following simple example illustrates how to use Chain to visually summarize a MCMC simulation:

using MCMCChains
+StatsPlots.jl · MCMCChains.jl

StatsPlots.jl

MCMCChains implements many functions for plotting via StatsPlots.jl.

Simple example

The following simple example illustrates how to use Chain to visually summarize a MCMC simulation:

using MCMCChains
 using StatsPlots
 
 # Define the experiment
@@ -474,5 +15,4 @@
 chn = Chains(val, [:A, :B, :C, :D])
 
 # visualize the MCMC simulation results
-plot(chn; size=(840, 600))

Default plot for Chains

plot(chn, colordim = :parameter; size=(840, 400))
Example block output

Note that the plot function takes the additional arguments described in the Plots.jl package.

Mixed density

plot(chn, seriestype = :mixeddensity)
Example block output

Or, for all seriestypes, use the alternative shorthand syntax:

mixeddensity(chn)
Example block output

Trace

plot(chn, seriestype = :traceplot)
Example block output
traceplot(chn)
Example block output

Running average

meanplot(chn)
Example block output

Density

density(chn)
Example block output

Histogram

histogram(chn)
Example block output

Autocorrelation

autocorplot(chn)
Example block output

Corner

corner(chn)
Example block output

For plotting multiple parameters, ridgeline, forest and caterpillar plots can be useful.

Ridgeline

ridgelineplot(chn, [:C, :B, :A])
Example block output

Forest

forestplot(chn, [:C, :B, :A], hpd_val = [0.05, 0.15, 0.25])
Example block output

Caterpillar

forestplot(chn, chn.name_map[:parameters], hpd_val = [0.05, 0.15, 0.25], ordered = true)
Example block output

API

MCMCChains.ridgelineplotFunction
ridgelineplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a ridgeline plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

The following options are available:

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

Note

If a single parameter is provided, the generated plot is a density plot with all the elements described above.

source
MCMCChains.ridgelineplot!Function
ridgelineplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a ridgeline plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

The following options are available:

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

Note

If a single parameter is provided, the generated plot is a density plot with all the elements described above.

source
ridgelineplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a ridgeline plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

The following options are available:

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

Note

If a single parameter is provided, the generated plot is a density plot with all the elements described above.

source
MCMCChains.forestplotFunction
forestplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a forest or caterpillar plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

  • ordered (default: false): If ordered = false, a forest plot is generated. If ordered = true, a caterpillar plot is generated.

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

source
MCMCChains.forestplot!Function
forestplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a forest or caterpillar plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

  • ordered (default: false): If ordered = false, a forest plot is generated. If ordered = true, a caterpillar plot is generated.

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

source
forestplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a forest or caterpillar plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

  • ordered (default: false): If ordered = false, a forest plot is generated. If ordered = true, a caterpillar plot is generated.

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

source
- +plot(chn; size=(840, 600))

Default plot for Chains

plot(chn, colordim = :parameter; size=(840, 400))
Example block output

Note that the plot function takes the additional arguments described in the Plots.jl package.

Mixed density

plot(chn, seriestype = :mixeddensity)
Example block output

Or, for all seriestypes, use the alternative shorthand syntax:

mixeddensity(chn)
Example block output

Trace

plot(chn, seriestype = :traceplot)
Example block output
traceplot(chn)
Example block output

Running average

meanplot(chn)
Example block output

Density

density(chn)
Example block output

Histogram

histogram(chn)
Example block output

Autocorrelation

autocorplot(chn)
Example block output

Corner

corner(chn)
Example block output

For plotting multiple parameters, ridgeline, forest and caterpillar plots can be useful.

Ridgeline

ridgelineplot(chn, [:C, :B, :A])
Example block output

Forest

forestplot(chn, [:C, :B, :A], hpd_val = [0.05, 0.15, 0.25])
Example block output

Caterpillar

forestplot(chn, chn.name_map[:parameters], hpd_val = [0.05, 0.15, 0.25], ordered = true)
Example block output

API

MCMCChains.ridgelineplotFunction
ridgelineplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a ridgeline plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

The following options are available:

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

Note

If a single parameter is provided, the generated plot is a density plot with all the elements described above.

source
MCMCChains.ridgelineplot!Function
ridgelineplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a ridgeline plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

The following options are available:

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

Note

If a single parameter is provided, the generated plot is a density plot with all the elements described above.

source
ridgelineplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a ridgeline plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

The following options are available:

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

Note

If a single parameter is provided, the generated plot is a density plot with all the elements described above.

source
MCMCChains.forestplotFunction
forestplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a forest or caterpillar plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

  • ordered (default: false): If ordered = false, a forest plot is generated. If ordered = true, a caterpillar plot is generated.

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

source
MCMCChains.forestplot!Function
forestplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a forest or caterpillar plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

  • ordered (default: false): If ordered = false, a forest plot is generated. If ordered = true, a caterpillar plot is generated.

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

source
forestplot(chains::Chains[, params::Vector{Symbol}]; kwargs...)

Generate a forest or caterpillar plot for the samples of the parameters params in chains.

By default, all parameters are plotted.

Keyword arguments

  • ordered (default: false): If ordered = false, a forest plot is generated. If ordered = true, a caterpillar plot is generated.

  • fill_q (default: false) and fill_hpd (default: true): Fill the area below the curve in the quantiles interval (fill_q = true) or the highest posterior density (HPD) interval (fill_hpd = true). If both fill_q = false and fill_hpd = false, then the whole area below the curve is filled. If no fill color is desired, it should be specified with series attributes. These options are mutually exclusive.

  • show_mean (default: true) and show_median (default: true): Plot a vertical line of the mean (show_mean = true) or median (show_median = true) of the posterior density estimate. If both options are set to true, both lines are plotted.

  • show_qi (default: false) and show_hpdi (default: true): Plot a quantile interval (show_qi = true) or the largest HPD interval (show_hpdi = true) at the bottom of each density plot. These options are mutually exclusive.

  • q (default: [0.1, 0.9]): The two quantiles used for plotting if fill_q = true or show_qi = true.

  • hpd_val (default: [0.05, 0.2]): The complementary probability mass(es) of the highest posterior density intervals that are plotted if fill_hpd = true or show_hpdi = true.

source
diff --git a/dev/summarize/index.html b/dev/summarize/index.html index 38639209..5fc61a1c 100644 --- a/dev/summarize/index.html +++ b/dev/summarize/index.html @@ -1,462 +1,2 @@ -Summarize · MCMCChains.jl - - - - - - -

Summarize

The methods listed below are defined in src/summarize.jl.

MCMCChains.summarizeMethod
summarize(chains, funs...[; sections, func_names = [], name = "", append_chains = true])

Summarize chains in a ChainsDataFrame.

Examples

  • summarize(chns) : Complete chain summary
  • summarize(chns[[:parm1, :parm2]]) : Chain summary of selected parameters
  • summarize(chns; sections=[:parameters]) : Chain summary of :parameters section
  • summarize(chns; sections=[:parameters, :internals]) : Chain summary for multiple sections
source
- +Summarize · MCMCChains.jl

Summarize

The methods listed below are defined in src/summarize.jl.

MCMCChains.summarizeMethod
summarize(chains, funs...[; sections, func_names = [], name = "", append_chains = true])

Summarize chains in a ChainsDataFrame.

Examples

  • summarize(chns) : Complete chain summary
  • summarize(chns[[:parm1, :parm2]]) : Chain summary of selected parameters
  • summarize(chns; sections=[:parameters]) : Chain summary of :parameters section
  • summarize(chns; sections=[:parameters, :internals]) : Chain summary for multiple sections
source
diff --git a/index.html b/index.html index 3ac25969..6a5afc30 100644 --- a/index.html +++ b/index.html @@ -1,3 +1,2 @@ -