tristanz / ScytheMCMC (http://bytebucket.org/tristanz/scythemcmc/wiki/html/index.html)
A Scythe Markov Chain Monte Carlo C++ Framework
Clone this repository (size: 1.0 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/tristanz/scythemcmc
| commit 9: | 2c3f6d31fdc3 |
| parent 8: | f3d19d045528 |
| branch: | default |
Small fixes.
Changed (Δ9 bytes):
raw changeset »
src/mcmc.h (6 lines added, 6 lines removed)
| … | … | @@ -127,7 +127,7 @@ mersenne myrng; |
127 |
127 |
* MCMC samplers. Other options are passed through an .ini config file. |
128 |
128 |
*/ |
129 |
129 |
struct MCMCOptions { |
130 |
/// Sample size. (iterations - burnin)/ |
|
130 |
/// Sample size. (iterations - burnin)/(thin + 1). |
|
131 |
131 |
int sample_size; |
132 |
132 |
/// Thinning interval |
133 |
133 |
int thin; |
| … | … | @@ -688,7 +688,7 @@ public: |
688 |
688 |
* |
689 |
689 |
* \param idenominator Tuning parameter equal to the inverse denominator \f$1/d\f$ of a Beta distribution. |
690 |
690 |
*/ |
691 |
BetaProposal(double idenominator) |
|
691 |
BetaProposal(double idenominator) { |
|
692 |
692 |
denom_ = 1/idenominator; |
693 |
693 |
} |
694 |
694 |
|
| … | … | @@ -697,8 +697,8 @@ public: |
697 |
697 |
* \param starting_value Starting value (mean of Beta distribution). |
698 |
698 |
*/ |
699 |
699 |
double Draw(double starting_value) { |
700 |
double alpha_ = starting_value * denom_; |
|
701 |
double beta_ = alpha - denom_; |
|
700 |
double alpha = starting_value * denom_; |
|
701 |
double beta = alpha - denom_; |
|
702 |
702 |
return myrng.rbeta(alpha, beta); |
703 |
703 |
} |
704 |
704 |
|
| … | … | @@ -710,7 +710,7 @@ public: |
710 |
710 |
double LogDensity(double new_value, double starting_value) { |
711 |
711 |
double alpha = starting_value * denom_; |
712 |
712 |
double beta = alpha - denom_; |
713 |
return |
|
713 |
return dbeta(new_value, alpha, beta); |
|
714 |
714 |
} |
715 |
715 |
|
716 |
716 |
private: |
| … | … | @@ -756,7 +756,7 @@ public: |
756 |
756 |
*/ |
757 |
757 |
double LogDensity(double new_value, double starting_value) { |
758 |
758 |
double logmean = log(starting_value); |
759 |
return |
|
759 |
return dlnorm(new_value, logmean, logsd_); |
|
760 |
760 |
} |
761 |
761 |
|
762 |
762 |
private: |
