versatile-mcmc  0.1.7
Functions
vmcmc-example.cpp File Reference

Metropolis-Hastings usage example. More...

#include <vmcmc/io.hpp>
#include <vmcmc/logger.hpp>
#include <vmcmc/metropolis.hpp>
#include <vmcmc/math.hpp>
#include <vmcmc/proposal.hpp>
#include <vmcmc/random.hpp>
#include <vmcmc/stringutils.hpp>
Include dependency graph for vmcmc-example.cpp:

Functions

double targetFunction (double x1, double x2)
 The likelihood function (a bivariate normal distribution) for this particular example. More...
 
int main (int, char *[])
 

Detailed Description

Metropolis-Hastings usage example.

Date
24.07.2016
Author
marco.nosp@m.@kle.nosp@m.esiek.nosp@m..com

A simple, very preliminary example of how the versatile-mcmc library can be used to run a metropolis-hastings sampler on a simple statistical distribution and save the output to an ASCII file.

Function Documentation

double targetFunction ( double  x1,
double  x2 
)

The likelihood function (a bivariate normal distribution) for this particular example.

Alternatively, the arguments can be encompassed in a vector:

double targetFunction(const vector<double>& p) {
return math::biVariateNormalPDF(p[0], p[1], 0.0, 0.0, 2.0, 3.0, 0.5);
}