12 #ifndef SRC_VMCMC_CHAIN_HPP_ 13 #define SRC_VMCMC_CHAIN_HPP_ 20 #include <unordered_map> 22 #include <boost/optional.hpp> 27 using Chain = std::deque<Sample>;
41 const Chain& GetChain()
const {
return fSampleChain; }
45 void SelectRange(ptrdiff_t startIndex = 0, ptrdiff_t endIndex = -1);
46 void SelectPercentageRange(
double start = 0.0,
double end = 1.0);
48 std::pair<size_t, size_t> GetIndices()
const;
49 std::pair<Chain::const_iterator, Chain::const_iterator> GetIterators()
const;
51 size_t NumberOfParams()
const;
55 double GetMedian(
size_t paramIndex);
57 const Vector& GetVariance();
58 const Vector& GetError();
59 const Vector& GetRms();
61 const MatrixLower& GetCovarianceMatrix();
62 const MatrixUnitLower& GetCorrelationMatrix();
63 const MatrixLower& GetCholeskyDecomposition();
65 const Vector& GetAutoCorrelation(
size_t lag);
66 const Vector& GetAutoCorrelationTime();
68 std::pair<double, double> GetConfidenceInterval(
size_t iParam,
double centralValue,
double level);
73 const Chain& fSampleChain;
74 std::pair<ptrdiff_t, ptrdiff_t> fSelectedRange;
76 boost::optional<Sample> fMode;
77 boost::optional<Sample> fMean;
78 std::unordered_map<size_t, double> fMedian;
80 boost::optional<Vector> fVariance;
81 boost::optional<Vector> fError;
82 boost::optional<Vector> fRms;
84 boost::optional<MatrixLower> fCovariance;
85 boost::optional<MatrixUnitLower> fCorrelation;
86 boost::optional<MatrixLower> fCholesky;
88 std::unordered_map<size_t, Vector> fAutoCorrelation;
89 boost::optional<Vector> fAutoCorrelationTime;
91 boost::optional<double> fAccRate;
101 const std::vector<ChainStatistics>& GetListOfChainStats()
const {
return fSingleChainStats; }
104 ChainStatistics& GetChainStats(
size_t index) {
return fSingleChainStats[index]; }
105 size_t Size()
const {
return fSingleChainStats.size(); }
110 void SelectRange(ptrdiff_t startIndex = 0, ptrdiff_t endIndex = -1);
111 void SelectPercentageRange(
double start = 0.0,
double end = 1.0);
113 double GetRubinGelman();
116 std::vector<ChainStatistics> fSingleChainStats;
118 boost::optional<double> fRubinGelman;
121 inline size_t ChainStatistics::NumberOfParams()
const 123 return (fSampleChain.empty()) ? 0 : fSampleChain.front().Values().size();
Definition: algorithm.cpp:28
Manages a list of ChainStatistics and calculates statistical properties regarding sets of individual ...
Definition: chain.hpp:98
Calculates statistical momenta and properties for a given Chain of Samples.
Definition: chain.hpp:36
Contains the Sample class definition for data sampled from the target parameter space.
BLAS (Basic Linear Algebra Subprograms) utility functions.
A 'sample' represents a node or data point in a Markov Chain.
Definition: sample.hpp:31