Stan  2.10.0
probability, sampling & optimization
Public Member Functions | List of all members
stan::mcmc::chains< RNG > Class Template Reference

An mcmc::chains object stores parameter names and dimensionalities along with samples from multiple chains. More...

#include <chains.hpp>

Public Member Functions

 chains (const Eigen::Matrix< std::string, Dynamic, 1 > &param_names)
 
 chains (const std::vector< std::string > &param_names)
 
 chains (const stan::io::stan_csv &stan_csv)
 
int num_chains () const
 
int num_params () const
 
const Eigen::Matrix< std::string, Dynamic, 1 > & param_names () const
 
const std::string & param_name (int j) const
 
int index (const std::string &name) const
 
void set_warmup (const int chain, const int warmup)
 
void set_warmup (const int warmup)
 
const Eigen::VectorXi & warmup () const
 
int warmup (const int chain) const
 
int num_samples (const int chain) const
 
int num_samples () const
 
int num_kept_samples (const int chain) const
 
int num_kept_samples () const
 
void add (const int chain, const Eigen::MatrixXd &sample)
 
void add (const Eigen::MatrixXd &sample)
 
void add (const std::vector< std::vector< double > > &sample)
 Convert a vector of vector<double> to Eigen::MatrixXd. More...
 
void add (const stan::io::stan_csv &stan_csv)
 
Eigen::VectorXd samples (const int chain, const int index) const
 
Eigen::VectorXd samples (const int index) const
 
Eigen::VectorXd samples (const int chain, const std::string &name) const
 
Eigen::VectorXd samples (const std::string &name) const
 
double mean (const int chain, const int index) const
 
double mean (const int index) const
 
double mean (const int chain, const std::string &name) const
 
double mean (const std::string &name) const
 
double sd (const int chain, const int index) const
 
double sd (const int index) const
 
double sd (const int chain, const std::string &name) const
 
double sd (const std::string &name) const
 
double variance (const int chain, const int index) const
 
double variance (const int index) const
 
double variance (const int chain, const std::string &name) const
 
double variance (const std::string &name) const
 
double covariance (const int chain, const int index1, const int index2) const
 
double covariance (const int index1, const int index2) const
 
double covariance (const int chain, const std::string &name1, const std::string &name2) const
 
double covariance (const std::string &name1, const std::string &name2) const
 
double correlation (const int chain, const int index1, const int index2) const
 
double correlation (const int index1, const int index2) const
 
double correlation (const int chain, const std::string &name1, const std::string &name2) const
 
double correlation (const std::string &name1, const std::string &name2) const
 
double quantile (const int chain, const int index, const double prob) const
 
double quantile (const int index, const double prob) const
 
double quantile (int chain, const std::string &name, double prob) const
 
double quantile (const std::string &name, const double prob) const
 
Eigen::VectorXd quantiles (int chain, int index, const Eigen::VectorXd &probs) const
 
Eigen::VectorXd quantiles (int index, const Eigen::VectorXd &probs) const
 
Eigen::VectorXd quantiles (int chain, const std::string &name, const Eigen::VectorXd &probs) const
 
Eigen::VectorXd quantiles (const std::string &name, const Eigen::VectorXd &probs) const
 
Eigen::Vector2d central_interval (int chain, int index, double prob) const
 
Eigen::Vector2d central_interval (int index, double prob) const
 
Eigen::Vector2d central_interval (int chain, const std::string &name, double prob) const
 
Eigen::Vector2d central_interval (const std::string &name, double prob) const
 
Eigen::VectorXd autocorrelation (const int chain, const int index) const
 
Eigen::VectorXd autocorrelation (int chain, const std::string &name) const
 
Eigen::VectorXd autocovariance (const int chain, const int index) const
 
Eigen::VectorXd autocovariance (int chain, const std::string &name) const
 
double effective_sample_size (const int index) const
 
double effective_sample_size (const std::string &name) const
 
double split_potential_scale_reduction (const int index) const
 
double split_potential_scale_reduction (const std::string &name) const
 

Detailed Description

template<class RNG = boost::random::ecuyer1988>
class stan::mcmc::chains< RNG >

An mcmc::chains object stores parameter names and dimensionalities along with samples from multiple chains.

Synchronization: For arbitrary concurrent use, the read and write methods need to be read/write locked. Multiple writers can be used concurrently if they write to different chains. Readers for single chains need only be read/write locked with writers of that chain. For reading across chains, full read/write locking is required. Thus methods will be classified as global or single-chain read or write methods.

Storage Order: Storage is column/last-index major.

Definition at line 51 of file chains.hpp.

Constructor & Destructor Documentation

template<class RNG = boost::random::ecuyer1988>
stan::mcmc::chains< RNG >::chains ( const Eigen::Matrix< std::string, Dynamic, 1 > &  param_names)
inlineexplicit

Definition at line 327 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
stan::mcmc::chains< RNG >::chains ( const std::vector< std::string > &  param_names)
inlineexplicit

Definition at line 330 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
stan::mcmc::chains< RNG >::chains ( const stan::io::stan_csv stan_csv)
inlineexplicit

Definition at line 336 of file chains.hpp.

Member Function Documentation

template<class RNG = boost::random::ecuyer1988>
void stan::mcmc::chains< RNG >::add ( const int  chain,
const Eigen::MatrixXd &  sample 
)
inline

Definition at line 404 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
void stan::mcmc::chains< RNG >::add ( const Eigen::MatrixXd &  sample)
inline

Definition at line 439 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
void stan::mcmc::chains< RNG >::add ( const std::vector< std::vector< double > > &  sample)
inline

Convert a vector of vector<double> to Eigen::MatrixXd.

This method is added for the benefit of software wrapping Stan (e.g., PyStan) so that it need not additionally wrap Eigen.

Definition at line 455 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
void stan::mcmc::chains< RNG >::add ( const stan::io::stan_csv stan_csv)
inline

Definition at line 468 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::autocorrelation ( const int  chain,
const int  index 
) const
inline

Definition at line 659 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::autocorrelation ( int  chain,
const std::string &  name 
) const
inline

Definition at line 663 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::autocovariance ( const int  chain,
const int  index 
) const
inline

Definition at line 668 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::autocovariance ( int  chain,
const std::string &  name 
) const
inline

Definition at line 672 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::Vector2d stan::mcmc::chains< RNG >::central_interval ( int  chain,
int  index,
double  prob 
) const
inline

Definition at line 627 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::Vector2d stan::mcmc::chains< RNG >::central_interval ( int  index,
double  prob 
) const
inline

Definition at line 639 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::Vector2d stan::mcmc::chains< RNG >::central_interval ( int  chain,
const std::string &  name,
double  prob 
) const
inline

Definition at line 649 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::Vector2d stan::mcmc::chains< RNG >::central_interval ( const std::string &  name,
double  prob 
) const
inline

Definition at line 654 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::correlation ( const int  chain,
const int  index1,
const int  index2 
) const
inline

Definition at line 572 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::correlation ( const int  index1,
const int  index2 
) const
inline

Definition at line 576 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::correlation ( const int  chain,
const std::string &  name1,
const std::string &  name2 
) const
inline

Definition at line 580 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::correlation ( const std::string &  name1,
const std::string &  name2 
) const
inline

Definition at line 586 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::covariance ( const int  chain,
const int  index1,
const int  index2 
) const
inline

Definition at line 553 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::covariance ( const int  index1,
const int  index2 
) const
inline

Definition at line 557 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::covariance ( const int  chain,
const std::string &  name1,
const std::string &  name2 
) const
inline

Definition at line 561 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::covariance ( const std::string &  name1,
const std::string &  name2 
) const
inline

Definition at line 567 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::effective_sample_size ( const int  index) const
inline

Definition at line 677 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::effective_sample_size ( const std::string &  name) const
inline

Definition at line 686 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
int stan::mcmc::chains< RNG >::index ( const std::string &  name) const
inline

Definition at line 358 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::mean ( const int  chain,
const int  index 
) const
inline

Definition at line 504 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::mean ( const int  index) const
inline

Definition at line 508 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::mean ( const int  chain,
const std::string &  name 
) const
inline

Definition at line 512 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::mean ( const std::string &  name) const
inline

Definition at line 516 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
int stan::mcmc::chains< RNG >::num_chains ( ) const
inline

Definition at line 342 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
int stan::mcmc::chains< RNG >::num_kept_samples ( const int  chain) const
inline

Definition at line 393 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
int stan::mcmc::chains< RNG >::num_kept_samples ( ) const
inline

Definition at line 397 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
int stan::mcmc::chains< RNG >::num_params ( ) const
inline

Definition at line 346 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
int stan::mcmc::chains< RNG >::num_samples ( const int  chain) const
inline

Definition at line 382 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
int stan::mcmc::chains< RNG >::num_samples ( ) const
inline

Definition at line 386 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
const std::string& stan::mcmc::chains< RNG >::param_name ( int  j) const
inline

Definition at line 354 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
const Eigen::Matrix<std::string, Dynamic, 1>& stan::mcmc::chains< RNG >::param_names ( ) const
inline

Definition at line 350 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::quantile ( const int  chain,
const int  index,
const double  prob 
) const
inline

Definition at line 591 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::quantile ( const int  index,
const double  prob 
) const
inline

Definition at line 595 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::quantile ( int  chain,
const std::string &  name,
double  prob 
) const
inline

Definition at line 599 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::quantile ( const std::string &  name,
const double  prob 
) const
inline

Definition at line 603 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::quantiles ( int  chain,
int  index,
const Eigen::VectorXd &  probs 
) const
inline

Definition at line 608 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::quantiles ( int  index,
const Eigen::VectorXd &  probs 
) const
inline

Definition at line 612 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::quantiles ( int  chain,
const std::string &  name,
const Eigen::VectorXd &  probs 
) const
inline

Definition at line 617 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::quantiles ( const std::string &  name,
const Eigen::VectorXd &  probs 
) const
inline

Definition at line 623 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::samples ( const int  chain,
const int  index 
) const
inline

Definition at line 481 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::samples ( const int  index) const
inline

Definition at line 485 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::samples ( const int  chain,
const std::string &  name 
) const
inline

Definition at line 496 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
Eigen::VectorXd stan::mcmc::chains< RNG >::samples ( const std::string &  name) const
inline

Definition at line 500 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::sd ( const int  chain,
const int  index 
) const
inline

Definition at line 520 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::sd ( const int  index) const
inline

Definition at line 524 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::sd ( const int  chain,
const std::string &  name 
) const
inline

Definition at line 528 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::sd ( const std::string &  name) const
inline

Definition at line 532 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
void stan::mcmc::chains< RNG >::set_warmup ( const int  chain,
const int  warmup 
)
inline

Definition at line 366 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
void stan::mcmc::chains< RNG >::set_warmup ( const int  warmup)
inline

Definition at line 370 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::split_potential_scale_reduction ( const int  index) const
inline

Definition at line 690 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::split_potential_scale_reduction ( const std::string &  name) const
inline

Definition at line 699 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::variance ( const int  chain,
const int  index 
) const
inline

Definition at line 536 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::variance ( const int  index) const
inline

Definition at line 540 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::variance ( const int  chain,
const std::string &  name 
) const
inline

Definition at line 544 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
double stan::mcmc::chains< RNG >::variance ( const std::string &  name) const
inline

Definition at line 548 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
const Eigen::VectorXi& stan::mcmc::chains< RNG >::warmup ( ) const
inline

Definition at line 374 of file chains.hpp.

template<class RNG = boost::random::ecuyer1988>
int stan::mcmc::chains< RNG >::warmup ( const int  chain) const
inline

Definition at line 378 of file chains.hpp.


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

     [ Stan Home Page ] © 2011–2016, Stan Development Team.