Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Economics

7 Further Topics in Probability

National Graduate Institute for Policy Studies (GRIPS)

There are two important topics in probability that we haven’t yet managed to cover. One is stochastic process theory and the other is simulation. Let’s go over some of the key results.

7.1Stochastic Processes

A stochastic process on RK\RR^K is a sequence of random vectors {xt}t⩾0\{\boldx_t\}_{t\geq 0} defined on a common probability space (Ω,F,P)(\Omega, \fF, \PP). The definition has relatively little content, but the fact that all these random vectors live on the same probability space should not be overlooked. It means that probabilities such as P{xt⩾0 for all t}\PP\{\boldx_t \geq 0 \text{ for all } t\} or P{xt⩽−10 for some t}\PP\{\boldx_t \leq -10 \text{ for some } t\} are well defined. Putting the elements of the process on a common probability space pins down the joint distribution across tt.

To do any kind of analysis with stochastic processes, we need to put some structure on the joint distribution, or, equivalently, on the random elements. In practice, this is almost always done recursively. Examples are given below. For the moment, however, let’s look at stochastic processes in an abstract setting and state some definitions.

One kind of stochastic process is an IID sequence. Such sequences are ideal to work with in a statistical setting. For example, the law of large numbers tells us that in an IID environment, finite expectations can always be approximated with sample averages. If we want to know how good the approximation is, we can look to the central limit theorem.

Once we move out of the IID world, however, these helpful properties can break down. Without restrictions on our stochastic process, we can say very little about estimation. The first task, then is to describe some properties that make our stochastic process resemble an IID process in some way.

7.1.1Stationarity and Ergodicity

As a first step, let’s define a type of process that preserves one of the properties of IID processes (the "ID" part). A stochastic process {xt}t⩾0\{ \boldx_t \}_{t \geq 0} is called stationary if it has the property that the distribution of any subset of these random vectors is unaffected by shifting them forward in time. That is,

L(xt1,…,xtk)=L(xt1+m,…,xtk+m)\lL ( \boldx_{t_1}, \ldots, \boldx_{t_k} ) = \lL ( \boldx_{t_1 + m}, \ldots, \boldx_{t_k + m} )

for any m∈Nm \in \NN and any sequence of integers t1,…,tkt_1, \ldots, t_k.

Clearly, any stationary sequence is identically distributed. In other words, for any stationary sequence, the sequence of marginals {L(xt)}\{\lL(\boldx_t)\} is a constant sequence.

Stationarity alone isn’t strong enough to give us properties like the LLN and CLT.

The problem with the process in example 7.1.4 is excessive dependence. New realizations provide insufficient (in fact no) new information. On the flip side, dependent processes can satisfy versions of the LLN if dependence is not too excessive (e.g., if xtx_t and xt+kx_{t+k} are "almost independent" for kk sufficiently large.) These are the so-called ergodic processes.

The formal definition of ergodicity varies across different literatures. Here we define a stationary stochastic process {xt}\{\boldx_t\} on RK\RR^K to be ergodic if the LLN holds; that is, if

1T∑t=1Th(xt)→pμh:=E h(xt) as T→∞\frac{1}{T} \sum_{t=1}^T h(\boldx_t) \toprob \mu_h := \EE h(\boldx_t) \quad \text{ as } \quad T \to \infty

for any B\bB-measurable h ⁣:RN→Rh \colon \RR^N \to \RR such that E ∣h(xt)∣<∞\EE |h(\boldx_t)| < \infty. (Since {xt}\{\boldx_t\} is stationary, this expectation does not depend on tt.) One of the main tasks of this chapter will be deriving sufficient conditions for ergodicity in the kinds of processes economists often work with.

Incidentally, a casual definition of ergodicity one often hears is that "cross sectional and time series averages coincide." What does that mean in the present context?

To answer the question, imagine that xt=xt\boldx_t = x_t is a binary variable with xt=1x_t = 1 if a given individual is employed at time tt and zero otherwise. In this case, 1T∑t=1Txt\frac{1}{T} \sum_{t=1}^T x_t is the fraction of time spent employed over the period 1,…,T1, \ldots, T. With h(x)=xh(x)=x, the right-hand side of (7.2) is E xt=P{xt=1}\EE x_t = \PP\{x_t = 1\}, or the stationary probability of employment. If we observe time tt employment outcomes xt1,…,xtNx_t^1, \ldots, x_t^N of individuals 1,…,N1, \ldots, N and, moreover, the individuals all follow the same model and are sufficiently independent, the cross sectional average 1N∑n=1Nxtn\frac{1}{N} \sum_{n=1}^N x_t^n will also be close to P{xt=1}\PP\{x_t = 1\}. Hence, with ergodicity and large samples, cross-sectional and time series averages (almost) coincide.

7.1.2Stochastic Recursive Sequences

In this section let’s turn to a more concrete view of stochastic processes. Afterward we’ll circle back and consider issues like ergodicity again.

Figure 7.1 shows the evolution of US GDP per capita since the early postwar era. The top panel is per capita GDP itself, while the second panel is the growth rate. How could we go about modeling such time series in a parsimonious way?

Postwar US GDP per capita. Source: Penn World Tables

Figure 7.1:Postwar US GDP per capita. Source: Penn World Tables

No reasonable model can be deterministic, since shocks play an important role in year-on-year change in GDP, and an IID process is too simple. We can, however, get close to both of these time series with one of the most common nontrivial stochastic processes: the scalar Gaussian AR(1) model

xt+1=b+axt+cwt+1with {wt}∼IIDN(0,1) and x0 givenx_{t+1} = b + a x_t + c w_{t+1} \quad \text{with } \{ w_t \} \iidsim \nN(0,1) \text{ and } x_0 \text{ given}

Here a,ba, b, and cc are parameters, while xtx_t is called the state variable. Equation (7.3) is an example of a stochastic difference equation. The process {xt}\{x_t\} it defines is called a stochastic process or stochastic recursive sequence. A realization of the process is called a time series.

The dynamics of {xt}\{x_t\} depends on the parameters. We can get some sense of this from simulation. Six individual time series {xt}\{x_t\} are shown in figure 7.2, each generated using a different value of aa. The values of bb and cc are both held fixed at 1, while x0=0x_0 = 0. R code for generating the figure is given in listing 3.

As suggested by the figure, the simulated time paths are sensitive to the value of aa. If aa is outside the interval (−1,1)(-1,1), the series tend to diverge. If ∣a∣<1|a| < 1, then the opposite is true. For example, if you look at the time series for a=0.9a = 0.9 in figure 7.2, you will see that, after an initial burn in period where the series is affected by the initial condition x0x_0, the process settles down to random motion within a band (between about 5 and 15 in this case).

Dynamics of the linear AR(1) model

Figure 7.2:Dynamics of the linear AR(1) model

# Generates an AR(1) time series starting from x = init
ar1ts <- function(init, n, b, a) {
    x <- numeric(n)
    x[1] <- init 
    w <- rnorm(n-1)
    for (t in 1:(n-1)) {
        x[t+1] <- b + a * x[t] + w[t]
    }   
    return(x)
}   

avec <- c(0.1, -0.1, 0.9, -0.9, 1.1, -1.1)
N <- 200
par(mfrow=c(3,2))  # Arrangement of figures 
for (a in avec) {
    plot(ar1ts(0, N, 1, a), type="l", xlab=paste("a = ", a), ylab="")
}

Listing 3:Code for figure 

f-ar1_dynam
(R)

If the scalar Gaussian AR(1) model in (7.3) is unable to capture important aspects of a time series that we wish to model, we can generalize it in several different directions. For example, we can remove the assumption that the shocks are normally distributed, in which case it is simply called the scalar AR(1) model. This might be desirable, if, say, the state process has heavy tails.

We can also generalize the scalar AR(1) model to RK\RR^K, yielding the vector AR(1) model, or VAR(1) model

xt+1=b+Axt+Cwt+1\boldx_{t+1} = \boldb + \boldA \boldx_t + \boldC \boldw_{t+1}

Here {wt}\{ \boldw_t \} is assumed to be IID and to satisfy E wt=0\EE \boldw_t = \boldzero and E [wtwt′]=I\EE[\boldw_t\boldw_t'] = \boldI. If wt\boldw_t is multivariate normal, then (7.4) is called the Gaussian VAR(1). The vector xt\boldx_t is called the state vector. A huge variety of models can be represented as a VAR(1) process or contain VAR processes as subcomponents (e.g., linear state space models).

An alternative generalization of the scalar AR(1) model is the scalar AR(pp) model, where the next state xt+1x_{t+1} is a linear function not just of the current state xtx_t, but of the last pp previous states. For example, the AR(2) process has dynamics

xt+1=b+axt+γxt−1+wt+1x_{t+1} = b + a x_t + \gamma x_{t-1} + w_{t+1}

Although xt+1x_{t+1} is a function of two lagged states, xtx_t and xt−1x_{t-1}, we can reformulate it as a first-order model. To begin, we define an additional state variable yty_t via yt=xt−1y_t = x_{t-1}. The dynamics can then be expressed as

xt+1=b+axt+γyt+wt+1yt+1=xt\begin{aligned} x_{t+1} &= b + a x_t + \gamma y_t + w_{t+1} \\ y_{t+1} &= x_t \end{aligned}

We can write this in matrix form as

(xt+1yt+1)=b(10)+(aγ10)(xtyt)+(10)wt+1\left( \begin{array}{c} x_{t+1} \\ y_{t+1} \end{array} \right) = b \left( \begin{array}{c} 1 \\ 0 \end{array} \right) + \left( \begin{array}{cc} a & \gamma \\ 1 & 0 \end{array} \right) \left( \begin{array}{c} x_t \\ y_t \end{array} \right) + \left( \begin{array}{c} 1 \\ 0 \end{array} \right) w_{t+1}

This is a special case of the VAR(1) model in (7.4). This example shows how higher order processes can be reduced to first-order processes by increasing the number of state variables. For this reason most theoretical discussion below takes place in the context of first-order models.

7.1.2.1Nonlinear Models

Linear models are simple but that isn’t always an advantage. Sometimes they are unable to capture the kinds of dynamics we observe in data. For example, the bursts of volatility in the graph of daily returns on the Hang Seng Index from 1990 to 2014 shown in figure 7.3 are difficult to replicate without introducing nonlinearities into our model. It’s also true that many theoretical modeling exercises produce models that are nonlinear.

Daily returns on the Hang Seng Index. Source: Yahoo! Finance

Figure 7.3:Daily returns on the Hang Seng Index. Source: Yahoo! Finance

One well-known nonlinear model is the ppth order autoregressive conditional heteroskedasticity model (ARCH(pp) model). The model arose from the need to attach a time varying volatility component σt\sigma_t to asset return models. Suppose, for example, that xt=σtwtx_t = \sigma_t w_t where σt+12=α0+α1xt2\sigma_{t+1}^2 = \alpha_0 + \alpha_1 x_t^2. Combining these equations gives the ARCH(1) model

xt+1=(α0+α1xt2)1/2wt+1with{wt}∼IIDN(0,1)x_{t+1} = (\alpha_0 + \alpha_1 x_t^2)^{1/2} w_{t+1} \quad \text{with} \quad \{ w_t \} \iidsim \nN(0,1)

and α0>0\alpha_0 > 0, α1⩾0\alpha_1 \geq 0. Still better fits to asset returns data can be obtained via Generalized ARCH models, the simplest of which is the GARCH(1,1) process

xt=σtwtσt+12=α0+α1xt2+α2σt2\begin{aligned} x_t &= \sigma_t w_t \\ \sigma_{t+1}^2 &= \alpha_0 + \alpha_1 x_t^2 + \alpha_2 \sigma_t^2 \end{aligned}

Now next period volatility depends on its own lagged state as well as xtx_t.

Another popular nonlinear model is the smooth transition autoregression (STAR) model

xt+1=g(xt)+wt+1x_{t+1} = g(x_t) + w_{t+1}

where gg is of the form

g(s):=(b0+a0s)(1−τ(s))+(b1+a1s)τ(s)g(s) := (b_0 + a_0 s)(1-\tau(s)) + (b_1 + a_1 s)\tau(s)

Here τ ⁣:R→[0,1]\tau \colon \RR \to [0,1] is increasing and satisfies lim⁡s→−∞τ(s)=0\lim_{s \to -\infty} \tau(s)=0 and lim⁡s→∞τ(s)=1\lim_{s \to \infty}\tau(s) =1. For ss near −∞-\infty, g(s)g(s) is similar to b0+a0sb_0 + a_0 s. For ss near +∞+\infty, g(s)g(s) is close to b1+a1sb_1 + a_1 s. Thus the dynamics transition between two different linear models, with the smoothness of the transition depending on the shape of τ\tau.

7.2Markov Processes

All of the examples in Section 7.1.2 are special cases of a general class of process called Markov processes. Markov processes are very rewarding to study because the concepts are broad enough to include a vast array of different stochastic processes, while at the same time having enough structure to support elegant and powerful theory. Here we cover the foundations, from definitions and basic properties to stability and asymptotics.

7.2.1The Markov Assumption

Let SS be a subset of RK\RR^K and let B(S)\bB(S) be the Borel subsets of SS. The fundamental primitive of a discrete time Markov process on SS is a stochastic kernel or transition probability function, which is a function Q ⁣:S×B(S)→[0,1]Q \colon S \times \bB(S) \to [0, 1] such that

  1. Q(s,⋅)Q(\bolds, \cdot) is a probability measure over B(S)\bB(S) for all s∈S\bolds \in S and

  2. g(s):=Q(s,B)g(\bolds) := Q(\bolds, B) is B\bB-measurable for each B∈B(S)B \in \bB(S).

SS is called the state space of the model. Part (ii) is a mild regularity condition that ensures certain integrals are well defined. Part (i) is the major defining characteristic, yielding a distribution supported on SS for every point s\bolds in SS. We think of QQ and some initial distribution P0P_0 as generating a corresponding Markov process {xt}\{\boldx_t\} taking values in SS via

The value Q(s,B)Q(\bolds, B) is then the probability that xt+1\boldx_{t+1} lands in BB given xt=s\boldx_t = \bolds. The sequence {xt}\{\boldx_t\} so generated is also called a sample path for QQ.

There is a measure-theoretic procedure for building this process {xt}\{\boldx_t\} more formally but the construction is usually unnecessary because most Markov processes are introduced via a stochastic difference equation, which specifies both the process {xt}\{\boldx_t\} and, implicitly, the associated stochastic kernel QQ. The canonical stochastic difference equation for a first-order Markov process takes the form

xt+1=G(xt,wt+1)withL(x0)=P0\boldx_{t+1} = G(\boldx_t, \boldw_{t+1}) \quad \text{with} \quad \lL(\boldx_0) = P_0

Here {wt}t⩾1\{\boldw_t\}_{t \geq 1} is an IID sequence of RM\RR^M-valued shocks with common distribution Ψ\Psi and GG is a given B\bB-measurable function mapping the current state xt∈S\boldx_t \in S and shock wt+1∈RM\boldw_{t+1} \in \RR^M into the new state xt+1∈S\boldx_{t+1} \in S. The initial condition x0\boldx_0 and the shocks {wt}t⩾1\{\boldw_t\}_{t \geq 1} are also assumed to be independent of each other. The corresponding stochastic kernel is

Q(s,B)=P{G(s,wt+1)∈B}(s∈S,  B∈B(S))Q(\bolds, B) = \PP\{G(\bolds, \boldw_{t+1}) \in B\} \qquad (\bolds \in S, \; B \in \bB(S))

The choice of date t+1t+1 is irrelevant here because of the IID assumption, and is used only to tie in with (7.7). Recalling that Ψ\Psi is the distribution of wt+1\boldw_{t+1}, the stochastic kernel can also be written as

Q(s,B)=Ψ{w∈RM  :  G(s,w)∈B}Q(\bolds, B) = \Psi \left\{\boldw \in \RR^M \; : \; G(\bolds, \boldw) \in B \right\}

This expression makes it clear that QQ is defined by the two primitives GG and Ψ\Psi.

Returning to the general process (7.7), repeated substitution gives

x1=G(x0,w1)x2=G(G(x0,w1),w2)x3=G(G(G(x0,w1),w2),w3)\begin{aligned} \boldx_1 & = G(\boldx_0, \boldw_1) \\ \boldx_2 & = G(G(\boldx_0, \boldw_1), \boldw_2) \\ \boldx_3 & = G(G(G(\boldx_0, \boldw_1), \boldw_2),\boldw_3) \end{aligned}

and so on. Continuing in this fashion, we see that the state vector xt\boldx_t can be written as a function of x0\boldx_0 and the shocks w1,…,wt\boldw_1,\ldots,\boldw_t for any tt. In other words, for each tt, there exists a function HtH_t such that

xt=Ht(x0,w1,w2,…,wt)\boldx_t = H_t(\boldx_0, \boldw_1, \boldw_2,\ldots, \boldw_t)

Often there is no neat expression for the function HtH_t. Nonetheless, (7.8) clarifies the fact that (7.7) pins down each xt\boldx_t as a well-defined random vector, depending on the initial condition and the shocks up until date tt. Since xt\boldx_t is a function of x0,w1,w2,…,wt\boldx_0, \boldw_1, \boldw_2,\ldots, \boldw_t, and these random vectors are all, by the IID assumption, independent of wt+k\boldw_{t+k} for any k⩾1k \geq 1, fact 5.1.10 tells us that the current state xt\boldx_t and future shocks are independent. Let’s record this:

Although it’s rarely made explicit, behind all the random vectors {xt}\{\boldx_t\} lies a single probability space (Ω,F,P)(\Omega, \fF, \PP). The idea is that an element ω\omega of Ω\Omega is selected by “nature” at the start of time. This determines the initial condition x0\boldx_0 and the shocks wt\boldw_t as

x0(ω),w1(ω),w2(ω),w3(ω),…\boldx_0(\omega), \boldw_1(\omega), \boldw_2(\omega), \boldw_3(\omega),\ldots

From these, each state vector xt\boldx_t is determined via

xt(ω)=Ht(x0(ω),w1(ω),w2(ω),…,wt(ω))\boldx_t(\omega) = H_t(\boldx_0(\omega), \boldw_1(\omega), \boldw_2(\omega),\ldots, \boldw_t(\omega))

where HtH_t is the function in (7.8).

7.2.1.1The Density Case

If Q(s,⋅)Q(\bolds, \cdot) is absolutely continuous for all s\bolds, then we can define the corresponding stochastic density kernel or the transition density via

q(s,⋅):= the density of Q(s,⋅) for all s∈Sq(\bolds, \cdot) := \text{ the density of } Q(\bolds, \cdot) \text{ for all } \bolds \in S

In other words, q(s,⋅)q(\bolds, \cdot) is the conditional density of xt+1\boldx_{t+1} given xt=s\boldx_t = \bolds. Heuristically, q(s,s′) ⁣ds′q(\bolds, \bolds') \diff \bolds' is the probability of transitioning from s\bolds to s′\bolds' in one step.

A visualization of the ARCH kernel (7.11) is given in figure 7.4 when α0=0.5\alpha_0 = 0.5 and α1=0.8\alpha_1 = 0.8. The diagonal line is the 45 degree line. Each vertical fiber of the graph corresponds to one density s′↦q(s,s′)s' \mapsto q(s, s'). For large ss (to the right on the horizontal axis), the corresponding density puts most mass below the 45 degree line, indicating a tendency to decrease. Conversely, when −s-s is large, the process tends to increase.

Transition density q(s, s') for the ARCH kernel

Figure 7.4:Transition density q(s,s′)q(s, s') for the ARCH kernel (7.11)

7.2.2Marginal and Joint Distributions

Let’s note some features of the marginal and joint distributions of a Markov process. Consider our generic process xt+1=G(xt,wt+1)\boldx_{t+1} = G(\boldx_t, \boldw_{t+1}) from (7.7), where L(x0)=P0\lL(\boldx_0) = P_0 and {wt}\{\boldw_t\} is IID on RM\RR^M with common distribution Ψ\Psi. The marginal distribution of the state vector is just L(xt)\lL(\boldx_t). Since xt\boldx_t is a well-defined random vector (see in particular (7.8)), L(xt)\lL(\boldx_t) is also well-defined, and we denote it in what follows by PtP_t. That is,

Pt(B)=P{xt∈B}(B∈B(S))P_t(B) = \PP\{\boldx_t \in B\} \qquad (B \in \bB(S))

Figure 7.5 shows a visualization of this sequence when μ0=0\mu_0=0, σ0=b=c=1\sigma_0 = b = c =1 and a=0.8a = 0.8. In fact we don’t actually need to recompute the sums in the definition of μt\mu_t and σt2\sigma_t^2 at each step because these sequences satisfy the recursions

μt+1=b+aμtandσt+12=a2σt2+c2\mu_{t+1} = b + a \mu_t \quad \text{and} \quad \sigma_{t+1}^2 = a^2 \sigma_t^2 + c^2

You can verify this by taking expectations and variances on both side of (7.3).

Sequence of marginal densities for the Gaussian AR(1) process

Figure 7.5:Sequence of marginal densities for the Gaussian AR(1) process

For a general Markov process, tracking evolution of the first two moments is usually more complicated, and even then fails to provide full information on the distributions. We do, however, have the following general result:

Exercise 7.6.4 asks you to prove this. Fact 7.2.2 is a version of the law of total probability . To calculate the probability of reaching BB next period, we sum the probability of that event given outcome s\bolds today, weighted by the probability that s\bolds occurs today. Here’s a parallel result for the density case.

Let’s now look at joint distributions. We’ll cover these only in the density case, which is the most important case in econometrics.

This result can be obtained in a few different ways. One is to repeatedly apply (5.27) to factor the joint density into

pT(s0,…,sT)=p0(s0)∏t=0T−1p(st+1 ∣ st,…,s0)p_T(\bolds_0, \ldots, \bolds_T) = p_0(\bolds_0) \prod_{t=0}^{T-1} p(\bolds_{t+1} \given \bolds_t, \ldots, \bolds_0)

This is the expression for the joint density of a general stochastic process, where the current state depends on lagged states of all orders. With the first-order Markov property, an expression like p(st+1 ∣ st,…,s0)p(\bolds_{t+1} \given \bolds_t, \ldots, \bolds_0) reduces to p(st+1 ∣ st)p(\bolds_{t+1} \given \bolds_t), which is just q(st,st+1)q(\bolds_t, \bolds_{t+1}).

7.2.3Stationarity of Markov Processes

Consider the notion of stationarity introduced in Section 7.1.1. Not every Markov process is stationary. As stated above, a necessary condition is that the marginals are constant, and in figure 7.5 we saw an example of how the marginals {Pt}\{P_t\} can change over time. Figure 7.6 shows the same sequence but now longer, with identical parameters. Probability mass moves from left to right.

Convergence of marginal densities, Gaussian AR(1) case

Figure 7.6:Convergence of marginal densities, Gaussian AR(1) case

While {Pt}\{P_t\} is not typically constant, for the particular sequence shown in figure 7.6, the difference between successive distributions is diminishing over time. We can see this analytically as well by recalling that Pt=N(μt,σt2)P_t = \nN(\mu_t, \sigma^2_t), where μt\mu_t and σt2\sigma^2_t are as given in (7.14). Provided that ∣a∣<1|a| < 1, these sequences converge, with

μt→μ∞:=b1−aandσt2→σ∞2:=c21−a2\mu_t \to \mu_{\infty} := \frac{b}{1 - a} \quad \text{and} \quad \sigma^2_t \to \sigma^2_{\infty} := \frac{c^2}{1 - a^2}

Let P∞P_\infty denote the distribution associated with these limits. That is,

P∞=N(μ∞,σ∞2)=N[b1−a,c21−a2]P_\infty = \nN(\mu_\infty, \sigma_\infty^2) = \nN \left[ \frac{b}{1 - a}, \frac{c^2}{1 - a^2} \right]

What happens if we actually attain this limiting distribution, or if we take our initial draw x0x_0 from this distribution? On an intuitive level, it seems that the distribution sequence will be constant, remaining at P∞P_\infty over time. Indeed this is the case, as exercise 7.6.1 asks you to confirm.

The limiting distribution is an example of what is called a stationary distribution. More generally, a stationary distribution for a Markov process on SS with stochastic kernel QQ is any distribution P∞P_\infty on SS satisfying

P∞(B)=∫Q(s,B)P∞( ⁣ds)for all B∈B(S)P_\infty(B) = \int Q(\bolds, B) P_\infty(\diff \bolds) \qquad \text{for all } B \in \bB(S)

Comparing with the recursion Pt+1(B)=∫Q(s,B)Pt( ⁣ds)P_{t+1}(B) = \int Q(\bolds, B) P_t(\diff \bolds) from fact 7.2.2, we see that the definition of stationarity of P∞P_\infty means precisely that

L(xt)=P∞    ⟹    L(xt+1)=P∞\lL(\boldx_t) = P_\infty \; \implies \; \lL(\boldx_{t+1}) = P_\infty

From this we see that any process starting at P∞P_\infty will be identically distributed. In fact it is stationary, in the sense that (7.1) holds. Let’s record this:

Moments of the stationary distribution are called the stationary moments of the Markov process. Other names for the stationary distribution include the "invariant" or "unconditional" distribution, and the moments are then called the invariant or unconditional moments.

Such a density is called a stationary density.

7.2.3.1Existence

Not every Markov process has a stationary distribution. For example, in the linear scalar AR(1) model xt+1=b+axt+cwt+1x_{t+1} = b + a x_t + c w_{t+1}, we know that the marginal variance evolves according to σt+12=a2σt2+c2\sigma^2_{t+1} = a^2 \sigma_t^2 + c^2. If ∣a∣⩾1|a| \geq 1, then this sequence diverges. Because the variance is not constant, the distribution sequence cannot be constant either.

Let’s state one sufficient condition for existence. The condition we give slightly specializes a famous result known as the Krylov–Bogolyubov theorem. It uses the notion of a coercive function, which is any nonnegative function VV on the state space SS such that

Cγ:={s∈S:V(s)⩽γ}C_\gamma := \setntn{\bolds \in S}{V(\bolds) \leq \gamma}

is a compact subset of SS for all γ∈R\gamma \in \RR. Intuitively, coercive functions are functions that go to +∞+\infty as we move "away from the center" of the state space.

Now we can state the following:

See §11.2 of Stachurski (2009) for proofs and references. Condition (7.20) is an example of a drift condition. One way to understand it is to write it as

E V[G(s,wt+1)]V(s)⩽λ+LV(s)\frac{\EE V[ G(\bolds, \boldw_{t+1} ) ] }{V(\bolds)} \leq \lambda + \frac{L}{V(\bolds) }

As we move "away from the center" of the state space, V(s)V(\bolds) becomes large, and the term on the right is eventually <1< 1. Looking at the left hand side, this tells us that the value attached to the state by VV is expected to decrease, which in turn suggests movement away from the "edges" of the state space and back towards the center.

7.2.4Asymptotics of Markov Processes

When do Markov processes exhibit nice properties such as ergodicity? To gain some intuition, let’s first consider the process xt+1=axt+wt+1x_{t+1} = a x_t + w_{t+1}, where {wt}\{w_t\} is IID N(0,1)\nN(0, 1) and ∣a∣<1|a| < 1. We consider a stationary process, where each xtx_t has marginal

P∞:=N(0, (1−a2)−1)P_{\infty} := \nN \left( 0, \, (1- a^2)^{-1} \right)

A law of large numbers for this process takes the form

xˉT→p∫s P∞( ⁣ds)=0asT→∞\bar x_T \toprob \int s\, P_{\infty}(\diff s) = 0 \quad \text{as} \quad T \to \infty

Fact 6.1.2 tells us that for (7.23) to hold it suffices that

E xˉT→0andvar⁡xˉT→0asT→∞\EE \bar x_T \to 0 \quad \text{and} \quad \var \bar x_T \to 0 \quad \text{as} \quad T \to \infty

The first part is obvious, since E xˉT=1T∑t=1TE xt\EE \bar x_T = \frac{1}{T} \sum_{t=1}^T \EE x_t and E xt=0\EE x_t = 0. For the second part, since E xˉT=0\EE \bar x_T = 0,

var⁡[1T∑t=1Txt]=E [1T∑t=1Txt]2=1T2∑n=1T∑m=1TE [xnxm]\var \left[ \frac{1}{T} \sum_{t=1}^T x_t \right] = \EE \left[ \frac{1}{T} \sum_{t=1}^T x_t \right]^2 = \frac{1}{T^2} \sum_{n=1}^T \sum_{m=1}^T \EE[x_n x_m]

Using E [xnxm]=E [xmxn]\EE[x_n x_m] = \EE[x_m x_n] we obtain the bound

var⁡xˉT⩽2T2∑1⩽n⩽m⩽TE [xnxm]=2T2∑j=0T−1∑t=1T−jE [xt+jxt]\var \bar x_T \leq \frac{2}{T^2} \sum_{1 \leq n \leq m \leq T} \EE[x_n x_m] = \frac{2}{T^2} \sum_{j=0}^{T-1} \sum_{t=1}^{T-j} \EE[x_{t+j} x_t]

Thus, to obtain var⁡xˉT→0\var \bar x_T \to 0 as T→∞T \to \infty, we require the covariance terms E [xt+jxt]\EE[x_{t+j} x_t] to converge to zero in jj sufficiently quickly. That they do in this particular instance is the subject of exercise 7.6.3.

To summarize, if correlations die out sufficiently quickly, then we can regain the LLN. The same is true for the CLT when second moment conditions hold. We now state a much more general result for sample paths of Markov processes. The proofs are omitted but the essential ideas are the same.

Conditions (a) and (b) are not dissimilar to the conditions for existence in theorem 7.2.1. Condition (b) is the drift condition in (7.20) specialized to the density setting. The major difference is that qq is required to be strictly positive. This gives enough mixing to generate uniqueness and the sample path properties. Theorem 7.2.2 can be proved from results in Meyn & Tweedie (2009).[1]

Theorem 7.2.2 is but one of a vast range of results on asymptotic properties of Markov processes. Discussion of alternatives is given in Section 7.5. In fact the conditions are rather strict and can certainly be weakened at the expense of a more complex theorem statement. Nonetheless, they suffice for many applications of interest.

The constant σh2\sigma^2_h in (7.27) is given by the expression

σh2:=var⁡h(x0)+2∑t=1∞cov⁡[h(x0),h(xt)]\sigma^2_h := \var h(\boldx_0) + 2 \sum_{t=1}^{\infty} \cov [h(\boldx_0), h(\boldx_t)]

with the understanding that {xt}\{\boldx_t\} is a stationary process. If σh2=0\sigma^2_h = 0, then the limiting distribution is degenerate.

To see why, recall from (7.13) that the transition density satisfies q(s,s′)=ψ(s′−g(s))q(\bolds, \bolds' ) = \psi(\bolds' - g(\bolds)). Since ψ\psi is assumed continuous and positive on RK\RR^K, the transition density has these properties on RK×RK\RR^K \times \RR^K. Hence condition (a) in theorem 7.2.2 is satisfied. Condition (b) is also satisfied because, taking λ\lambda and LL as in (7.29), we have

∫∥s′∥q(s,s′) ⁣ds′=E ∥g(s)+wt+1∥⩽λ∥s∥+L+∫∥w∥ψ(w) ⁣dw\int \|\bolds'\| q(\bolds, \bolds' ) \diff \bolds' = \EE \|g(\bolds) + \boldw_{t+1} \| \leq \lambda \| \bolds \| + L + \int \|\boldw\| \psi(\boldw) \diff \boldw

For most Markov processes the stationary density has no known closed-form. However, in the case of example 7.2.11, the stationary density is known to have the form p∞(s)=2ϕ(s)Φ(qs)p_{\infty}(s) = 2 \phi(s) \Phi(q s), where q:=a(1−a2)−1/2q := a (1 - a^2)^{-1/2}, ϕ\phi is the standard normal density and Φ\Phi is the standard normal CDF.

7.2.5The Linear Case

Recall the VAR process in (7.4), which, to repeat, takes the form

xt+1=b+Axt+Cwt+1\boldx_{t+1} = \boldb + \boldA \boldx_t + \boldC \boldw_{t+1}

where {wt}\{ \boldw_t \} is assumed to be IID and to satisfy E wt=0\EE \boldw_t = \boldzero and E [wtwt′]=I\EE[\boldw_t\boldw_t'] = \boldI. Regarding the asymptotics of this process, if the shock vector has a continuous and positive density, then we can apply fact 7.2.7 to obtain asymptotic stability and LLN and CLT results whenever the matrix norm of A\boldA satisfies ∥A∥<1\|\boldA \| < 1. To see this, let g(s)=b+Asg(\bolds) = \boldb + \boldA \bolds. By the norm triangle inequality and the definition of the matrix norm, we have

∥g(s)∥=∥b+As∥⩽∥b∥+∥As∥⩽∥b∥+∥A∥∥s∥\|g(\bolds)\| = \| \boldb + \boldA \bolds\| \leq \| \boldb \| + \| \boldA \bolds\| \leq \| \boldb \| + \| \boldA \| \| \bolds\|

Hence (7.29) holds.

As mentioned above, the stability and sample path conditions considered above are relatively strict. In the linear case, we can certainly do better. Here’s one such result:

Here ϱ(A)\rho(\boldA) is the spectral radius of A\boldA, as defined. Under this condition, a unique stationary distribution exists. Taking expectations across (7.30), we see that its mean μ∞\boldmu_{\infty} must satisfy μ∞=b+Aμ∞\boldmu_{\infty} = \boldb + \boldA \boldmu_{\infty}. Applying the Neumann series lemma, this equation has the unique solution

μ∞=(I−A)−1b=∑i=0∞Aib\boldmu_\infty = (\boldI - \boldA)^{-1} \boldb = \sum_{i=0}^{\infty} \boldA^i \boldb

Let Σ∞\boldSigma_\infty be the asymptotic variance (i.e., the variance–covariance matrix of the stationary distribution). From (7.30) it must satisfy

Σ∞=AΣ∞A⊺+CC⊺\boldSigma_\infty = \boldA \boldSigma_\infty \boldA^\T + \boldC \boldC^\T

This is an example of a discrete time Lyapunov equation. Under the condition ϱ(A)<1\rho(\boldA) < 1 it can be solved by iteration or by using existing numerical solvers. Here’s an example in Julia that uses a solver from the QuantEcon package:

using QuantEcon

A = [0.8 -0.2; 
    -0.1 0.7]
C = [0.5 0.4;
     0.4 0.6]

solve_discrete_lyapunov(A, C * C')

7.3Martingales

Martingales generalize the notion of a random walk, where increments to the current state are draws from a white noise process. The concept of martingales has been central to many advances in probability since the mid twentieth century. Econometricians also like martingales because they neatly capture the idea of "unpredictable" change.

7.3.1Definitions

To define martingales, we need the notion of a filtration, which is an increasing sequence of information sets. Recall from Section 5.2.4 that an information set is just a set of random variables. Let {Ft}\{\fF_t\} be a sequence of information sets. That is, Ft\fF_t is an information set for each tt. The sequence {Ft}\{\fF_t\} is called a filtration if, in addition, Ft⊂Ft+1\fF_t \subset \fF_{t+1} for all tt. Intuitively, expanding information sets reflect the idea that more information is revealed over time.

Now let {mt}\{m_t\} be a scalar stochastic process and let {Ft}\{\fF_t\} be a filtration. We say that {mt}\{m_t\} is adapted to {Ft}\{\fF_t\} if mtm_t is Ft\fF_t-measurable for every tt. (For the definition of measurability, see Section 5.2.4.)

The intuitive meaning is this: Ft\fF_t represents the variables we know as of time tt. If {mt}\{m_t\} is adapted to Ft\fF_t, then we can compute mtm_t at time tt as well.

The proof goes like this: By adaptedness, mtm_t is Ft\fF_t-measurable. From the definition of a filtration we have Ft⊂Ft+j\fF_t \subset \fF_{t+j}. Applying fact 5.2.10, it follows that mtm_t is Ft+j\fF_{t+j}-measurable. Fact 7.3.1 now follows from fact 5.2.13.

A sequence of integrable random variables {mt}\{m_t\} adapted to a filtration {Ft}\{\fF_t\} is called a martingale with respect to {Ft}\{\fF_t\} if

E [mt+1 ∣ Ft]=mtfor allt\EE [ m_{t+1} \given \fF_t] = m_t \quad \text{for all} \quad t

The expression E [mt+1 ∣ Ft]\EE [ m_{t+1} \given \fF_t] is sometimes simplified to E t[mt+1]\EE_t [ m_{t+1}] when the filtration is understood.

7.3.1.1Martingale Difference Sequences

A stochastic process {dt}\{d_t\} is called a martingale difference sequence (or MDS) with respect to some filtration {Ft}\{\fF_t\} if

E [dt+1 ∣ Ft]=0for allt\EE [ d_{t+1} \given \fF_t] = 0 \quad \text{for all} \quad t

An MDS is so named because if {mt}\{m_t\} is a martingale with respect to {Ft}\{\fF_t\}, then dt=mt−mt−1d_t = m_t - m_{t-1} is an MDS with respect to {Ft}\{\fF_t\}. See exercise 7.6.7.

Indeed, by the law of iterated expectations, E dt=E [E [dt ∣ Ft−1]]=E 0=0\EE d_t = \EE[ \EE[ d_t \given \fF_{t-1} ]] = \EE 0 = 0.

7.3.2Martingale Difference LLN and CLT

Next we consider asymptotics for martingale difference sequences. Such sequences are good candidates for the LLN and CLT. To see this, recall that integrable IID sequences always satisfy the LLN. With finite second moment they also satisfy the CLT. Suppose now that {mt}\{m_t\} is a stationary MDS with respect to some filtration {Ft}\{\fF_t\}. We don’t have independence in this case but we do have the following:

To see this, fix t⩾0t \geq 0 and j⩾1j \geq 1. We have

cov⁡[mt+j,mt]=E [mt+jmt]=E [E [mt+jmt ∣ Ft+j−1]]\cov[m_{t+j}, m_t] = \EE[m_{t+j} m_t] = \EE[ \EE[ m_{t+j} m_t \given \fF_{t+j-1}]]

Since t+j−1⩾tt + j - 1 \geq t and {Ft}\{\fF_t\} is a filtration, we know that mtm_t is Ft+j−1\fF_{t+j-1}-measurable. Hence

E [E [mt+jmt ∣ Ft+j−1]]=E [mtE [mt+j ∣ Ft+j−1]]=E [mt⋅0]=0\EE[ \EE[ m_{t+j} m_t \given \fF_{t+j-1}]] = \EE[ m_t \EE[ m_{t+j} \given \fF_{t+j-1}]] = \EE[ m_t \cdot 0 ] = 0

The lack of correlation in fact 7.3.3 is a key part of the next result.

The proof of (7.32) is identical to that of the classical LLN in theorem 6.1.1. Theorem 7.3.1 can be established from a martingale CLT proved in Durrett (2010).

7.4Simulation

Simulation is invaluable as a tool for exploring statistical concepts and solving applied problems. For example, the current popularity of Bayesian methods for econometrics and machine learning has been driven to a large extent by clever simulation algorithms that have proved successful at solving hard estimation problems.

Modern scientific programming environments all have good routines for simulating independent observations from a range of common named distributions. We’ve seen examples of this in the displayed computer code. But it’s easy to run into situations where the distribution we are working with is nonstandard, or has no closed-form solution. We then need to roll our own routines for producing random variates. Let’s review two of the most important algorithms.

7.4.1Inverse Transforms

Suppose that we wish to draw from a distribution on R\RR with CDF FF. Assuming that we can generate uniform random variables, we can do so via the inverse transform method:

We wish to show that this technique is valid, or, equivalently, that

L(u)=U[0,1]  ⟹  L[F−1(u)]=F\lL(u) = U[0, 1] \quad \implies \quad \lL[F^{-1}(u)] = F

In the proof we’ll assume that FF is strictly increasing. (This isn’t necessary, but the proof of the general case provides no additional intuition.) Let L(u)=U[0,1]\lL(u) = U[0, 1] and let z:=F−1(u)z := F^{-1}(u). To see that L(z)=F\lL(z) = F, observe that, by strict monotonicity, F(a)⩽F(b)F(a) \leq F(b) if and only if a⩽ba \leq b. As a result, for any s∈Rs \in \RR,

P{z⩽s}=P{F−1(u)⩽s}=P{u⩽F(s)}\PP\{z \leq s\} = \PP\{F^{-1}(u) \leq s\} = \PP\{u \leq F(s)\}

The defining property of a U[0,1]U[0, 1] random variable uu is that P{u⩽t}=t\PP\{u \leq t\} = t whenever 0⩽t⩽10 \leq t \leq 1. Using this fact in the preceding calculation gives P{z⩽s}=F(s)\PP\{z \leq s\} = F(s), proving (7.34).

Here’s one extension for the basic inverse transform method. Suppose that we want to simulate from a joint distribution on RN\RR^N that is defined in terms of a copula (see Section 5.1.5). In particular, suppose that FnF_n is a continuous CDF on R\RR for n=1,…,Nn=1,\ldots, N, that CC is a copula on RN\RR^N and that the joint distribution of interest is

F(s1,…,sN)=C(F1(s1),…,FN(sN))F(s_1, \ldots, s_N) = C(F_1(s_1), \ldots, F_N(s_N))

(This is just (5.22).) If we can simulate from CC, then we can simulate from FF. The method is

Exercise 7.6.13 asks you to prove that (x1,…,xN)(x_1, \ldots, x_N) is a draw from FF.

7.4.2Markov Chain Monte Carlo

Markov chain Monte Carlo (MCMC) is a way of simulating from a given density π\pi on S⊂RKS \subset \RR^K. The idea is to construct a stochastic kernel PP on SS such that

  1. π\pi is a stationary distribution for PP, and

  2. PP is sufficiently ergodic that its sample path averages converge to expectations under π\pi

See (7.26) for a clearer statement of (ii). If we specialize to indicator functions we can approximate probabilities under π\pi too.

There are two major strands of MCMC algorithms: Metropolis–Hastings and the Gibbs sampler. Here we’ll cover the former. While boldface symbols are omitted in what follows, the ideas are valid in any dimension. In the section on Bayesian estimation in Section 8.3.4, I will explain why Metropolis–Hastings fits so beautifully with Bayesian updating.

The Metropolis–Hastings algorithm starts with a Markov process in the form of a stochastic density kernel q=q(s,s′)q = q(s, s') called the proposal density. Draws from the proposal density are called proposals. Each time we draw a proposal, we either (i) accept it and move to that new state, or (ii) reject it and stay put. The probability of accepting is structured so that the chain tends to stay in regions where π\pi puts most probability mass. As a consequence, for a sequence {xt}\{x_t\} generated by this process, we get

fraction of time spent in B=    1T∑t=1T1 ⁣ ⁣1{xt∈B}≈π(B)for large T\text{fraction of time spent in } B = \;\; \frac{1}{T} \sum_{t=1}^T \1\{x_t \in B\} \approx \pi(B) \quad \text{for large } T

This is a version of (7.26) with h=1 ⁣ ⁣1Bh = \1_B.

The ideas are subtle, so let’s build up in steps. Consider first a general accept-reject style process of the kind discussed above, where the probability of acceptance is determined by an arbitrary function α=α(xt,y)\alpha = \alpha(x_t, y) of the current state xtx_t and proposal yy. The function takes values in [0,1][0, 1]. The algorithm for generating xt+1x_{t+1} from xtx_t given α\alpha and proposal density qq is given in algorithm 1.

The stochastic kernel PP associated with {xt}\{x_t\} in algorithm 1 has the form

P(s,B)=∫Bp(s,s′) ⁣ds′+(1−λ(s))1 ⁣ ⁣1{s∈B}P(s, B) = \int_B p(s, s') \diff s' + (1 - \lambda(s)) \1\{s \in B\}

for all s∈Ss \in S and B∈B(S)B \in \bB(S), where

p(s,s′):=q(s,s′)α(s,s′)andλ(s):=∫p(s,s′) ⁣ds′p(s, s') := q(s, s') \alpha(s, s') \quad \text{and} \quad \lambda(s) := \int p(s, s') \diff s'

To show this, we can break the probabilities up as follows. Fix any Borel set BB and let xtx_t be given at ss. Let xt+1x_{t+1} be drawn according to algorithm 1 when xt=sx_t = s. By additivity of P\PP we can write P{xt+1∈B}\PP\{x_{t+1} \in B\} as

P{xt+1∈B}∩{u⩽α(s,y)}+P{xt+1∈B}∩{u>α(s,y)}\PP\{x_{t+1} \in B\} \cap \{u \leq \alpha(s, y)\} + \PP\{x_{t+1} \in B\} \cap \{u > \alpha(s, y)\}

Our aim is to show that the two terms in (7.36) match the two terms on the right-hand side of (7.35).

Using the fact that intersections become products when we switch to indicators (fact 4.1.4, page ), we can applying the law of iterated expectations to obtain

P{xt+1∈B}∩{u⩽α(s,y)}=P{y∈B}∩{u⩽α(s,y)}=E [1 ⁣ ⁣1{y∈B}1 ⁣ ⁣1{u⩽α(s,y)}]=E {E [1 ⁣ ⁣1{y∈B}1 ⁣ ⁣1{u⩽α(s,y)} ∣ y]}=E {1 ⁣ ⁣1{y∈B}E [1 ⁣ ⁣1{u⩽α(s,y)} ∣ y]}\begin{aligned} \PP\{x_{t+1} \in B\} \cap \{u \leq \alpha(s, y)\} & = \PP\{y \in B\} \cap \{u \leq \alpha(s, y)\} \\ & = \EE \left[ \1\{y \in B\} \1 \{u \leq \alpha(s, y)\} \right] \\ & = \EE \left\{ \EE \left[ \1\{y \in B\} \1 \{u \leq \alpha(s, y)\} \given y \right] \right\} \\ & = \EE \left\{ \1\{y \in B\} \EE \left[ \1 \{u \leq \alpha(s, y)\} \given y \right] \right\} \end{aligned}

The term E [1 ⁣ ⁣1{u⩽α(s,y)} ∣ y]\EE \left[ \1 \{u \leq \alpha(s, y)\} \given y \right] is just P{u⩽α(s,y)}\PP\{u \leq \alpha(s, y)\} with yy given, which, since uu is uniform, evaluates to α(s,y)\alpha(s, y). Hence the final expression in the last display evaluates to

∫1 ⁣ ⁣1{s′∈B}α(s,s′)q(s,s′) ⁣ds′=∫Bα(s,s′)q(s,s′) ⁣ds′\int \1\{s' \in B\} \alpha(s, s') q(s, s') \diff s' = \int_B \alpha(s, s') q(s, s') \diff s'
∴P{xt+1∈B}∩{u⩽α(s,y)}=∫Bp(s,s′) ⁣ds′\fore \PP\{x_{t+1} \in B\} \cap \{u \leq \alpha(s, y)\} = \int_B p(s, s') \diff s'

Equation (7.37) says that the first term in (7.36) is equal to the first term on the right-hand side of (7.35). For the second terms, note that xt+1=xt=sx_{t+1} = x_t = s when u>α(s,y)u > \alpha(s, y), so

P{xt+1∈B}∩{u>α(s,y)}=E [1 ⁣ ⁣1{s∈B}1 ⁣ ⁣1{u>α(s,y)}]=1 ⁣ ⁣1{s∈B}E [1 ⁣ ⁣1{u>α(s,y)}]=1 ⁣ ⁣1{s∈B}[1−P{u⩽α(s,y)}]\begin{aligned} \PP \{x_{t+1} \in B\} \cap \{u > \alpha(s, y)\} & = \EE \left[ \1 \{s \in B\} \1\{u > \alpha(s, y)\} \right] \\ & = \1\{s \in B\} \EE [ \1 \{u > \alpha(s, y)\} ] \\ & = \1\{s \in B\} [1 - \PP \{u \leq \alpha(s, y)\} ] \end{aligned}

To match this expression with the second term in (7.35), we just need to show that P{u⩽α(s,y)}=∫p(s,s′) ⁣ds′\PP \{u \leq \alpha(s, y)\} = \int p(s, s') \diff s'. But this is immediate from (7.37) if we take B=SB = S.

So far we have verified that the kernel PP in (7.35) is the stochastic kernel corresponding to algorithm 1. Now let’s double back and design the selection function α\alpha so that the stationary distribution of PP is the target density π\pi. In the Metropolis–Hastings algorithm, this is done by setting

α(s,s′):=min⁡{π(s′)q(s′,s)π(s)q(s,s′),1}\alpha(s, s') := \min \left\{ \frac{\pi(s') q(s', s)}{\pi(s) q(s,s')} , 1 \right\}

If π(s)q(s,s′)=0\pi(s) q(s,s') = 0, then α(s,s′):=1\alpha(s, s') := 1. The min is in place so α(s,s′)\alpha(s, s') can be interpreted as a probability. We don’t actually need to impose it in algorithm 1, since for u∈[0,1]u \in [0, 1] we have u⩽min⁡{a,1}u \leq \min\{a, 1\} iff u⩽au \leq a. The important element is the ratio inside the min, which is large when the new proposal s′s' has high probability under π\pi relative to the current location ss and small when the reverse is true. This keeps the chain in regions where π\pi has high mass, and leads to our next result.

It remains to establish that PP has the kind of stability properties discussed in theorem 7.2.2 (and in particular the LLN result in (7.26) of that theorem). This isn’t universally true, and requires at least some conditions on the primitives qq and π\pi. One well-known result is given in corollary 3 of Tierney (1994) for the case where qq and π\pi are continuous and strictly positive on SS and SS itself is compact. In essence, the continuity and positivity corresponds to condition (a) of theorem 7.2.2, while the compactness of SS is a strict version of the drift condition in (b) of the same theorem.[3] For further results and references, see Roberts et al. (2004).

One disadvantage of MCMC methods is that the variates they generate are not in general independent. Sample averages from dependent samples are typically less informative than IID samples. (See example 7.1.4 for the extreme case.) It is desirable, then, that dependence between xtx_t and xt+kx_{t+k} dies out quickly as kk increases. Whether it does or not is determined by the choice of qq. Extensive discussion of such issues can be found in Brooks et al. (2011).

A function implementing the Metropolis–Hastings algorithm in Julia with a random walk proposal density is given in listing 4. The proposal density takes the form q(s,s′)=ψ(s′−s)q(s, s') = \psi(s' - s), where ψ\psi is a given density. This is the system (7.12)–(7.13) with gg set to the identity. If ψ\psi is symmetric, then q(s,s′)=q(s′,s)q(s, s') = q(s', s), and α(s,s′)\alpha(s, s') simplifies to min⁡{π(s′)/π(s),1}\min \{ \pi(s')/ \pi(s) , 1 \} if π(s)>0\pi(s) > 0 and 11 otherwise. This is the case shown in listing 4, with ψ\psi set to the N(0,σ2)\nN(0, \sigma^2) distribution. Look up Julia’s ternary operator if you find it hard to follow the code.

function rw_metropolis(pi_density, T, init=0, sigma=1)
    xvec = Vector{Float64}(undef, T)
    xvec[1] = init
    for t in 1:(T - 1)
        x = xvec[t]
        y = x + sigma * randn()
        alpha = pi_density(x) > 0 ? pi_density(y) / pi_density(x) : 1 
        xvec[t+1] = rand() < alpha  ? y : x
    end
    return xvec
end

Listing 4:The random walk Metropolis–Hastings algorithm (Julia)

Figure 7.7 shows a histogram of 10610^6 draws generated from this algorithm when π\pi is the beta distribution with parameters (2,5)(2, 5). The black line is the target density. This is just a toy example, since routines for sampling from beta distributions are readily available.

Observations from the random walk Metropolis–Hastings algorithm

Figure 7.7:Observations from the random walk Metropolis–Hastings algorithm

7.5Further Reading

The modern theory of Markov processes owes much to a brilliant mathematician called Wolfgang Doeblin. His short life and shining contributions to probability theory are discussed in Bru & Yor (2002).

An excellent overview of Markov processes and their stability can be found in Meyn & Tweedie (2009). For more on Markov processes from a density perspective see Lasota & Mackey (1994) or chapter 8 of Stachurski (2009). For a nice survey of sample path properties with a focus on the central limit theorem, see Jones (2004).

Diaconis (2009) provides a fascinating overview of MCMC and its impact on different fields. Richey (2010) is a more general survey. Good references on the theoretical side include Roberts et al. (2004), Tierney (1994), and Geweke (1996). See Kroese & Chan (2014) for a more practical discussion with a focus on applications.

7.6Exercises

7.6.1Solutions to Selected Exercises

Footnotes
  1. The stated results are a consequence of theorem 17.0.1 in Meyn & Tweedie (2009), which in turn requires that the process is VV-uniformly ergodic. In our case, the latter property follows from aperiodicity and irreducibility, which are immediate consequences of strict positivity of qq on S×SS \times S, and from the drift condition (b). In the language of Meyn & Tweedie (2009), the function VV is "unbounded off petite sets." This holds for any coercive function VV when qq is positive and continuous, since compact sets are then petite.

  2. We are assuming that wealth starts at zero and may take arbitrarily large negative values without the gambler getting knee-capped by the mafia.

  3. When SS is compact, every constant nonnegative function on SS is coercive, and if VV is constant then the drift condition in (7.20) is trivial.

  4. Hint: Try converting probabilities into expectations of indicators and using the law of iterated expectations.

References
  1. Stachurski, J. (2009). Economic Dynamics: Theory and Computation. Cambridge: MIT Press.
  2. Meyn, S. P., & Tweedie, R. L. (2009). Markov Chains and Stochastic Stability (2nd ed.). Cambridge, UK: Cambridge University Press.
  3. Hall, R. E. (1978). Stochastic implications of the life cycle-permanent income hypothesis: theory and evidence. Journal of Political Economy, 86(6), 971–987.
  4. Durrett, R. (2010). Probability: Theory and Examples (4th ed.). Cambridge, UK: Cambridge University Press.
  5. Tierney, L. (1994). Markov chains for exploring posterior distributions. The Annals of Statistics, 22(4), 1701–1728.
  6. Roberts, G. O., Rosenthal, J. S., & others. (2004). General state space Markov chains and MCMC algorithms. Probability Surveys, 1, 20–71.
  7. Brooks, S., Gelman, A., Jones, G., & Meng, X.-L. (2011). Handbook of Markov Chain Monte Carlo. Boca Raton: CRC Press.
  8. Bru, B., & Yor, M. (2002). Comments on the life and mathematical legacy of Wolfgang Doeblin. Finance and Stochastics, 6(1), 3–47.
  9. Lasota, A., & Mackey, M. C. (1994). Chaos, Fractals, and Noise: Stochastic Aspects of Dynamics (Vol. 97). New York: Springer.
  10. Jones, G. L. (2004). On the Markov chain central limit theorem. Probability Surveys, 1, 299–320.
  11. Diaconis, P. (2009). The Markov chain Monte Carlo revolution. Bulletin of the American Mathematical Society, 46(2), 179–205.
  12. Richey, M. (2010). The evolution of Markov chain Monte Carlo methods. American Mathematical Monthly, 117(5), 383–413.
  13. Geweke, J. (1996). Monte Carlo simulation and numerical integration. In Z. Griliches, R. F. Engle, & M. D. Intriligator (Eds.), Handbook of Computational Economics (Vol. 1, pp. 731–800). Elsevier.
  14. Kroese, D. P., & Chan, J. C. (2014). Statistical Modeling and Computation. New York: Springer.