Solution (source code)

= Solution

A convenient general-state-space ergodic theorem is the following. For a <positive Harris recurrent Markov chain> with invariant <probability measure> $\pi$, and a measurable function $h$ with $\pi|h|<\infty$,
$$
\boxed{\frac1n\sum_{t=1}^nh(X_t)\longrightarrow\pi h\quad\text{almost surely}.}
$$
Here $\pi h=\int h\,d\pi$ is the stationary <expected value>. <Harris recurrence> means that every set of positive irreducibility measure is visited almost surely from every state; positive recurrence supplies an invariant probability rather than only an infinite invariant measure. The <ergodic theorem for a positive Harris recurrent Markov chain> holds from any starting state under these Harris hypotheses. <aperiodicity> is not necessary just for averages.

A useful sufficient form of the <central limit theorem for a geometrically ergodic Markov chain> adds <aperiodicity>, <geometric ergodicity>, and $\pi(|h|^{2+\delta})<\infty$ for some $\delta>0$. It gives
$$
\boxed{\sqrt n\left(\frac1n\sum_{t=1}^nh(X_t)-\pi h\right)\Rightarrow N(0,v_h),\qquad
v_h=\gamma_h(0)+2\sum_{k=1}^\infty\gamma_h(k).}
$$
These are sufficient hypotheses, not a claim that irreducibility alone ensures a <central limit theorem>. The <Markov chain Monte Carlo asymptotic variance> uses stationary covariances $\gamma_h(k)=\operatorname{Cov}_\pi(h(X_0),h(X_k))$, with $\gamma_h(0)=\operatorname{Var}_\pi h$. The series is absolutely convergent under the stated sufficient assumptions. If $\gamma_h(0)>0$, write $\rho_h(k)=\gamma_h(k)/\gamma_h(0)$ and $v_h=\gamma_h(0)\tau_{\rm int}$, where the <integrated autocorrelation time> is $\tau_{\rm int}=1+2\sum_{k\geq1}\rho_h(k)$. When $v_h>0$, the <effective sample size of a Markov chain> is approximately $n/\tau_{\rm int}$. Negative correlations can reduce the asymptotic <variance>; a zero asymptotic <variance> gives a degenerate normal limit. For constant $h$, <variance> is zero and the autocorrelation normalization is undefined.