BIE::Ensemble Class Reference

Ensemble caches an group of posterior states in a vector and provides member functions to characterize the posterior from this distribution and produce statistical diagnostics on the convergence of the simulation. More...

#include <Ensemble.h>

Inheritance diagram for BIE::Ensemble:
Collaboration diagram for BIE::Ensemble:

List of all members.
int count
 State variables and vectors.
int offset
 Offset of current count list from zero.
int burnIn
 Offset at convergence.
int cur_index
 The current index in the cache.
int ibeg
 Currently unused (remove?).
int clev
 Level on creation.
vector< double > ccum
 Fraction of states in each subspace.
vector< pair< double, int > > fraction
 For sampling.
deque< StateDatastates
 State cache.
Uniform * unit
 Uniform random number generator.
DiscreteUniform * disc
 Discrete uniform random number generator.
bool dimensions_set
 True if the ensemble has had its mixture cardinality and model dimension set somehow (either in the constructor or by the member function).
bool verbose
 Verbose output.
int _id
 Local instance number.
static int instance
 Count instances.
static int keep
 Global variables.
static double thresh
 Principal component threshold (default=1.0e-12).
static bool continuous
 For variable component mixtures, specify whether to determine the range of continuously adjacent non-zero components (continuous=true, default) or the minimum and maximum (allowing for the possibility of zero frequency component counts (continuous=false).
static int key_pos
 Which element of parameter vector to be used as index key (default=0).
int sampleSubspace ()
 Sample from marginalized component number distribution.
void makeSampleFraction (vector< int > &)
 Make fraction map for sampling.

ComputeDistribution

Computes the covariance matrix and its eigenvalues/vectors

Return = 1 (variance computed), Return = 0 (too few values)

class boost::serialization::access
virtual void ComputeDistribution ()
 Compute distribution estimate as needed.
virtual void ComputeDistribution (int n)
virtual void stats (int n, double &m, double &s)
 Returns the mean and variance for the posterior probabilties for the last $n$ states in the ensemble.
virtual int Nstates ()
virtual double PDFSubspace (int m)
virtual double logPDF (State &p)
 Log of differential distribution function.
virtual double logPDFMarginal (int m, int n, vector< double > &V)
 Log of differential distribution function for a component in subspace.
virtual EnsembleNew ()
 Object factory (clone).
virtual vector< double > Mean (int m)
 Retrieve the mean per subspace.
virtual vector< double > StdDev (int m)
 Retrieve the std dev per subspace.
virtual vector< double > StdDev (void)
 Retrieve the std dev.
virtual vector< double > Mean (void)
 Retrieve the mean.
virtual vector< double > Sample (int m)
 Sample the distribution.
virtual vector< double > Sample ()
 Sample the distribution.
virtual vector< double > Width (int m)
 Width.
virtual vector< double > StdDevMarginal (int m, int n)
 Retrieve the std dev for the component marginal.
virtual vector< double > MeanMarginal (int m, int n)
 Retrieve the mean for the component marginal.
virtual vector< double > SampleMarginal (int m, int n)
 Sample the distribution for the component marginal.
virtual vector< double > WidthMarginal (int m, int n)
 Width.
virtual void PrintDiag (ostream &out)
 Print current covariance matrix (debug and diag).
virtual void PrintDiag (string &outfile)
virtual int MinC ()
 State with minimum number of components.
virtual int MaxC ()
 State with maximum number of components.
virtual void Broadcast ()
 Copy state to all nodes.

Public Member Functions

 Ensemble ()
 Constructor.
 Ensemble (int nmix, int ndim)
 Mixture constructor.
 Ensemble (int nmix, int ndim, int level, int nburn, string filename, int keypos)
 General constructor.
 Ensemble (const Ensemble &)
 Copy constructor.
 ~Ensemble ()
 Destructor.
virtual void Reset (int nmix, int ndim)
 Reinitialize the Ensemble.
virtual void Reset (int nmix, int ndim, int level, int nburn, string filename, int keypos)
 Reinitialize the Ensemble.
virtual void setDimensions (int nmix, int ndim)
 Set total size of arrays.
virtual void setContinuous ()
 Set multiple component range to continuous.
virtual void setMaxRange ()
 Set multiple component range to maximum range (allow zero freq. states).
virtual void setNKeep (int n)
 Set the maximum number of states to keep in cache.
virtual void Order (int n)
 Order the mixture by the given component n<0 is the weight n>=0 is the parameter vector index.
virtual void setVerboseOn ()
 Diagnostics for intermediate computation.
virtual void setVerboseOff ()
 Turn off intermediate computation diagnostics.
virtual bool AccumData (double, State &)
 Adds a state to the deque.
virtual bool AccumData (StateData &s)
 Adds a state to the deque (using StateData structure).
virtual bool AccumulateData (double v, RecordBuffer *datapoint)
 Required member but not used here.

Protected Attributes

int M
 Number of components in the state.
vector< int > cnts
 The number of states used in the distribution.
vector< int > mcnt
int minc
 Mininum number of component states (from cnts).
int maxc
 Mmaximum number of component states (from cnts).
int N
 Dimension per component.


Detailed Description

Ensemble caches an group of posterior states in a vector and provides member functions to characterize the posterior from this distribution and produce statistical diagnostics on the convergence of the simulation.

The posterior state is characterized from the ensemble variance by a principal component analysis.


Constructor & Destructor Documentation

BIE::Ensemble::Ensemble ( int  nmix,
int  ndim 
)

Mixture constructor.

Parameters:
nmix is the mixture number
ndim is the dimension of each mixture copmonent

BIE::Ensemble::Ensemble ( int  nmix,
int  ndim,
int  level,
int  nburn,
string  filename,
int  keypos 
)

General constructor.

Parameters:
nmix is the mixture number
ndim is the dimension of each mixture copmonent
level is the update level
nburn is the desired number of converged states
filename is the logfile for ensemble statistics
keypos is the parameter index for computing PDF and CDF evaluations


Member Function Documentation

virtual void BIE::Ensemble::stats ( int  n,
double &  m,
double &  s 
) [virtual]

Returns the mean and variance for the posterior probabilties for the last $n$ states in the ensemble.

If $n$ is less the number of states in the deque, the whole deque is used. If the number of states is less than 2, zero vales are returned.

virtual double BIE::Ensemble::logPDFMarginal ( int  m,
int  n,
vector< double > &  V 
) [inline, virtual]

Log of differential distribution function for a component in subspace.

Parameters:
m,component 
n,and parameter vector
V. This method is used by ReversibleJump classes.

Reimplemented in BIE::EnsembleDisc, and BIE::EnsembleStat.

Here is the caller graph for this function:


Member Data Documentation

int BIE::Ensemble::count [protected]

State variables and vectors.

Total count

int BIE::Ensemble::keep [static]

Global variables.

Number of states to retain (FIFO queue, default=4000)

For variable component mixtures, specify whether to determine the range of continuously adjacent non-zero components (continuous=true, default) or the minimum and maximum (allowing for the possibility of zero frequency component counts (continuous=false).

These can be set in the CLI using the SetContinuous and SetMaxRange member functions


The documentation for this class was generated from the following file:

Send suggestions, questions, and feedback to WEINBERG at ASTRO dot UMASS dot EDU.
Documentation generated at Fri Mar 26 00:35:12 2010 by doxygen