![]() |
Stan
1.3
probability, sampling & optimization
|
Markov chain Monte Carlo samplers. More...
Classes | |
| class | adaptive_cdhmc |
| Adaptive "constant distance" Hamiltonian Monte Carlo (CDHMC) sampler. More... | |
| class | adaptive_hmc |
| Adaptive Hamiltonian Monte Carlo (HMC) sampler. More... | |
| class | adaptive_sampler |
| An abstract base class for adaptive samplers. More... | |
| class | chains |
An mcmc::chains object stores parameter names and dimensionalities along with samples from multiple chains. More... | |
| class | DualAverage |
| Implements Nesterov's dual average algorithm. More... | |
| class | hmc_base |
| class | nuts |
| No-U-Turn Sampler (NUTS). More... | |
| class | nuts_diag |
| No-U-Turn Sampler (NUTS) with varying step sizes. More... | |
| class | nuts_massgiven |
| No-U-Turn Sampler (NUTS) with varying step sizes. More... | |
| class | nuts_nondiag |
| No-U-Turn Sampler (NUTS) with varying step sizes. More... | |
| class | sample |
| Representation of a MCMC sample. More... | |
Functions | |
| void | write_error_msgs (std::ostream *error_msgs, const std::domain_error &e) |
| double | leapfrog (stan::model::prob_grad &model, std::vector< int > z, std::vector< double > &x, std::vector< double > &m, std::vector< double > &g, double epsilon, std::ostream *error_msgs=0, std::ostream *output_msgs=0) |
| Computes the log probability for a single leapfrog step in Hamiltonian Monte Carlo. | |
| double | rescaled_leapfrog (stan::model::prob_grad &model, std::vector< int > z, const std::vector< double > &step_sizes, std::vector< double > &x, std::vector< double > &m, std::vector< double > &g, double epsilon, std::ostream *error_msgs=0, std::ostream *output_msgs=0) |
| double | nondiag_leapfrog (stan::model::prob_grad &model, std::vector< int > z, const Eigen::MatrixXd &_cov_L, std::vector< double > &x, std::vector< double > &m, std::vector< double > &g, double epsilon, std::ostream *error_msgs=0, std::ostream *output_msgs=0) |
| void | read_cov (std::string &cov_file, Eigen::MatrixXd &cov_L) |
| int | sample_unnorm_log (std::vector< double > probs, boost::uniform_01< boost::mt19937 & > &rand_uniform_01) |
Markov chain Monte Carlo samplers.
| double stan::mcmc::leapfrog | ( | stan::model::prob_grad & | model, |
| std::vector< int > | z, | ||
| std::vector< double > & | x, | ||
| std::vector< double > & | m, | ||
| std::vector< double > & | g, | ||
| double | epsilon, | ||
| std::ostream * | error_msgs = 0, |
||
| std::ostream * | output_msgs = 0 |
||
| ) |
Computes the log probability for a single leapfrog step in Hamiltonian Monte Carlo.
If a domain error occurs when calling the model's grad_log_prob(), this function returns -inf. Domain errors can occur when distribution functions are called with parameters out of support.
| [in] | model | Probability model with gradients. |
| [in] | z | Integer parameters. |
| [in] | x | Real parameters |
| [in,out] | m | Momentum. |
| [in,out] | g | Gradient at x, z. |
| [in] | epsilon | Step size used in Hamiltonian dynamics. |
| [in,out] | error_msgs | Output stream for error messages. |
| [in,out] | output_msgs | Output stream for output messages. |
| double stan::mcmc::nondiag_leapfrog | ( | stan::model::prob_grad & | model, |
| std::vector< int > | z, | ||
| const Eigen::MatrixXd & | _cov_L, | ||
| std::vector< double > & | x, | ||
| std::vector< double > & | m, | ||
| std::vector< double > & | g, | ||
| double | epsilon, | ||
| std::ostream * | error_msgs = 0, |
||
| std::ostream * | output_msgs = 0 |
||
| ) |
| void stan::mcmc::read_cov | ( | std::string & | cov_file, |
| Eigen::MatrixXd & | cov_L | ||
| ) |
| double stan::mcmc::rescaled_leapfrog | ( | stan::model::prob_grad & | model, |
| std::vector< int > | z, | ||
| const std::vector< double > & | step_sizes, | ||
| std::vector< double > & | x, | ||
| std::vector< double > & | m, | ||
| std::vector< double > & | g, | ||
| double | epsilon, | ||
| std::ostream * | error_msgs = 0, |
||
| std::ostream * | output_msgs = 0 |
||
| ) |
| int stan::mcmc::sample_unnorm_log | ( | std::vector< double > | probs, |
| boost::uniform_01< boost::mt19937 & > & | rand_uniform_01 | ||
| ) |