Public Member Functions | List of all members
o2scl::prob_cond_mdim< vec_t > Class Template Referenceabstract

A multi-dimensional conditional probability density function. More...

#include <prob_dens_func.h>

Detailed Description

template<class vec_t = boost::numeric::ublas::vector<double>>
class o2scl::prob_cond_mdim< vec_t >

Note that conditional probabilities are typically written $ P(A|B) $, i.e. the probability of $ A $ given $ B $. O2scl arranges the function parameters for the functions o2scl::prob_cond_mdim::pdf, o2scl::prob_cond_mdim::log_pdf o2scl::prob_cond_mdim::operator()(), so that $ B $ is given first, and $ A $ is second.

o2scl::prob_cond_mdim::log_metrop_hast is a vector from $ B $ as denoted above.

This class is experimental.

Definition at line 1465 of file prob_dens_func.h.

Public Member Functions

virtual size_t dim () const
 The dimensionality.
 
virtual double pdf (const vec_t &x_B, const vec_t &x_A) const =0
 The conditional probability of x_A given x_B, i.e. $ P(A|B) $.
 
virtual double log_pdf (const vec_t &x_B, const vec_t &x_A) const =0
 The log of the conditional probability of x_A given x_B i.e. $ \log [P(A|B)] $.
 
virtual void operator() (const vec_t &x_B, vec_t &x_A) const =0
 Sample the distribution.
 
virtual double log_metrop_hast (const vec_t &x, vec_t &x_prime) const
 Sample the distribution and return the log of the Metropolis-Hastings ratio. More...
 

Member Function Documentation

◆ log_metrop_hast()

template<class vec_t = boost::numeric::ublas::vector<double>>
virtual double o2scl::prob_cond_mdim< vec_t >::log_metrop_hast ( const vec_t &  x,
vec_t &  x_prime 
) const
inlinevirtual

The Metropolis-Hastings ratio for a step beginning at $ x $ and ending at $ x^{\prime} $ is obeys

\[ \frac{P(x^{\prime})g(x|x^{\prime})}{P(x)g(x^{\prime}|x)} \]

taking the log, this gives

\[ \log[P(x^{\prime})] - \log[P(x)] + \log \left[ \frac{g(x|x^{\prime})}{g(x^{\prime}|x)} \right] \]

thus this function computes

\[ \log \left[ g(x|x^{\prime}) \right] - \log \left[ g(x^{\prime}|x) \right] \]

and thus, to keep a similar notation to prob_cond_mdim::pdf() where $ g(x^{\prime}|x) $ is obtained from

pdf(x,x_prime)

this function computes

h(x,x_prime) = log_pdf(x_prime,x)-log_pdf(x,x_prime);

To check this, in the limit that $ g(x|x^{\prime}) \rightarrow P(x) $ this function returns

\[ \log \left[ \frac{P(x)}{P(x^{\prime})} \right] \]

Definition at line 1524 of file prob_dens_func.h.


The documentation for this class was generated from the following file:
o2scl::prob_cond_mdim::log_pdf
virtual double log_pdf(const vec_t &x_B, const vec_t &x_A) const =0
The log of the conditional probability of x_A given x_B i.e. .
o2scl::prob_cond_mdim::pdf
virtual double pdf(const vec_t &x_B, const vec_t &x_A) const =0
The conditional probability of x_A given x_B, i.e. .

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).