Metropolis Paclet SymbolMore About »

MultiTryMetropolis

MultiTryMetropolis[logpdf, logpdfjump, randommultijump, x0, n, isindep]
generates one Metropolis update starting from x0. The target distribution is p[x] with the proposal distribution J[xt,x] given current value xt. The randommultijump[xt, n] generates n proposal tries from J[xt,x]. Here logpdf[x] = Log[p[x]] and logpdfjump[xt,x] = Log[J[xt,x]]. The isindep specifies whether the proposal distribution is independent of current values.
  • To use MultitryMetropolis, you first need to load the Metropolis package using Needs["Metropolis`"].
  • The following options can be given:
DomainConstraintTrue & Specify a constraint which random variable satisfies.
  • Each update is given by {x, 1/0 (accept/not)}.
In[1]:=
Click for copyable input
This samples the standard normal distribuiton
In[2]:=
Click for copyable input
Out[2]=
Mean accept ratio:
In[3]:=
Click for copyable input
Out[3]=
Time serie:
In[4]:=
Click for copyable input
Out[4]=
Simulated distribution vs target distribution (red line):
In[5]:=
Click for copyable input
Out[5]=