16
Eco 529: Brunnermeier & Sannikov Macro, Money and Finance Problem Sets 2 Solutions Sebastian Merkel Eco529: Monetary and Financial Economics Fall 2020

Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Macro, Money and Finance

Problem Sets 2 – Solutions Sebastian Merkel

Eco529: Monetary and Financial Economics Fall 2020

Page 2: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Problem Set 2 – Problem 2 (KFE OU Process)

▪ General Kolmogorov Forward Equation (KFE)

▪ Describes density evolution of process 𝑋 with

▪ For this problem: 𝑋 = Ornstein-Uhlenbeck process(continuous-time AR(1))

▪ Get then special KFE

2

Page 3: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Problem Set 2 – Problem 2 (KFE OU Process)

▪ For this problem: 𝑋 = Ornstein-Uhlenbeck process(continuous-time AR(1))

▪ Get then special KFE

▪ Tasks:▪ Solve equation numerically using different schemes and

parameters

▪ Compare with known closed-form solution

▪ Identify problems with some schemes

3

Page 4: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Digression: a More General PDE

▪ OU- KFE PDE is

▪ Instead, let’s solve the generic linear PDE

4

Page 5: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Digression: a More General PDE

▪ Let’s solve the generic linear PDE

▪ Let 𝑥0 < 𝑥1 < ⋯ < 𝑥𝑁−1 < 𝑥𝑁 be a grid in 𝑥-dimension

▪ A finite difference approximation transforms the PDE into a vector ODE

where

and the matrices 𝐷2, 𝐷1 represent the finite difference approximation

5

Page 6: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Solving the Vector ODE – time step

▪ We can write this vector ODE more concisely asƸ𝑝′ 𝑡 = 𝑀 𝑡 Ƹ𝑝 𝑡 + መ𝑑(𝑡)

where𝑀 𝑡 = 𝐴 𝑡 𝐷2 + 𝐵 𝑡 𝐷1 + 𝐶(𝑡)

▪ We use two methods for the ODE (time step)1. Explicit Euler:

▪ Evaluate right-hand side at the previous time grid point 𝑡▪ Equation for new vector ො𝑝 𝑡 + Δ𝑡

ො𝑝 𝑡 + Δ𝑡 = ො𝑝 𝑡 + Δ𝑡 ⋅ 𝑀 𝑡 ො𝑝 𝑡 + መ𝑑(𝑡)

2. Implicit Euler:▪ Evaluate right-hand side at the new time grid point 𝑡 + Δ𝑡▪ Equation for new vector ො𝑝 𝑡 + Δ𝑡𝐼 − Δ𝑡 ⋅ 𝑀 𝑡 + Δ𝑡 ො𝑝 𝑡 + Δ𝑡 = ො𝑝 𝑡 + Δ𝑡 ⋅ መ𝑑(𝑡 + Δ𝑡)

▪ Remark: on the two boundaries, we ignore the ODE and impose the boundary conditions instead

6

Page 7: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Solving the Vector ODE – the matrix 𝑀 𝑡

▪ Left to do: construct matrix 𝑀 𝑡▪ recall 𝑀 𝑡 = 𝐴 𝑡 𝐷2 + 𝐵 𝑡 𝐷1 + 𝐶(𝑡)

▪ The matrices 𝐴 𝑡 , 𝐵 𝑡 and 𝐶(𝑡) are diagonal

▪𝐷2 and 𝐷1 are tridiagonal

𝐷𝑘 =

∗ ∗𝑑1,−𝑘 𝑑1,0

𝑘 𝑑1,+𝑘

𝑑2,−𝑘 𝑑2,0

𝑘 𝑑2,+𝑘

⋱ ⋱ ⋱⋱ ⋱ ⋱

𝑑𝑁−1,−𝑘 𝑑𝑁−1,0

𝑘 𝑑𝑁−1,+𝑘

∗ ∗

▪ Conclusion: 𝑀 𝑡 is again tridiagonal, construct as sparse matrix7

Page 8: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Example: 𝐷2 for equally spaced grid

▪ Suppose we have an equally spaced grid,𝑥𝑖+1 = 𝑥𝑖 + Δ𝑥

▪ Then 𝐷2 is given by

𝐷2 =

∗ ∗1

Δ𝑥2− 2Δ𝑥2

1Δ𝑥2

1Δ𝑥2

− 2Δ𝑥2

1Δ𝑥2

⋱ ⋱ ⋱⋱ ⋱ ⋱

1Δ𝑥2

− 2Δ𝑥2

1Δ𝑥2

∗ ∗

8

Page 9: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Solution of KFE for 𝜃 = 0

9

Page 10: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

What Happens for Finer Space Grid?

▪ Implicit Method: errors slightly smaller

▪ Explicit Method:

10

Page 11: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

What Happens for Finer Space Grid?

▪ Implicit Method: errors slightly smaller

▪ Explicit Method:

11

Page 12: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

What Happens for Finer Space Grid?

▪ Implicit Method: errors slightly smaller

▪ Explicit Method:

12

Page 13: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

What Happens for Finer Space Grid?

▪ Implicit Method: errors slightly smaller

▪ Explicit Method:

13

Page 14: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

What Happens for Finer Space Grid?

▪ Implicit Method: errors slightly smaller

▪ Explicit Method:

14

Page 15: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

What Goes Wrong with the Explicit Method?

▪ Recall, Stability of ODEs:▪ Stable, if eigenvalue in stability region

▪ Smallest eigenvalue of equation‘s space

discretization 𝜆 ≈ −2𝜎2

Δ𝑥2

▪ If too small, explicit method becomesunstable:

15

Page 16: Problem Sets 2 Solutions - Princeton University · 2020. 10. 2. · Problem Set 2 –Problem 2 (KFE OU Process) For this problem: 𝑋=Ornstein-Uhlenbeck process (continuous-time

Eco

52

9: B

run

ner

mei

er &

San

nik

ov

Solution for 𝜃 = 3

16