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.

3 Markov Dynamics

Authors
Affiliations
New York University
Australian National University

To prepare to analyze dynamic programs, we now study stochastic processes generated by Markov chains. These processes are widely used to construct economic and financial models.

At the end of this chapter we return to the job search problem from Chapter 1 and allow wage draws to be correlated over time (rather than iid). We use a Markov chain to generated serially correlated wage draws.

Throughout this chapter, the symbol X\Xsf represents a finite set.

3.1Foundations

This section describes elementary properties of Markov models.

3.1.1Markov Chains

Let’s start with a definition and some simple examples.

3.1.1.1Defining Markov Chains

Fix X={x1,,xn}\Xsf = \{x_1, \ldots, x_n\} and PM(RX)P \in \mopx. We interpret P(x,x)P(x, x') as the probability that a random process moves from xx to xx' over one unit of time. For this interpretation to make sense we need P(x,x)P(x, x') to be nonnegative and xXP(x,x)\sum_{x' \in \Xsf} P(x, x') to equal one for every xXx \in \Xsf, since we want the chain to stay somewhere in the state space after each update. These are exactly the properties guaranteed by the assumption PM(RX)P \in \mopx (see Exercise 2.58).

To formalize ideas, let (Xt)(Xt)t0(X_t) \coloneq (X_t)_{t \geq 0} be a sequence of random variables taking values in X\Xsf and call (Xt)(X_t) a Markov chain on state space X\Xsf if there exists a PM(RX)P \in \mopx such that

P{Xt+1=xX0,X1,,Xt}=P(Xt,x)for allt0,  xX.\PP \{ X_{t+1} = x' \mid X_0, X_1, \ldots, X_t \} = P(X_t, x') \quad \text{for all} \quad t \geq 0, \; x' \in \Xsf.

To simplify terminology, we also call (Xt)(X_t) PP-Markov when (3.1) holds. We call either X0X_0 or its distribution ψ0\psi_0 the initial condition of (Xt)(X_t), depending on context. PP is also called the transition matrix of the Markov chain.

The definition of a Markov chain says two things:

  1. When updating to Xt+1X_{t+1} from XtX_t, earlier states are not required.

  2. PP encodes all of the information required to perform the update, given the current state XtX_t.

One way to think about Markov chains is algorithmically: Fix PM(RX)P \in \mopx and let ψ0\psi_0 be an element of D(X)\dD(\Xsf). Now generate (Xt)(X_t) via Algorithm 3.1. The resulting sequence is PP-Markov with initial condition ψ0\psi_0.

3.1.1.2Application: S--s Dynamics

As an example, consider a firm whose inventory of some product follows S--s dynamics, meaning that the firm waits until its inventory falls below some level s>0s > 0 and then immediately replenishes by ordering SS units. This pattern of decisions can be rationalized if ordering requires paying a fixed cost. Thus, in Section 5.2.1, we will show that S--s behavior is optimal in a setting where fixed costs exist and the firm’s aim is to maximize its present value.

To represent S--s dynamics, we suppose that a firm’s inventory (Xt)t0(X_t)_{t \geq 0} of a given product obeys

Xt+1=max{XtDt+1,0}+S1{Xts},X_{t+1} = \max\{ X_t - D_{t+1}, 0\} + S \1\{X_t \leq s\},

where

For the distribution ϕ\phi of demand we take the geometric distribution, so that ϕ(d)=P{Dt=d}=p(1p)d\phi(d) = \PP\{D_t = d\} = p (1 - p)^d for dZ+d \in \ZZ_+.

If we define h(x,d)max{xd,0}+S1{xs}h(x, d) \coloneq \max\{ x - d, 0\} + S \1\{x \leq s\}, so that Xt+1=h(Xt,Dt+1)X_{t+1} = h(X_t, D_{t+1}) for all tt, then the transition matrix can be expressed as

P(x,x)=P{h(x,Dt+1)=x}=d01{h(x,d)=x}ϕ(d)((x,x)X×X).P(x, x') = \PP\{h(x, D_{t+1}) = x'\} = \sum_{d \geq 0} \1\{h(x, d) = x'\} \phi(d) \qquad ((x, x') \in \Xsf \times \Xsf).

Listing 1 provides code that simulates inventory paths and computes other objects of interest. Since the state space X={x1,,xn}\Xsf = \{x_1, \ldots, x_n\} corresponds to {0,,S+s}\{0, \ldots, S+s\} and Julia indexing starts at 1, we set xi=i1x_i = i-1. This convention is used when computing P[i, j]{.julia}, which corresponds to P(xi,xj)P(x_i, x_j). The code in the listing is used to produce the simulation of inventories in Figure Figure 3.1.

The function compute_mc{.julia} returns an instance of a MarkovChain{.Julia} object that can store both the state X\Xsf and the transition probabilities. The QuantEcon.jl{.julia} library defines this data type and provides functions that simulate a Markov chains, compute a stationary distribution, and perform related tasks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Distributions, QuantEcon, IterTools

function create_inventory_model(; S=100,  # Order size
                                  s=10,   # Order threshold
                                  p=0.4)  # Demand parameter
    ϕ = Geometric(p)
    h(x, d) = max(x - d, 0) + S * (x <= s)
    return (; S, s, ϕ, h)
end

"Simulate the inventory process."
function sim_inventories(model; ts_length=200)
    (; S, s, ϕ, h) = model
    X = Vector{Int32}(undef, ts_length)
    X[1] = S  # Initial condition
    for t in 1:(ts_length-1)
        X[t+1] = h(X[t], rand(ϕ))
    end
    return X
end

"Compute the transition probabilities and state."
function compute_mc(model; d_max=100)
    (; S, s, ϕ, h) = model
    n = S + s + 1  # Size of state space
    state_vals = collect(0:(S + s))
    P = Matrix{Float64}(undef, n, n)
    for (i, j) in product(1:n, 1:n)
        P[i, j] = sum((h(i-1, d) == j-1) * pdf(ϕ, d) for d in 0:d_max)
    end
    return MarkovChain(P, state_vals)
end

"Compute the stationary distribution of the model."
function compute_stationary_dist(model)
    mc = compute_mc(model)
    return mc.state_values, stationary_distributions(mc)[1]
end

Program 1:An implementation of S--s inventory dynamics (inventory_sim.jl)

Inventory simulation (inventory_sim.jl)

Figure 3.1:Inventory simulation (inventory_sim.jl)

3.1.1.3Higher Order Transition Matrices

Given a finite state space X\Xsf, k0k \geq 0 and PM(RX)P \in \mopx, let PkP^k be the kk-th power of PP. (If k=0k = 0, then PkP^k is the identity matrix.) Since M(RX)\mopx is closed under multiplication (Exercise 2.48), PkP^k is in M(RX)\mopx for all k0k \geq 0. In this context, PkP^k is sometimes called the kk-step transition matrix corresponding to PP. In what follows, Pk(x,x)P^k(x,x') denotes the (x,x)(x,x')-th element of the matrix representation of PkP^k.

The kk-step transition matrix has the following interpretation: If (Xt)(X_t) is PP-Markov, then for any t,kZ+t, k \in \ZZ_+ and x,xXx, x' \in \Xsf,

Pk(x,x)=P{Xt+k=xXt=x}.P^k(x, x') = \PP\{X_{t + k} = x' \given X_t = x\}.

Thus, PkP^k provides the kk-step transition probabilities for the PP-Markov chain (Xt)(X_t).

We can now give the following useful characterization of irreducibility:

Thus, irreducibility of PP means that the PP-Markov chain eventually visits any state from any other state with positive probability.

Several libraries have code for testing irreducibility, including QuantEcon.jl. See Listing 2 for an example of a call to this functionality. In this case, irreducibility fails because state 2 is an absorbing state. Once entered, the probability of ever leaving that state is zero. (A subset Y\Ysf of X\Xsf with this property is called an absorbing set.)

1
2
3
4
5
using QuantEcon
P = [0.1 0.9;
     0.0 1.0]
mc = MarkovChain(P)
print(is_irreducible(mc))

Program 2:Testing irreducibility (is_irreducible.jl)

3.1.2Stationarity and Ergodicity

Next we review aspects of Markov dynamics, including stationarity and ergodicity.

Fix PM(RX)P \in \mopx and let (Xt)(X_t) be PP-Markov. Let ψt\psi_t be the distribution of XtX_t. Marginal distributions ψt\psi_t evolve according to

ψt+1(x)=xP(x,x)ψt(x)for all xX and t0.\psi_{t+1}(x') = \sum_x P(x, x') \psi_t(x) \quad \text{for all } x' \in \Xsf \text{ and } t \geq 0.

To verify (3.9), rewrite it as P{Xt+1=x}=xP{Xt+1=xXt=x}P{Xt=x}\PP \{X_{t+1} = x'\} = \sum_x \PP\{X_{t+1}=x' \,|\, X_t=x\} \PP\{X_t=x\}, which is true by the law of total probability. With each ψt\psi_t regarded as a row vector, (3.9) can also be written as

ψt+1=ψtP.\psi_{t+1} = \psi_t P.

Equation (3.10) tells us that dynamics of marginal distributions for Markov chains are generated by deterministic linear difference equations in distribution space. This is remarkable because the dynamics that drive (Xt)(X_t) are stochastic and can be arbitrarily nonlinear.

Iterating on (3.10), we get ψt=ψ0Pt\psi_t = \psi_0 P^t for all tt. In summary,

(Xt)t0 is P-Markov with X0=dψ0        Xt=dψ0Pt for all t0.(X_t)_{t \geq 0} \text{ is } P \text{-Markov with } X_0 \eqdist \psi_0 \; \implies \; X_t \eqdist \psi_0 P^t \text{ for all } t \geq 0.

For (3.11) and ψt+1=ψtP\psi_{t+1} = \psi_t P to hold, each ψt\psi_t must be a row vector. In what follows, we always treat the distributions (ψt)t0(\psi_t)_{t \geq 0} of (Xt)t0(X_t)_{t \geq 0} as row vectors.

Consistent with our definition of stationary distributions in Section 2.3.1.3, a marginal distribution ψD(X)\psi^* \in \dD(\Xsf) is called stationary for PP if

xP(x,x)ψ(x)=ψ(x)for all xX.\sum_x P(x, x') \psi^*(x) = \psi^*(x') \quad \text{for all } x \in \Xsf.

In vector form, this is ψP=ψ\psi^* P = \psi^*. By this definition and (3.9), if ψ\psi^* is stationary and XtX_t has distribution ψ\psi^*, then so does Xt+kX_{t+k} for all k1k \geq 1.

We saw in Exercise 2.48 that every irreducible PM(RX)P \in \mopx has exactly one stationary distribution in D(X)\dD(\Xsf). The following ergodic property holds under the same assumptions.

A proof of (3.15) can be found in Brémaud (2020).

Property (3.15) tells us that, with probability one (i.e., for almost every PP-Markov chain that we generate), the fraction of time that the chain spends in any given state is, in the limit, equal to the probability assigned to that state by the stationary distribution. Markov chains with this property are sometimes said to be ergodic.

Since the S--s inventory model from Section 3.1.1.2 is irreducible, the ergodicity result from Theorem 3.1.2 applies. In particular, the process has only one stationary distribution ψ\psi^* in D(X)\dD(\Xsf), where X={0,,S+s}\Xsf = \{0, \ldots, S+s\}, and (3.15) is valid. Figure Figure 3.2 illustrates this by plotting both the stationary distribution ψ\psi^* (which is computed using the code in Listing 1), and the value m(y)1kt=0k11{Xt=y}m(y) \coloneq \frac{1}{k} \sum_{t=0}^{k-1} \1\{X_t = y\} at each yXy \in \Xsf for kk set to 1,000,0001,000,000. As predicted by the theorem, the fraction of time spent by the chain in each state is close to the probability assigned by ψ\psi^*.

Ergodicity (inventory_sim.jl)

Figure 3.2:Ergodicity (inventory_sim.jl)

3.1.2.1Application: Day Laborer

Suppose that a day laborer is either unemployed (Xt=1X_t = 1) or employed (Xt=2X_t = 2) in each period. In state 1 he is hired with probability α(0,1)\alpha \in (0, 1). In state 2 he is fired with probability β(0,1)\beta \in (0, 1). The corresponding state space and transition matrix are

X={1,2}andP=(1ααβ1β).\Xsf = \{1, 2\} \quad \text{and} \quad P = \begin{pmatrix} 1-\alpha & \alpha \\ \beta & 1-\beta \end{pmatrix}.

Listing 3 provides a function to update from XtX_t to Xt+1X_{t+1}, using the fact that rand()\texttt{rand()} generates a draw from the uniform distribution on [0,1)[0,1).

1
2
3
4
5
6
7
8
9
10
11
12
13
function create_laborer_model(; α=0.3, β=0.2)
    return (; α, β)
end

function laborer_update(x, model)  # update X from t to t+1
    (; α, β) = model
    if x == 1    
        x′ = rand() < α ? 2 : 1
    else 
        x′ = rand() < β ? 1 : 2
    end
    return x′
end

Program 3:Updating the state of the day laborer (laborer_sim.jl)

It is also true that ψPtψ\psi P^t \to \psi^* as tt \to \infty for any ψD(X)\psi \in \dD(\Xsf). Thus, the operator PP when understood as the mapping ψψP\psi \mapsto \psi P, is globally stable on D(X)\dD(\Xsf)

3.1.3Approximation

To simplify numerical calculations, we sometimes approximate a continuous-state Markov process with a Markov chain. For example, consider a linear Gaussian AR(1) model, where (Xt)t0(X_t)_{t \geq 0} evolves in R\RR according to

Xt+1=ρXt+b+νϵt+1,ρ<1,(ϵt) iid N(0,1).X_{t+1} = \rho X_t + b + \nu \epsilon_{t+1}, \quad |\rho|<1, \quad ( \epsilon_t ) \iidsim N(0, 1).

The model (3.19) has a unique stationary distribution ψ\psi^* given by

ψ=N(μx,σx2)withμxb1ρandσx2ν21ρ2.\psi^* = N(\mu_x, \sigma_x^2) \quad \text{with} \quad \mu_x \coloneq \frac{b}{1-\rho} \quad \text{and} \quad \sigma_x^2 \coloneq \frac{\nu^2}{1-\rho^2}.

This means that

 Xt=dψ and Xt+1=ρXt+b+νϵt+1 implies Xt+1=dψ\text{ } X_t \eqdist \psi^* \text{ and } X_{t+1} = \rho X_t + b + \nu \epsilon_{t+1} \text{ implies } X_{t+1} \eqdist \psi^* \text{. }

Process (3.19) is also ergodic in a similar sense to (3.15): On average, realizations of the process spend most of their time in regions of the state where the stationary distribution puts high probability mass. (You can check this via simulations if you wish.) Hence, in the discretization that follows, we shall put the discrete state space in this area.

To discretize (3.19) we use Tauchen’s method, starting with the case b=0b=0.[1] As a first step, we choose nn as the number of states for the discrete approximation and mm as an integer that sets the width of the state space. Then we create a state space X{x1,,xn}R\Xsf \coloneq \{x_1, \ldots, x_n\} \subset \mathbb R as an equispaced grid that brackets the stationary mean on both sides by mm standard deviations:

The next step is to create an n×nn \times n matrix PP that approximates the dynamics in (3.19). For i,j[n]i, j \in \natset{n},

  1. if j=1j = 1, then set P(xi,xj)=F(x1ρxi+s/2)P(x_i, x_j) = F(x_1-\rho x_i + s/2).

  2. If j=nj = n, then set P(xi,xj)=1F(xnρxis/2)P(x_i, x_j) = 1 - F(x_n - \rho x_i - s/2).

  3. Otherwise, set P(xi,xj)=F(xjρxi+s/2)F(xjρxis/2)P(x_i, x_j) = F(x_j - \rho x_i + s/2) - F(x_j - \rho x_i - s/2).

The first two are boundary rules and the third applies Exercise 3.11.

Finally, if b0b \not= 0, then we shift the state space to center it on the mean μx\mu_x of the stationary distribution N(μx,σx2)N(\mu_x, \sigma_x^2). This is done by replacing xix_i with xi+μxx_i + \mu_x for each ii.

Julia routines that compute X\Xsf and PP can be found in the library QuantEcon.jl.

Figure Figure 3.3 compares the continuous stationary distribution ψ\psi^* and the unique stationary distribution of the discrete approximation when X\Xsf and PP are constructed using Tauchen’s method when ρ=0.9\rho=0.9, b=0.0b=0.0, ν=1.0\nu=1.0 and the discretization parameters are n=15n=15 and m=3m=3.

Comparison of \psi^* = N(\mu_x, \sigma_x^2) and its discrete approximant

Figure 3.3:Comparison of ψ=N(μx,σx2)\psi^* = N(\mu_x, \sigma_x^2) and its discrete approximant

3.2Conditional Expectations

In this section, we discuss how to compute conditional expectations for Markov chains. The theory will be essential for the study of finite Markov decision processes, since, in these models, lifetime rewards are mathematical expectations of flow reward functions of Markov states.

3.2.1Mathematical Expectations

We begin with mathematical expectations of functions of Markov states.

3.2.1.1Conditional Expectations

Fix PM(RX)P \in \mopx. For each hRXh \in \RR^\Xsf, we define

(Ph)(x)=xXh(x)P(x,x)(xX).(P h)(x) = \sum_{x' \in \Xsf} h(x') P(x,x') \qquad (x \in \Xsf).

Noting that P(x,)P(x, \cdot) is the distribution of Xt+1X_{t+1} given Xt=xX_t = x, we can write

(Ph)(x)=E[h(Xt+1)Xt=x],(P h)(x) = \EE [h(X_{t+1}) \given X_t = x],

where (Xt)(X_t) is any PP-Markov chain on X\Xsf. In terms of matrix algebra, viewing hh has an n×1n \times 1 column vector, the expression (Ph)(x)(Ph)(x) is one element of the vector PhPh obtained by premultiplying hh by PP.

The interpretation in (3.24) extends to powers of PP. In particular, we have

(Pkh)(x)=xh(x)Pk(x,x)=E[h(Xt+k)Xt=x].(P^k h)(x) = \sum_{x'} h(x') P^k(x,x') = \EE [h(X_{t+k}) \given X_t = x].

3.2.1.2The Law of Iterated Expectations

The law of iterated expectations is a workhorse in economics and finance. One version of the law states that if XX and YY are two random variables, then E[E[YX]]=E[Y]\EE[ \EE[Y \given X] ] = \EE[Y]. Let’s show how this law operates for Markov chains.

Let (Xt)(X_t) be PP-Markov with X0=dψ0X_0 \eqdist \psi_0. Fix t,kNt, k \in \NN. Set EtE[Xt]\EE_t \coloneq \EE [ \cdot \given X_t]. We claim that

E[Et[h(Xt+k)]]=E[h(Xt+k)]for any hRX.\EE [ \EE_t [h(X_{t+k})] ] = \EE [ h(X_{t+k}) ] \quad \text{for any } h \in \RR^\Xsf.

To see that this holds, recall that E[h(Xt+k)Xt=x]=(Pkh)(x)\EE [h(X_{t+k}) \given X_t = x] = (P^k h)(x). Hence E[h(Xt+k)Xt]=(Pkh)(Xt)\EE [h(X_{t+k}) \given X_t] = (P^k h)(X_t). Therefore,

E[Et[h(Xt+k)]]=E[(Pkh)(Xt)]=x(Pkh)(x)ψt(x)=x(Pkh)(x)(ψ0Pt)(x).\EE [ \EE_t [h(X_{t+k})] ] = \EE [ (P^k h)(X_t) ] = \sum_{x'} (P^k h)(x') \psi_t (x') = \sum_{x'} (P^k h)(x') (\psi_0 P^t) (x').

Since ψ0Pt\psi_0 P^t is a row vector, we can write the last expression as

ψ0PtPkh=ψ0Pt+kh=ψt+kh=Eh(Xt+k).\psi_0 P^t P^k h = \psi_0 P^{t+k} h = \psi_{t+k} h = \EE h(X_{t+k}).

Hence (3.26) holds.

3.2.1.3Monotone Markov Chains

Next, we connect Markov chains to order theory via stochastic dominance. These connections will have applications later in the book.

Let X\Xsf be a finite set partially ordered by \preceq. A Markov operator PM(RX)P \in \mopx is called monotone increasing if

x,yX and xy    P(x,)FP(y,).x, y \in \Xsf \text{ and } x \preceq y \quad \implies \quad P(x, \cdot) \lefsd P(y, \cdot).

Thus, PP is monotone increasing if shifting up the current state shifts up the next-period state, in the sense that its distribution increases in the stochastic dominance ordering (see Section 2.2.4) on D(X)\dD(\Xsf). Below, we will see that monotonicity of Markov operators is closely related to monotonicity of value functions in dynamic programming.

Monotonicity of Markov operators is related to positive autocorrelation. To illustrate the idea, consider the AR(1) model Xt+1=ρXt+σϵt+1X_{t+1} = \rho X_t + \sigma \epsilon_{t+1} from Section 3.1.3 and suppose we apply Tauchen discretization, mapping the parameters ρ,σ\rho , \sigma and a discretization size nn into a Markov operator PP on state space X={x1,,xn}R\Xsf = \{x_1, \ldots, x_n\} \subset \RR, totally ordered by \leq. If ρ0\rho \geq 0, so that positive autocorrelation holds, then PP is monotone increasing.

3.2.2Geometric Sums

Dynamic programs often form a lifetime value V0V_0 as a geometric sum of a reward sequence (Rt)t0(R_t)_{t \geq 0} with constant discount factor, so that V0=Et=0βtRtV_0 = \EE \sum_{t = 0}^\infty \beta^t R_t for some β>0\beta > 0. We saw this in (1.1), where we aggregated a profit stream (πt)t0(\pi_t)_{t \geq 0} into an expected present value of the firm, and again in (1.7), where a worker evaluates lifetime earnings. In this section, we study expectations of geometric sums.

3.2.2.1Theory

Consider a conditional mathematical expectation of a discounted sum of future measurements:

v(x)Ext=0βth(Xt)E[t=0βth(Xt)X0=x],v(x) \coloneq \EE_x \, \sum_{t=0}^\infty \beta^t h(X_t) \coloneq \EE \left[ \, \sum_{t=0}^\infty \beta^t h(X_t) \given X_0 = x \right],

for some constant βR+\beta \in \RR_+ and hRXh \in \RR^\Xsf. Here

With II as the identity matrix, the next result describes vv as function of β\beta, PP and hh.

3.2.2.2Application: Valuation of Firms

Consider a firm that receives random profit stream (πt)t0(\pi_t)_{t \geq 0}. Supposes that the value of the firm equals the expected present value of its profit stream. Suppose for now that the interest rate is constant at r>0r > 0. With β1/(1+r)\beta \coloneq 1/(1+r), total valuation is

V0=Et=0βtπt.V_0 = \EE \sum_{t=0}^\infty \beta^t \pi_t.

To compute this value, we need to know how profits evolve. A common strategy is to set πt=π(Xt)\pi_t = \pi(X_t) for some fixed πRX\pi \in \RR^\Xsf, where (Xt)t0(X_t)_{t \geq 0} is a state process. For known dynamics of (Xt)(X_t) and function π\pi, the value V0V_0 in (3.36) can be computed.

Here we assume that (Xt)(X_t) is PP-Markov for PM(RX)P \in \mopx with finite X\Xsf. Then conditioning on X0=xX_0 = x, we can write the value as

v(x)Ext=0βtπtE[t=0βtπtX0=x].v(x) \coloneq \EE_x \sum_{t=0}^\infty \beta^t \pi_t \coloneq \EE \left[ \sum_{t=0}^\infty \beta^t \pi_t \given X_0 = x \right].

By Lemma 3.2.1, the value v(x)v(x) is finite and the function vRXv \in \RR^\Xsf can be obtained by

v=t=0βtPtπ=(IβP)1π.v = \sum_{t = 0}^\infty \beta^t P^t \pi = (I - \beta P)^{-1} \pi.

It is plausible that the value of the firm will be higher for a return process in which higher states generate higher profits and predict higher future states. The next exercise confirms this.

3.2.2.3Application: Valuing Consumption Streams

To model consumption-saving choices we want to evaluate different consumption paths, where a consumption path is a nonnegative random sequence (Ct)t0(C_t)_{t \geq 0}. In what follows we consider consumption paths such that Ct=c(Xt)C_t = c(X_t) for all t0t \geq 0, where cR+Xc \in \RR_+^\Xsf and (Xt)t0(X_t)_{t \geq 0} is PP-Markov on finite set X\Xsf. Thus, consumption streams are time-invariant functions of a finite-state Markov chain.

In a standard “time additive” model of consumer preferences with constant geometric discounting, the time zero value of a consumption stream (Ct)t0(C_t)_{t \geq 0}, given current state X0=xXX_0 = x \in \Xsf, is

v(x)=Ext=0βtu(Ct),v(x) = \EE_x \sum_{t=0}^\infty \beta^t u(C_t),

where β(0,1)\beta \in (0,1) is a discount factor and u ⁣:R+Ru \colon \RR_+ \to \RR is called the flow utility function. Dependence of v(x)v(x) on xx comes from the initial condition X0=xX_0 = x influencing the Markov state process and, therefore, the consumption path.

Using Ct=c(Xt)C_t = c(X_t) and defining rucr \coloneq u \circ c we can write v(x)=Ext0βtr(Xt)v(x) = \EE_x \, \sum_{t \geq 0} \beta^t r(X_t). By Lemma 3.2.1, this sum is finite and vv can be expressed as

v=(IβP)1r.v = (I - \beta P)^{-1} r.

Figure Figure 3.4 shows an example when uu has the constant relative risk aversion (CRRA) specification

u(c)=c1γ1γ(c0,  γ>0),u(c)=\frac{c^{1-\gamma}}{1-\gamma} \qquad (c \geq 0, \; \gamma > 0),

while c(x)=exp(x)c(x) = \exp(x), so that consumption takes the form Ct=exp(Xt)C_t = \exp(X_t), and (Xt)t0(X_t)_{t \geq 0} is a Tauchen discretization (see Section 3.1.3) of Xt+1=ρXt+νWt+1X_{t+1} = \rho X_t + \nu W_{t+1} where (Wt)t1(W_t)_{t \geq 1} is iid and standard normal. Parameters are n=25n=25, β=0.98\beta=0.98, ρ=0.96\rho=0.96, ν=0.05\nu=0.05 and γ=2\gamma = 2. We set r=ucr = u \circ c and solved for vv via (3.40).

The value of (C_t)_{t\geq 0} given X_t = x

Figure 3.4:The value of (Ct)t0(C_t)_{t\geq 0} given Xt=xX_t = x

3.3Job Search Revisited

In this section, we extend the job search problem studied in Section 1.3 to a setting with Markov wage offers. We discuss additional structure when the Markov operator for wage offers is monotone increasing. We will also allow job separations to occur.

3.3.1Job Search with Markov State

We adopt the job search setting of Section 1.3 but assume now that the wage process (Wt)(W_t) is PP-Markov on WR+\Wsf \subset \RR_+, where PM(RW)P \in \mopw and W\Wsf is finite.

3.3.1.1Value Function Iteration

The value function vv^* for the Markov job search model is now defined as follows: v(w)v^*(w) is the maximum lifetime value that can be obtained when the worker is unemployed with current wage offer is ww in hand. Value function vv^* satisfies Bellman equation

v(w)=max{w1β,c+βwWv(w)P(w,w)}(wW).v^*(w) = \max \left\{ \frac{w}{1-\beta} ,\, c + \beta \, \sum_{w' \in \Wsf} \, v^*(w') P(w, w') \right\} \qquad (w \in \Wsf).

We continue to assume that c>0c > 0 and β(0,1)\beta \in (0,1).

Bellman equation (3.42) extends a corresponding Bellman equation for the iid case (cf. (1.45)). (A full proof is given in Chapter 4.) The Bellman operator corresponding to (3.42) is

(Tv)(w)=max{w1β,c+βwv(w)P(w,w)}(wW).(Tv)(w) = \max \left\{ \frac{w}{1-\beta} ,\, c + \beta \, \sum_{w'} \, v(w') P(w, w') \right\} \qquad (w \in \Wsf).

As before, TT is constructed so that vv^* is a fixed point (since (3.42) holds). Exercise 3.21 will show that vv^* is the only fixed point of TT in R+W\RR^\Wsf_+.

Extending the iid definition (cf. (1.54)), a policy σ ⁣:W{0,1}\sigma \colon \Wsf \to \{0,1\} is called vv-greedy if

σ(w)=1{w1βc+βwv(w)P(w,w)},\sigma(w) = \1\left\{ \frac{w'}{1-\beta} \geq c + \beta \, \sum_{w'} \, v(w') P(w, w') \right\},

for all wWw \in \Wsf.

Let VR+W\vV \coloneq \RR^\Wsf_+ and endow V\vV with the pointwise partial order \leq and the supremum norm, so that fg=maxwWf(w)g(w)\| f - g\|_\infty = \max_{w \in \Wsf}|f(w) - g(w)|.

We recommend that you study the proof of the next lemma, since the same style of argument occurs often in the book.

In view of the contraction property established in Exercise 3.21, we can use value function iteration (i) to compute an approximation vv to the value function and (ii) to calculate the vv-greedy policy that approximates the optimal policy. Code for implementing this procedure is in Listing 4. The definition of a vv-greedy policy resembles that of the iid case (see (1.54)).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using QuantEcon, LinearAlgebra
include("s_approx.jl")

"Creates an instance of the job search model with Markov wages."
function create_markov_js_model(;
        n=200,       # wage grid size
        ρ=0.9,       # wage persistence
        ν=0.2,       # wage volatility
        β=0.98,      # discount factor
        c=1.0        # unemployment compensation
    )
    mc = tauchen(n, ρ, ν)
    w_vals, P = exp.(mc.state_values), mc.p
    return (; n, w_vals, P, β, c)
end

" The Bellman operator Tv = max{e, c + β P v} with e(w) = w / (1-β)."
function T(v, model)
    (; n, w_vals, P, β, c) = model
    h = c .+ β * P * v
    e = w_vals ./ (1 - β)
    return max.(e, h)
end

" Get a v-greedy policy."
function get_greedy(v, model)
    (; n, w_vals, P, β, c) = model
    σ = w_vals / (1 - β) .>= c .+ β * P * v
    return σ
end

"Solve the infinite-horizon Markov job search model by VFI."
function vfi(model) 
    v_init = zero(model.w_vals)  
    v_star = successive_approx(v -> T(v, model), v_init)
    σ_star = get_greedy(v_star, model)
    return v_star, σ_star
end

Program 4:Job search with Markov state (markov_js.jl)

3.3.1.2Continuation Values

The continuation value hh^* from the iid case is now replaced by a continuation value function

h(w)c+βwv(w)P(w,w)(wW).h^*(w) \coloneq c + \beta \, \sum_{w'} \, v^*(w') P(w, w') \qquad (w \in \Wsf).

The continuation value depends on ww because the current offer helps predict the offer next period, which in turn affects the value of continuing. The functions ww/(1β)w \mapsto w / (1-\beta), hh^* and vv^* corresponding to the default model in Listing 4 are shown in Figure Figure 3.5.

Value, stopping, and continuation for Markov job search

Figure 3.5:Value, stopping, and continuation for Markov job search

Exercise 3.24 suggests an alternative way to solve the job search problem: iterate with QQ to obtain the continuation value function hh^* and then use the policy

σ(w)=1{w1βh(w)}(wW)\sigma^*(w) = \1\left\{ \frac{w}{1-\beta} \geq h^*(w) \right\} \qquad (w \in \Wsf)

that tells the worker to accept when the current stopping value exceeds the current continuation value.

We saw that, in the iid case, a computational strategy based on continuation values is far more efficient than value function iteration (see Section 1.3.2.2). Since continuation values are functions rather than scalars, here the two approaches (iterating with TT vs iterating with QQ) are more similar. In Chapter 4 we discuss alternative computational strategies in more detail, seeking conditions under which one approach will be more efficient than the other.

3.3.2Job Search with Separation

We now modify the job search problem discussed in Section 3.3.1 by adding separations. In particular, an existing match between worker and firm terminates with probability α\alpha every period. (This is an extension because setting α=0\alpha=0 recovers the permanent job scenario from Section 3.3.1.)

The worker now views the loss of a job as a capital loss and a spell of unemployment as an investment. In what follows, the wage process and discount factor are unchanged from Section 3.3.1. As before, VR+W\vV \coloneq \RR^\Wsf_+ is endowed with the supremum norm.

The value function vuv^*_u for an unemployed worker satisfies the recursion

vu(w)=max{ve(w),c+βwWvu(w)P(w,w)}(wW),v^*_u(w) = \max \left\{ v^*_e(w) ,\, c + \beta \, \sum_{w' \in \Wsf} \, v^*_u(w') P(w, w') \right\} \qquad (w \in \Wsf),

where vev^*_e is the value function for an employed worker, that is, the lifetime value of a worker who starts the period employed at wage ww. Value function vev^*_e satisfies

ve(w)=w+β[αwvu(w)P(w,w)+(1α)ve(w)](wW).v^*_e(w) = w + \beta \left[ \alpha \sum_{w'} v^*_u(w') P(w, w') + (1-\alpha) v^*_e(w) \right] \qquad (w \in \Wsf).

This equation states that value accruing to an employed worker is current wage plus the discounted expected value of being either employed or unemployed next period.

We claim that, when 0<α,β<10 < \alpha, \beta < 1, the system (3.51)--(3.52) has a unique solution (ve,vu)(v_e^*, v_u^*) in V×V\vV \times \vV. To show this we first solve (3.52) in terms of ve(w)v^*_e(w) to obtain

ve(w)=11β(1α)(w+αβ(Pvu)(w)).v^*_e(w) = \frac{1}{1 - \beta(1-\alpha)} \left(w + \alpha \beta (P v^*_u)(w) \right).

(Recall (Ph)(w)wh(w)P(w,w)(Ph)(w) \coloneq \sum_{w'} h(w') P(w, w') for hRWh \in \RR^\Wsf.) Substituting into (3.51) yields

vu(w)=max{11β(1α)(w+αβ(Pvu)(w)),c+β(Pvu)(w)}.v^*_u(w) = \max \left\{ \frac{1}{1 - \beta(1-\alpha)} \left(w + \alpha \beta (P v^*_u)(w) \right) ,\, c + \beta \, (P v^*_u)(w) \right\}.

Figure Figure 3.6 shows the value function vuv_u^* for an unemployed worker, which is the fixed point of (3.54), as well as the stopping and continuation values, which are given by

s(w)11β(1α)(w+αβ(Pvu)(w))andhe(w)c+β(Pvu)(w)s^*(w) \coloneq \frac{1}{1 - \beta(1-\alpha)} \left(w + \alpha \beta (P v^*_u)(w) \right) \quad \text{and} \quad h^*_e(w) \coloneq c + \beta \, (P v^*_u)(w)

respectively, for each wWw \in \Wsf. Parameters are as in Listing 5. The value function vuv^*_u is the pointwise maximum (i.e., vu=shv^*_u = s^* \vee h^*). The worker’s optimal policy while unemployed is

σ(w)1{s(w)h(w)}.\sigma^*(w) \coloneq \1\{s^*(w) \geq h^*(w)\}.

As before, the smallest ww such that σ(w)=1\sigma^*(w) = 1 is called the reservation wage.

1
2
3
4
5
6
7
8
9
10
11
12
using QuantEcon, LinearAlgebra

"Creates an instance of the job search model with separation."
function create_js_with_sep_model(;
        n=200,          # wage grid size
        ρ=0.9, ν=0.2,   # wage persistence and volatility
        β=0.98, α=0.1,  # discount factor and separation rate
        c=1.0)          # unemployment compensation
    mc = tauchen(n, ρ, ν)
    w_vals, P = exp.(mc.state_values), mc.p
    return (; n, w_vals, P, β, c, α)
end

Program 5:Job search with separation model (markov_js_with_sep.jl)

Value function with job separation

Figure 3.6:Value function with job separation

Figure Figure 3.7 shows how the reservation wage changes with α\alpha. To produce this figure we solved the model for the reservation wage at 10 values of α\alpha in an evenly spaced grid ranging 0 to 1. The reservation wage falls with α\alpha, since time spent unemployed is a capital investment in better wages, and the value of this investment declines as the separation rate rises.

Reservation wage versus separation rate

Figure 3.7:Reservation wage versus separation rate

3.4Chapter Notes

Many good textbooks on Markov chains exist, including Norris (1998), Häggström & others (2002), and Privault (2013). Sargent & Stachurski (2023) provides a relatively comprehensive treatment from a network perspective that is a natural one for Markov chains. Other economic applications are discussed in Stokey & Lucas (1989) and Ljungqvist & Sargent (2018). Meyer (2000) gives a detailed account of the theory of nonnegative matrices. Another useful reference is Horn & Johnson (2012).

A systematic study of monotone Markov chains was initiated by Daley (1968). Monotone Markov methods have many important applications in economics. See, for example, Hopenhayn & Prescott (1992), Kamihigashi & Stachurski (2014), Jaśkiewicz & Nowak (2014), Balbus et al. (2014), Foss et al. (2018) and Hu & Shmaya (2019).

Footnotes
  1. Tauchen’s method Tauchen, 1986 is simple but sub-optimal in some cases. For a more general discretization method and a survey of the literature, see Farmer & Toda (2017).

  2. To justify the first equality, care must be taken when pushing expectations through infinite sums. In the present setting, justification can be provided via the dominated convergence theorem (see, e.g., Dudley (2002), Theorem 4.3.5). A proof of a more general result can be found in Section B.2.

References
  1. Brémaud, P. (2020). Markov Chains: Gibbs Fields, Monte Carlo Simulation and Queues (Vol. 31). Springer Nature.
  2. Norris, J. R. (1998). Markov Chains. Cambridge University Press.
  3. Häggström, O., & others. (2002). Finite Markov Chains and Algorithmic Applications. Cambridge University Press.
  4. Privault, N. (2013). Understanding Markov Chains: Examples and Applications. Springer-Verlag Singapore.
  5. Sargent, T., & Stachurski, J. (2023). Economic Networks: Theory and Computation. Cambridge University Press.
  6. Stokey, N., & Lucas, R. (1989). Recursive Methods in Dynamic Economics. Harvard University Press.
  7. Ljungqvist, L., & Sargent, T. (2018). Recursive Macroeconomic Theory (4th ed.). MIT Press.
  8. Meyer, C. D. (2000). Matrix Analysis and Applied Linear Algebra (Vol. 71). Siam.
  9. Horn, R. A., & Johnson, C. R. (2012). Matrix Analysis. Cambridge University Press.
  10. Daley, D. (1968). Stochastically monotone Markov Chains. Probability Theory and Related Fields, 10(4), 305–317.
  11. Hopenhayn, H. A., & Prescott, E. C. (1992). Stochastic monotonicity and stationary distributions for dynamic economies. Econometrica, 60(6), 1387–1406.
  12. Kamihigashi, T., & Stachurski, J. (2014). Stochastic stability in monotone economies. Theoretical Economics, 9(2), 383–407.
  13. Jaśkiewicz, A., & Nowak, A. S. (2014). Stationary Markov perfect equilibria in risk sensitive stochastic overlapping generations models. Journal of Economic Theory, 151, 411–447.
  14. Balbus, Ł., Reffett, K., & Woźny, Ł. (2014). A constructive study of Markov equilibria in stochastic games with strategic complementarities. Journal of Economic Theory, 150, 815–840.
  15. Foss, S., Shneer, V., Thomas, J. P., & Worrall, T. (2018). Stochastic stability of monotone economies in regenerative environments. Journal of Economic Theory, 173, 334–360.