# Metropolis-Hastings

![](/files/-LX4ay-suKrRgpveTPZY)

Remarks:

* A sample produced by the above algorithm differs from an iid sample. For one thing, such a sample may involve repeated occurrences of the same value, since rejection of $$Y\_t$$ leads to repetition of $$X^{(t)}$$ at time $$t+1$$ (an impossible occurrence in absolutely continuous iid settings)
* Minimal regularity conditions on both $$f$$ and the conditional distribution $$q$$ for $$f$$ to be the limiting distribution of the chain $$X^{(t)}$$: $$\cup\_{x\in \mathrm{supp}, f}\mathrm{supp}, q(y\mid x)\supset \mathrm{supp},,f$$.
* $$f$$ is the stationary distribution of the Metropolis chain: it satisfies the detailed balance property.

  $$
  K(x,y) = \rho(x,y)q(y\mid x)+(1-r(x))\delta\_x(y),.
  $$

The MH Markov chain has, by construction, an invariant probability distribution $$f$$, if it is also an aperiodic [Harris chain](https://github.com/szcf-weiya/MonteCarlo/tree/7992ce819e3ed5698052814ec15692627f3eaba0/MarkovChain/def_harris_recurrent.png), then we can apply [ergodic theorem](https://github.com/szcf-weiya/MonteCarlo/tree/7992ce819e3ed5698052814ec15692627f3eaba0/MarkovChain/thm_ergodic.png) to establish a [convergence result](https://github.com/szcf-weiya/MonteCarlo/tree/7992ce819e3ed5698052814ec15692627f3eaba0/MH/thm_converge.png).

* A sufficient condition to be aperiodic: allow events such as $${X^{(t+1)}=X^{(t)}}$$.
* Property of irreducibility: sufficient conditions such as positivity of the conditional density $$q$$.
* If the MH chain is $$f$$-irreducible, it is Harris recurrent.
* A somewhat less restrictive condition for irreducibility and aperiodicity.

In the following sections, let's introduce other versions of Metropolis-Hastings.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mc.hohoweiya.xyz/mh.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
