Calculating acceptance rate in Monte Carlo Markov Chain while doing Bayesian analyis

I am doing Bayesian analysis using a Monte Carlo Markov Chain of length 10000 and burn-in length 1000. I consider my chain as converged when the acceptance rate is equal to 23% and the chain mixing looks convincing (visual inspection). There is a difference in acceptance rate value when I consider the whole chain for acceptance rate calculation and when I consider the chain after burn-in. Which acceptance rate value should I try to make 23?

As indicated by the name, burn-in is there to stabilise the chain towards its stationary regime, so the burn-in step should not be considered for performance evaluations like acceptance rate goals.

However I want to warn you about the notion that 10⁴ simulations is large or poor in a generic sense. It will all depend on the type of target $f$ and the type of proposal $q$ you use in your algorithm. Even an acceptance rate of $23$\% may be misleading.

For instance, assume you observe $x\sim\mathcal{N}(\theta^2,1/5)$ with a prior $\theta\sim\mathcal{N}(0,1)$. The posterior on $\theta$ is bimodal with modes near $\pm\sqrt{x}$, but running the basic Metropolis-Hastings code below

target=function(x,y){
dnorm(x,0,1,log=TRUE)+dnorm(x*x,y,.2,log=TRUE)}

T=1e5
y=pi
mch=rep(rnorm(1),T)
ace=0
for (t in 2:T){
mch[t]=pop=rnorm(1,mch[t-1],.3)
if (log(runif(1))>target(pop,y)-target(mch[t-1],y)) mch[t]=mch[t-1]
ace=ace+(mch[t]==pop)
}

produces an acceptance rate of

> ace/T
 0.22921

and an output with a single mode In case you cannot reproduce the output with the above R code, here is the trace of a thinned MCMC based on 10⁵ iterations (with no burn-in) • Then how do I know whether my chain has converged or not? Also can you include the chain trace plot , is it showing a good mixing? – Safwan Mar 18 '16 at 8:05
• Rule #1 You can never tell for sure your chain has converged, unless you know precisely the target! – Xi'an Mar 18 '16 at 9:51