Stan  2.14.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 46 of file chains.hpp.

Constructor & Destructor Documentation

§ chains() [1/3]

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

Definition at line 322 of file chains.hpp.

§ chains() [2/3]

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

Definition at line 325 of file chains.hpp.

§ chains() [3/3]

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

Definition at line 331 of file chains.hpp.

Member Function Documentation

§ add() [1/4]

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

Definition at line 399 of file chains.hpp.

§ add() [2/4]

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

Definition at line 434 of file chains.hpp.

§ add() [3/4]

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 450 of file chains.hpp.

§ add() [4/4]

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

Definition at line 463 of file chains.hpp.

§ autocorrelation() [1/2]

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

Definition at line 654 of file chains.hpp.

§ autocorrelation() [2/2]

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

Definition at line 658 of file chains.hpp.

§ autocovariance() [1/2]

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

Definition at line 663 of file chains.hpp.

§ autocovariance() [2/2]

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

Definition at line 667 of file chains.hpp.

§ central_interval() [1/4]

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 622 of file chains.hpp.

§ central_interval() [2/4]

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

Definition at line 634 of file chains.hpp.

§ central_interval() [3/4]

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 644 of file chains.hpp.

§ central_interval() [4/4]

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 649 of file chains.hpp.

§ correlation() [1/4]

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 567 of file chains.hpp.

§ correlation() [2/4]

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

Definition at line 571 of file chains.hpp.

§ correlation() [3/4]

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 575 of file chains.hpp.

§ correlation() [4/4]

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 581 of file chains.hpp.

§ covariance() [1/4]

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 548 of file chains.hpp.

§ covariance() [2/4]

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

Definition at line 552 of file chains.hpp.

§ covariance() [3/4]

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 556 of file chains.hpp.

§ covariance() [4/4]

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 562 of file chains.hpp.

§ effective_sample_size() [1/2]

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

Definition at line 672 of file chains.hpp.

§ effective_sample_size() [2/2]

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

Definition at line 681 of file chains.hpp.

§ index()

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

Definition at line 353 of file chains.hpp.

§ mean() [1/4]

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

Definition at line 499 of file chains.hpp.

§ mean() [2/4]

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

Definition at line 503 of file chains.hpp.

§ mean() [3/4]

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

Definition at line 507 of file chains.hpp.

§ mean() [4/4]

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

Definition at line 511 of file chains.hpp.

§ num_chains()

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

Definition at line 337 of file chains.hpp.

§ num_kept_samples() [1/2]

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

Definition at line 388 of file chains.hpp.

§ num_kept_samples() [2/2]

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

Definition at line 392 of file chains.hpp.

§ num_params()

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

Definition at line 341 of file chains.hpp.

§ num_samples() [1/2]

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

Definition at line 377 of file chains.hpp.

§ num_samples() [2/2]

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

Definition at line 381 of file chains.hpp.

§ param_name()

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

Definition at line 349 of file chains.hpp.

§ param_names()

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

Definition at line 345 of file chains.hpp.

§ quantile() [1/4]

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 586 of file chains.hpp.

§ quantile() [2/4]

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

Definition at line 590 of file chains.hpp.

§ quantile() [3/4]

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 594 of file chains.hpp.

§ quantile() [4/4]

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

Definition at line 598 of file chains.hpp.

§ quantiles() [1/4]

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 603 of file chains.hpp.

§ quantiles() [2/4]

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

Definition at line 607 of file chains.hpp.

§ quantiles() [3/4]

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 612 of file chains.hpp.

§ quantiles() [4/4]

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 618 of file chains.hpp.

§ samples() [1/4]

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

Definition at line 476 of file chains.hpp.

§ samples() [2/4]

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

Definition at line 480 of file chains.hpp.

§ samples() [3/4]

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 491 of file chains.hpp.

§ samples() [4/4]

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

Definition at line 495 of file chains.hpp.

§ sd() [1/4]

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

Definition at line 515 of file chains.hpp.

§ sd() [2/4]

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

Definition at line 519 of file chains.hpp.

§ sd() [3/4]

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

Definition at line 523 of file chains.hpp.

§ sd() [4/4]

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

Definition at line 527 of file chains.hpp.

§ set_warmup() [1/2]

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

Definition at line 361 of file chains.hpp.

§ set_warmup() [2/2]

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

Definition at line 365 of file chains.hpp.

§ split_potential_scale_reduction() [1/2]

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

Definition at line 685 of file chains.hpp.

§ split_potential_scale_reduction() [2/2]

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

Definition at line 694 of file chains.hpp.

§ variance() [1/4]

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

Definition at line 531 of file chains.hpp.

§ variance() [2/4]

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

Definition at line 535 of file chains.hpp.

§ variance() [3/4]

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

Definition at line 539 of file chains.hpp.

§ variance() [4/4]

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

Definition at line 543 of file chains.hpp.

§ warmup() [1/2]

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

Definition at line 369 of file chains.hpp.

§ warmup() [2/2]

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

Definition at line 373 of file chains.hpp.


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

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