MCMC algorithm -- understanding some paremeters

  • Python
  • Thread starter Arman777
  • Start date
  • Tags
    Algorithm
In summary, the programmer is trying to run a program, but does not understand some of the parameters.
  • #1
Arman777
Insights Author
Gold Member
2,168
193
Recently I have shared a question about a program called SimpleMC and how to run it.

Running a Github File on VS code for windows 10- File system problem ( | Physics Forums

I am trying to understand an MCMC program. I manage to run it, but I am trying to understand the meaning of the some parameters in the analysis.

The code is something like this

Python:
[mcmc]
;Nsamples
nsamp   = 50000

;Burn-in
skip    = 300

;temperature at which to sample
temp    = 2

; Gelman-Rubin for convergence
GRstop  = 0.01

;every number of steps check the GR-criteria
checkGR = 500

;1 if single cpu , otherwise is giving by the nproc-> mpi -np #
chainno = 0

This is for the metropolis-hastings algorithm. How my results depend on these parameters or what these parameters mean ?
I understood the nsamp and skip, I also kind of know what GRstop and checkGR means but I have no idea what temp and chainno means.
 
Last edited:
  • Skeptical
Likes pbuk
Technology news on Phys.org
  • #2
Perhaps you can find the meaning behind the parameters by looking at where they are referenced in the source code you have.

The current programming paradigm is to skip documentation for the most part unless its going to be used by a lot of people. Instead they will embed comments that give you a hint of what they are used for.
 
  • Like
Likes Arman777
  • #3
temp is the temperature at which to sample and if chainno is 1 then it will use 1 cpu, or you can set it to a different number.
 
  • #4
jedishrfu said:
Perhaps you can find the meaning behind the parameters by looking at where they are referenced in the source code you have.

The current programming paradigm is to skip documentation for the most part unless its going to be used by a lot of people. Instead they will embed comments that give you a hint of what they are used for.
I tried but not luck. I have find this MrBayes (sourceforge.net)
 
  • #5
pbuk said:
temp is the temperature at which to sample and if chainno is 1 then it will use 1 cpu, or you can set it to a different number.
I guess I have 2 cores but I am setting chains = 4 and temp = 0.2 it seems to be working.
 

1. What is the purpose of an MCMC algorithm?

An MCMC (Markov Chain Monte Carlo) algorithm is a computational method used for simulating complex systems and estimating their parameters. It is commonly used in statistics and machine learning to approximate the posterior distribution of a model's parameters.

2. How does an MCMC algorithm work?

An MCMC algorithm works by creating a Markov chain, which is a sequence of random samples that are correlated with each other. The algorithm moves through the parameter space, generating new samples based on the current sample and a proposal distribution. Over time, the Markov chain converges to a stationary distribution, which is the desired posterior distribution.

3. What is the role of the "burn-in" period in an MCMC algorithm?

The "burn-in" period in an MCMC algorithm refers to the initial samples that are discarded before the algorithm starts generating samples for the posterior distribution. This period allows the Markov chain to reach the stationary distribution and ensures that the samples are not influenced by the starting point.

4. How do you determine the convergence of an MCMC algorithm?

There are several methods for determining the convergence of an MCMC algorithm, such as visually inspecting trace plots, calculating the autocorrelation of the samples, or performing statistical tests like the Gelman-Rubin diagnostic. Ideally, the samples should be independent and drawn from the same distribution, indicating that the algorithm has converged.

5. What are some common parameters that need to be understood in an MCMC algorithm?

Some common parameters in an MCMC algorithm include the number of iterations, the proposal distribution, the acceptance rate, and the burn-in period. Understanding these parameters is essential for optimizing the algorithm's performance and ensuring accurate estimation of the posterior distribution.

Similar threads

  • Programming and Computer Science
Replies
2
Views
902
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
2K
  • Programming and Computer Science
Replies
12
Views
3K
  • Programming and Computer Science
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
7K
Back
Top