Skip to content

09. Bayesian Analysis, Plotting and MCMC Processor

Kamil edited this page Dec 12, 2024 · 19 revisions

Introduction

MCMC Processor is a class responsible for processing MCMC and producing validation plots.

Posteriors

Marginalised posterior is the standard output of MCMC. PDF is mean, Gauss indicates gaussian fit to posterior while HPD (Highest Posterior Denstiity Point). In most cases paramter posteriors are Gaussian then all 3 values would give the same result. However, the strength of MCMC is that there is no assumption about gaussiantiy and it can handle non-Gaussian parameters.

Credible Intervals

This plot helps to tell which values are excluded based on X-credible intervals

2D Posteriros

It is possible to produce 2D posteriors. They are very useful to identify if parameters are correlated or not. In this example, there are strong correlations.

This can take some time, though. There are two ways: faster (using multithreading) but requiring lots of RAM or slower but without RAM requirements. Once you obtain 2D posteriors, you can produce multiple additional plots.

Credible Region

Correlation Matrix

Correlation matrix etc are calculated based on 2D Posteriros

Triangle plot

  TrianglePlot:
    - ["Test", ["Norm_Param_0", "Norm_Param_1", "Spline_Param_0", "Spline_Param_1"]]

you can specyfy as many params as you like. But also as many combinations as you like

  TrianglePlot:
    - ["Test", ["Norm_Param_0", "Norm_Param_1", "Spline_Param_0", "Spline_Param_1"]]
    - ["Test2", ["Norm_Param_0", "Norm_Param_1"]]

Violin plot

Bayes factor and Savage-Dickey

It is possible to obtain the Bayes factor for different hypothesis

  BayesFactor:
    # Goes as follows: ParamName Name[Model 1, Model 2], Model1[lower, upper ], Model2[lower, upper ]
    - ["sin2th_23", ["LO", "UO"], [0, 0.5], [0.5, 1]]

or calculate savage Dickey, which is Bayes factor for point-like hypothesis

  SavageDickey:
    - ["Alpha_q3", 0.0001, [0, 1]]

Parameter Evolution

  ParameterEvolution:
    - ["Norm_Param_0", 20]

Select parameter name and how many frames you want. The more the longer it takes so be carefull

BiPolar plot