Matlab Programming and Quantitative Economic Theory

Size: px
Start display at page:

Download "Matlab Programming and Quantitative Economic Theory"

Transcription

1 Matlab Programming and Quantitative Economic Theory Patrick Bunk and Hong Lan SFB C7 Humboldt University of Berlin June 4, 2010 Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

2 Quantitative Economic Theory one utility maximizing representative agent (HH) one profit maximizing firm market structure equilibrium, s.t. HH optimize given their BC firms maximize profits markets clear approximate the system around an equilibrium > find out the numerical solution to this class of models Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

3 A real business cycle model with labor choice max {c t,n t,k t+1 } t=0 E t t=0 β t [ log c t φn t ] s.t. y t = z t k α t n 1 α t (1) y t = c t + i t (2) k t+1 = (1 δ)k t + i t (3) z t+1 = ρz t + σɛ t+1 ɛ t i.i.d E t ɛ t+1 = 0 (4) k 0 is given Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

4 Bells and Whistles certain level of heterogeneity in a an economy goods capital stocks HH firms market structures production technologies matching markets (labor) idea: add complications might help to get it right hard to evaluate the quality of approximations Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

5 1 Recursive Form 2 The Curse of Dimensionality 3 Sparse Grids 4 Parallelization 5 Perturbation Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

6 Computational Difficulties Many economic models are of high dimension DSGE: multiple kinds of capital stocks, agents, firms, countries... Games: multiple players and states Bayesian analyses: compute high-dimensional integrals Bootstrapping: analyze many n-dimensional samples from n data points Simulation of large Markov processes - MCMC, Gibbs sampling... Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

7 Computational Difficulties If we are interested in the globally accurate solution of a high dimensional model Global methods are cursed by dimensionality or circumvent the curse by local approximation Perturbation method: Schmitt-Grohe and Uribe (2004) Linear methods: Blanchard and Kahn (1980) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

8 Recursive Form A real business cycle model with labor choice max {c t,n t,k t+1 } t=0 E t t=0 β t [ log c t φn t ] s.t. y t = z t k α t n 1 α t (5) y t = c t + i t (6) k t+1 = (1 δ)k t + i t (7) z t+1 = ρz t + σɛ t+1 ɛ t i.i.d E t ɛ t+1 = 0 (8) k 0 is given Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

9 Recursive Form The recursive formulation of the optimization problem The stochastic case V (k, z) = max c,n {log(c) φn + βev (k, z )} (9) s.t. c + k = zk α n 1 α + (1 δ)k (10) z = ρz + σɛ (11) The deterministic case V (k) = max c,n {log(c) φn + βv (k )} (12) s.t. c + k = zk α n 1 α + (1 δ)k (13) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

10 Recursive Form The deterministic Bellman equation { V (k) = max log(c) φn + βv (k ) } (14) c,n s.t. c + k = zk α n 1 α + (1 δ)k (15) The Bellman equation implicitly defines three policy functions c = c(k) (16) n = n(k) (17) k = k(k) (18) Computational task: Find out the parameterization of these policy functions Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

11 Recursive Form Result 20 policy function for capital k prime k Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

12 Recursive Form Characterization FOCs 1 c = βv k (k ) (19) φ = (1 α)β y n V k (k ) (20) Envelope condition one step forward of the envelope, V k (k) = 1 c R where R = α y k + 1 δ (21) V k (k ) = 1 c R (22) Euler equations [ ] c 1 = β c R φc = (1 α) y n (23) (24) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

13 Recursive Form Solving for the stationary steady state Steady state represents the long-term equilibrium relationship of the model, It is the constant solution of Euler equations and all constraints, and it is the constant solution of the Bellman equation! Need to use parameter values, δ = α = 0.36 β = 0.99 φ = 2.5 z = 1 An example, the consumption Euler equation in steady state, 1 = βr, using β = 0.99, we obtain R = 1/0.99 The steady state values of the model are consumption c output y capital k labor supply n These values are the best guesses to initialize the value function iteration Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

14 Recursive Form The discretized state space algorithm (Deterministic case) Make grids for both state variable (k): k 1 < k 2 <... < k kg, and for the control variable (n): n 1 < n 2 <... < n hg Calculate u(n i, k j, k n) for all state-control variable pairs (3 dimensional combinations), (n i, k j, k n) Find the new iteration of the value function as, { } V 1 (k n) = max u(n i, k j, k n) + βv 0 (k j ) k j,n Check for convergence, i.e. check norm(v 1 (k n) V 0 (k n)) tol for all grid values k n If not, go back to step 2 If so, done Use the indices from the maximum step 4 to recover the policy function Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

15 Recursive Form Discretized state space - domain of the value function labor in period t capital in period t capital in period t 20 Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

16 Recursive Form Discretized state space - domain of the value function Matlab Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

17 Recursive Form 1 Recursive Form 2 The Curse of Dimensionality 3 Sparse Grids 4 Parallelization 5 Perturbation Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

18 The Curse of Dimensionality Curse of dimensionality The computational cost and storage requirements for a n-dimensional value function approximation with a prescribed tolerance of error V n ˆV n = O(n) depends exponentially on the dimension n In the stochastic version of the model, the computational cost and storage requirements of integrating conditional expectation of q states depends exponentially on the number of states q Increasing the number of points in the discretized state space will dramatically increase computational burden, even on the most powerful machine There is some good news! Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

19 The Curse of Dimensionality Mitigate the Curse Judd (1992), (1998), Gaspar and Judd (1997) a large domain creates a high computational burden carefully choose the domain of the value function choose the shape of the domain Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

20 The Curse of Dimensionality Judd s suggestion I Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

21 The Curse of Dimensionality Judd s suggestion I Get rid of kinks in the model (smoothness improves computation) Use finite-dimensional states Use continuous time formulation > reduces state space by proper modeling Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

22 The Curse of Dimensionality Judd s suggestion II Reduce state space a bit further > Use spheres instead of cubes Spheres are much more compact hyper sphere and circumscribed hypercube as dimension gets large, most of the mass is in the corners Ratio of n-sphere to n-cube volume for n even ( π 2 )n ((n/2)!) 1 Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

23 The Curse of Dimensionality Judd s suggestion II Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

24 The Curse of Dimensionality 1 Recursive Form 2 The Curse of Dimensionality 3 Sparse Grids 4 Parallelization 5 Perturbation Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

25 Sparse Grids Sparse Grid Sparse grids have been used in several context Numerical integration Projection methods for DSGE models Barthelmann, Novak and Ritter (2000), Computational Mathematics Kubler and Krueger (2004), JEDC Malin, Krueger and Kubler (2007), JEDC project report Solution to partial differential equations Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

26 Sparse Grids A sparse grid Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

27 Sparse Grids Sparse Grid To construct the sparse grid for a DSGE model, we need to Specify the basis function, i.e. Chebyshev nodes or Gauss-Lobotto nodes, both of them are defined on [ 1, 1] Construct the sparse grid using Smolyak s method Convert the domain into the actual domain of the state variables in the model Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

28 Sparse Grids An example from Malin, Krueger and Kubler (2007) The first level, three dimensional sparse grid compute the basis for the grid of points G 1 = {0} For n = 2,..., ) G n = {ζ 1,...ζ n } where ζ j = cos j = 1,...n ( π(j 1) n 1 Define a sequence of positive integers by m(1) = 1 and m(i) = 2 i for i = 2, 3,... This leads to G m(1) = G 1 = {0} and G m(2) = G 3 = { 1, 0, 1} Key property of this Smolyak s construction: G m(i) G m(i+1) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

29 Sparse Grids An example from Malin, Krueger and Kubler (2007) The first level, three dimensional sparse grid The grid: H 3,1 = G m(2) G m(1) G m(1) G m(1) G m(2) G m(1) G m(1) G m(1) G m(2) The first level grid consists of 7 points:x 1,..., x 7 ( 1, 0, 0), (0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 1, 0), (0, 0, 1) and (0, 0, 1) Use (once per dimension): x i,1 = 2 s i,1 s i,1 s i,1 s i,1 1 to convert the standard sparse grid into the state variable sparse grid Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

30 Sparse Grids An example from Malin, Krueger and Kubler (2007) State Sparse Grid Standard Sparse Grid labor in period t capital in period t capital in period t Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

31 Sparse Grids 1 Recursive Form 2 The Curse of Dimensionality 3 Sparse Grids 4 Parallelization 5 Perturbation Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

32 Parallelization Bound the State Space What if all this is still not enough? Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

33 Parallelization Getting Things Done Standard strategy > 1. calculate computing time (back on the envelope) 2. optimize the code 3. Throw money at the problem (buy a faster computer) 3a. wait for better computers Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

34 Parallelization Calculate the State Space Size and Computing Time State Space: choices: capital k p t, k t h consumption c t labor l t investment k p t+1, k h t+1 payoff: flow utility function u(c,l), discount factor β Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

35 Parallelization Calculate the State Space Size and Computing Time domains and discretization: [0, 1000] for k p, k h, [0, 100] for l # choices: = 10 8 # states: = 10 6 full enumeration: (#choices) #states = (10 8 ) (106 ) DP: #choices (#States) 2 = = Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

36 Parallelization 3 Curses of Dimensionality state space choice space domains and discretization steps Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

37 Parallelization Calculate the State Space Size and Computing Time How long does it take? how many computations are needed per point? = GFLOPS (10 9 operations per second) 3171years CPU GFLOPS Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

38 Parallelization Superfluous space k t+1 y t (k t ) + (1 δ)k t, k t+1 (1 δ)k t Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

39 Parallelization Judd s suggestion I Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

40 Parallelization Calculate the State Space Size and Computing Time How long does it take? how many computations are needed per point? = GFLOPS (10 9 operations per second) 3171years CPU GFLOPS superfluous space (-90%) Judd I (-99%) (hard choice) Judd II (-70%) > down to 347 days/ 23 GFLOPS 15 days on a decent PC Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

41 Parallelization Calculate the State Space Size and Computing Time How long does it take? how many computations are needed per point? = GFLOPS (10 9 operations per second) 3171years CPU GFLOPS superfluous space (-90%) Judd I (-99%) (hard choice) Judd II (-70%) > down to 347 days/ 23 GFLOPS 15 days on a decent PC atrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

42 Parallelization Getting Things Done Standard strategy 1. calculate computing time (back on the envelope) Is the problem large? > 2. optimize the code (parallelize) 3. Throw money at the problem (buy a faster computer) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

43 Parallelization Getting Things Done parallelize code one of the hardest tasks in computer science one of the main challenges in the past 20 years sequential processing reached some physical limits (6 GHz?) speed of light limiting factor cm s > 5cm/calculation prize just got bigger! Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

44 Parallelization Getting Things Done parallelize code one of the hardest tasks in computer science one of the main challenges in the past 20 years sequential processing reached some physical limits (6 GHz?) speed of light limiting factor cm s > 5cm/calculation prize just got bigger! Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

45 Parallelization Divide & Conquer algorithm design paradigm 1. break down a problem recursively 2. keep track of branches beautiful source code (recursion) applications: sorting (quicksort) multiplication (Karatsuba) Fourier transformation DFT/FFT (Cooley-Tukey) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

46 Parallelization Example of D&C - Value Iteration V (s) := max a { s P(s, s a)[r a (s, s ) + βv (s )] } (25) Bellman equation as an update rule take any starting guess: V 0 (s) := 0, s S O(S) update V 1 (s) := max a { s P(s, s a)[r a (s, s ) + βv 0 (s )] } s S O(S 2 C) or O(SC) compute t := max s S V t (s) V t 1 (s) O(S) loop until t ɛ O(P(S)) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

47 Parallelization Example of D&C - Value Iteration V (s) := max a { s P(s, s a)[r a (s, s ) + βv (s )] } (25) Bellman equation as an update rule take any starting guess: V 0 (s) := 0, s S O(S) update V 1 (s) := max a { s P(s, s a)[r a (s, s ) + βv 0 (s )] } s S O(S 2 C) or O(SC) compute t := max s S V t (s) V t 1 (s) O(S) loop until t ɛ O(P(S)) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

48 Parallelization Example of D&C - Value Iteration V (s) := max a { s P(s, s a)[r a (s, s ) + βv (s )] } (25) Bellman equation as an update rule take any starting guess: V 0 (s) := 0, s S O(S) update V 1 (s) := max a { s P(s, s a)[r a (s, s ) + βv 0 (s )] } s S O(S 2 C) or O(SC) compute t := max s S V t (s) V t 1 (s) O(S) loop until t ɛ O(P(S)) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

49 Parallelization Example of D&C - Value Iteration V (s) := max a { s P(s, s a)[r a (s, s ) + βv (s )] } (25) Bellman equation as an update rule take any starting guess: V 0 (s) := 0, s S O(S) update V 1 (s) := max a { s P(s, s a)[r a (s, s ) + βv 0 (s )] } s S O(S 2 C) or O(SC) compute t := max s S V t (s) V t 1 (s) O(S) loop until t ɛ O(P(S)) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

50 Parallelization Example of D&C - Value Iteration V (s) := max a { s P(s, s a)[r a (s, s ) + βv (s )] } (25) Bellman equation as an update rule take any starting guess: V 0 (s) := 0, s S O(S) update V 1 (s) := max a { s P(s, s a)[r a (s, s ) + βv 0 (s )] } s S O(S 2 C) or O(SC) compute t := max s S V t (s) V t 1 (s) O(S) loop until t ɛ O(P(S)) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

51 Parallelization Getting Things Done Standard strategy 1. calculate computing time (back on the envelope) 2. optimize the code (parallelize) > 3. Throw money at the problem (buy a faster computer) 3a. wait for better computers Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

52 Parallelization Speed things up Name CPU Price GFLOPS ratio Top Dell OptiPlex780 C2D Dell Workstation 2xXeon Table: Currently available computers Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

53 Parallelization Speed things up II new trend: General Purpose processing with GPUs GPUs calculate parts of the image > branches specialized early in multi-core processing last years development of interface to tap into that power CUDA by Nvidia 2007 OpenCL Standard 2009 Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

54 Parallelization Speed things up III Name CPU Price GFLOPS ratio Top Dell OptiPlex780 C2D Dell Workstation 2xXeon EUR PC NVIDIA GT Table: Currently available processing power Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

55 Parallelization Speed things up III Name CPU Price GFLOPS ratio Top Dell OptiPlex780 C2D Dell Workstation 2xXeon EUR PC NVIDIA GT EUR PC NVIDIA GTX Table: Currently available processing power Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

56 Parallelization Speed things up III Name CPU Price GFLOPS ratio Top Dell OptiPlex780 C2D Dell Workstation 2xXeon EUR PC NVIDIA GT EUR PC NVIDIA GTX EUR PC ATI EUR PC 3xATI Table: Currently available processing power Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

57 Parallelization net performance gains Test N CPU time GPU time Speed Up exp(a) 1600x A.*B 1600x Black-Scholes A*B 1600x FFT(A) 1600x Table: average performance gains GTX8800 (512) vs C2D (23) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

58 Parallelization CUDA CUDA is a C SDK CUDA Framework is written and accessed in C works on all supported graphics cards without code changes Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

59 Parallelization CUDA - How does it look? Look at the code for vector addition Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

60 Parallelization Why Matlab? C (90 % of code on how to do things, 10% on what to do) > CS are better at this than Economists! Matlab (0% of code on how, 100% on what to do) my requirements: hide CUDA-API take care of low level stuff Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

61 Parallelization Why Matlab? Matlab GPU plugins requirements: tap into GPU power w/o GPU knowledge execute Matlab code on the GPU transparently ability to port code construct new functions that work on the GPU w/o deep CUDA knowledge Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

62 Parallelization GPUmat and Alternatives MathWorks is working on it (closed registration) AcceleratorEyes Jacket - closed source (hard to fix) ($350+) GPUlib - open source, tedious memory management GPUmat - free for academic use, early development stage Mathematica CUDA plugin (alpha) R (R+GPU) plugin (beta) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

63 Parallelization How to tap into the GPU-Power adjust your algorithms (sequential to parallel) check your graphics card (5min) install CUDA Framework (5min) install CUDA Matlab Plugin (3min) unzip GPUmat Framework (2min) (private beta, public end of June) run GPUstart.m Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

64 Parallelization How to use GPUmat Matlab Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

65 Parallelization Laptop CPU Core i5m 21 GFLOPS GPU GT330M 182 GFLOPS Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

66 Parallelization net performance gains Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

67 Parallelization Backup Slides Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

68 Perturbation Perturbation Assume we know the solution, plug the assumed solution back into the system, then perturbate the system using total differentials. The previous step will impose some restrictions on the system Use those restrictions to parameterize the assumed solution. Done! Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

69 Perturbation The model in equilibrium [ 1 Consumption Euler equation: c t = βe t Labor Euler equation: c t = 1 α φ z tkt α n α t ( 1 c t+1 αz t+1 k α 1 Budget constraint: c t + k t+1 = z t kt α n 1 α t + (1 δ)k t Productivity shock: z t+1 = ρz t + σɛ t+1 t+1 n1 α Endogenous state variable, k t, exogenous state variable, z t, endogenous variables, c t, n t There are four equations, four unknowns t δ )] Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

70 Perturbation The assumed solution Assume the following solution c t = c(k t, z t, σ) n t = n(k t, z t, σ) k t+1 = k(k t, z t, σ) The productivity shock implies z t+1 = z(z t, σ), so that c t+1 = c(k(k t, z t, σ), z(z t, σ), σ) n t+1 = n(k(k t, z t, σ), z(z t, σ), σ) }{{}}{{} k t+1 z t+1 Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

71 Perturbation Solving for steady state The assumed solution in steady state takes form of c = c(k, z, 0) n = n(k, z, 0) k = k(k, z, 0) They can be solved using given parameter values, all Euler equations and constraints in steady state σ = 0 in steady state, meaning there is no uncertainty Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

72 Perturbation Solving for dynamics Example: c t + k t+1 z t k α t n 1 α t (1 δ)k t = 0 Plug in the solution c(k t, z t, σ) + k(k t, z t, σ) z t k α t n(k t, z t, σ) 1 α (1 δ)k t = 0 In general F (k t, z t, σ) = 0 First order total differential DF = D0 = 0, or F k dk t + F zdz t + F σdσ = 0 dk ] t Equivalently, [F k F z F σ dz t = 0 dσ To allow arbitrary change in k t, z t, σ (equivalently, to allow dk t, dz t, dσ to take any value), we require F k = F z = F σ = 0 Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

73 Perturbation Solving for dynamics Euqation c(k t, z t, σ) + k(k t, z t, σ) z t k α t n(k t, z t, σ) 1 α (1 δ)k t = 0 To find F k, first find F kt, then evaluate F kt at steady state, F kt = c k (k t, z t, σ) + k k (k t, z t, σ) αz t k α 1 t n(k t, z t, σ) 1 α (1 α)z t k α t n(k t, z t, σ) α n k (k t, z t, σ) (1 δ) Evaluate F kt at steady state, using F k = 0, F k = c k + k k αzk α 1 n 1 α (1 α)zk α n α n k (1 δ) = 0 Similarly, for F z and F σ, we have F z = c z + k z k α n 1 α (1 α)zk α n α n z = 0 F σ = c σ + k σ (1 α)zk α n α n σ = 0 Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

74 Perturbation Solving for dynamics Apply the same procedure to consumption and labor Euler equations, we can altogether obtain 9 equations for 9 unknowns 9 unknowns are (c k, c z, c σ, k k, k z, k σ, n k, n z, n σ) In first order perturbation, (c σ, k σ, n σ) are always zero, because by requiring F k = F z = F σ = 0, we only allow changes to happen in these three basic directions, σ has no impact until we allow changes to happen along some composite directions, i.e. F kk, F zz. The 9 unknowns can be used to construct the first order approximation of the assumed solution c t = c + c k (c t c) + c z(z t z) n t = n + n k (c t c) + n z(z t z) k t+1 = k + k k (c t c) + k z(z t z) Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

75 Perturbation A short summary Perturbation is still a local approximation method Using total differential and derivatives means we observe the model s behavior in the neighborhood of the equilibrium Using higher order perturbation, we can observe the model s behavior when changes happen along all directions around the equilibrium Schmitt-Grohe and Uribe (2004) s code of perturbation is efficient, because it takes analytic derivatives first Early version of Dynare takes numerical derivatives, that is why it crashes often Patrick Bunk and Hong Lan (SFB C7 Humboldt Matlab University Programming of Berlin) and Quantitative Economic Theory June 4, / 69

High-dimensional Problems in Finance and Economics. Thomas M. Mertens

High-dimensional Problems in Finance and Economics. Thomas M. Mertens High-dimensional Problems in Finance and Economics Thomas M. Mertens NYU Stern Risk Economics Lab April 17, 2012 1 / 78 Motivation Many problems in finance and economics are high dimensional. Dynamic Optimization:

More information

Solution Methods. Jesús Fernández-Villaverde. University of Pennsylvania. March 16, 2016

Solution Methods. Jesús Fernández-Villaverde. University of Pennsylvania. March 16, 2016 Solution Methods Jesús Fernández-Villaverde University of Pennsylvania March 16, 2016 Jesús Fernández-Villaverde (PENN) Solution Methods March 16, 2016 1 / 36 Functional equations A large class of problems

More information

Introduction to Numerical Methods

Introduction to Numerical Methods Introduction to Numerical Methods Wouter J. Den Haan London School of Economics c by Wouter J. Den Haan "D", "S", & "GE" Dynamic Stochastic General Equilibrium What is missing in the abbreviation? DSGE

More information

(a) Write down the Hamilton-Jacobi-Bellman (HJB) Equation in the dynamic programming

(a) Write down the Hamilton-Jacobi-Bellman (HJB) Equation in the dynamic programming 1. Government Purchases and Endogenous Growth Consider the following endogenous growth model with government purchases (G) in continuous time. Government purchases enhance production, and the production

More information

HOMEWORK #3 This homework assignment is due at NOON on Friday, November 17 in Marnix Amand s mailbox.

HOMEWORK #3 This homework assignment is due at NOON on Friday, November 17 in Marnix Amand s mailbox. Econ 50a second half) Yale University Fall 2006 Prof. Tony Smith HOMEWORK #3 This homework assignment is due at NOON on Friday, November 7 in Marnix Amand s mailbox.. This problem introduces wealth inequality

More information

A simple macro dynamic model with endogenous saving rate: the representative agent model

A simple macro dynamic model with endogenous saving rate: the representative agent model A simple macro dynamic model with endogenous saving rate: the representative agent model Virginia Sánchez-Marcos Macroeconomics, MIE-UNICAN Macroeconomics (MIE-UNICAN) A simple macro dynamic model with

More information

Perturbation Methods I: Basic Results

Perturbation Methods I: Basic Results Perturbation Methods I: Basic Results (Lectures on Solution Methods for Economists V) Jesús Fernández-Villaverde 1 and Pablo Guerrón 2 March 19, 2018 1 University of Pennsylvania 2 Boston College Introduction

More information

Macroeconomics Qualifying Examination

Macroeconomics Qualifying Examination Macroeconomics Qualifying Examination August 2015 Department of Economics UNC Chapel Hill Instructions: This examination consists of 4 questions. Answer all questions. If you believe a question is ambiguously

More information

First order approximation of stochastic models

First order approximation of stochastic models First order approximation of stochastic models Shanghai Dynare Workshop Sébastien Villemot CEPREMAP October 27, 2013 Sébastien Villemot (CEPREMAP) First order approximation of stochastic models October

More information

Projection Methods. Felix Kubler 1. October 10, DBF, University of Zurich and Swiss Finance Institute

Projection Methods. Felix Kubler 1. October 10, DBF, University of Zurich and Swiss Finance Institute Projection Methods Felix Kubler 1 1 DBF, University of Zurich and Swiss Finance Institute October 10, 2017 Felix Kubler Comp.Econ. Gerzensee, Ch5 October 10, 2017 1 / 55 Motivation In many dynamic economic

More information

Asset pricing in DSGE models comparison of different approximation methods

Asset pricing in DSGE models comparison of different approximation methods Asset pricing in DSGE models comparison of different approximation methods 1 Introduction Jan Acedański 1 Abstract. There are many numerical methods suitable for approximating solutions of DSGE models.

More information

Solving a Dynamic (Stochastic) General Equilibrium Model under the Discrete Time Framework

Solving a Dynamic (Stochastic) General Equilibrium Model under the Discrete Time Framework Solving a Dynamic (Stochastic) General Equilibrium Model under the Discrete Time Framework Dongpeng Liu Nanjing University Sept 2016 D. Liu (NJU) Solving D(S)GE 09/16 1 / 63 Introduction Targets of the

More information

An Introduction to Perturbation Methods in Macroeconomics. Jesús Fernández-Villaverde University of Pennsylvania

An Introduction to Perturbation Methods in Macroeconomics. Jesús Fernández-Villaverde University of Pennsylvania An Introduction to Perturbation Methods in Macroeconomics Jesús Fernández-Villaverde University of Pennsylvania 1 Introduction Numerous problems in macroeconomics involve functional equations of the form:

More information

Stochastic simulations with DYNARE. A practical guide.

Stochastic simulations with DYNARE. A practical guide. Stochastic simulations with DYNARE. A practical guide. Fabrice Collard (GREMAQ, University of Toulouse) Adapted for Dynare 4.1 by Michel Juillard and Sébastien Villemot (CEPREMAP) First draft: February

More information

Suggested Solutions to Homework #6 Econ 511b (Part I), Spring 2004

Suggested Solutions to Homework #6 Econ 511b (Part I), Spring 2004 Suggested Solutions to Homework #6 Econ 511b (Part I), Spring 2004 1. (a) Find the planner s optimal decision rule in the stochastic one-sector growth model without valued leisure by linearizing the Euler

More information

Lecture 15. Dynamic Stochastic General Equilibrium Model. Randall Romero Aguilar, PhD I Semestre 2017 Last updated: July 3, 2017

Lecture 15. Dynamic Stochastic General Equilibrium Model. Randall Romero Aguilar, PhD I Semestre 2017 Last updated: July 3, 2017 Lecture 15 Dynamic Stochastic General Equilibrium Model Randall Romero Aguilar, PhD I Semestre 2017 Last updated: July 3, 2017 Universidad de Costa Rica EC3201 - Teoría Macroeconómica 2 Table of contents

More information

Practical Dynamic Programming: An Introduction. Associated programs dpexample.m: deterministic dpexample2.m: stochastic

Practical Dynamic Programming: An Introduction. Associated programs dpexample.m: deterministic dpexample2.m: stochastic Practical Dynamic Programming: An Introduction Associated programs dpexample.m: deterministic dpexample2.m: stochastic Outline 1. Specific problem: stochastic model of accumulation from a DP perspective

More information

Macroeconomics Theory II

Macroeconomics Theory II Macroeconomics Theory II Francesco Franco FEUNL February 2016 Francesco Franco (FEUNL) Macroeconomics Theory II February 2016 1 / 18 Road Map Research question: we want to understand businesses cycles.

More information

1 The Basic RBC Model

1 The Basic RBC Model IHS 2016, Macroeconomics III Michael Reiter Ch. 1: Notes on RBC Model 1 1 The Basic RBC Model 1.1 Description of Model Variables y z k L c I w r output level of technology (exogenous) capital at end of

More information

Topic 2. Consumption/Saving and Productivity shocks

Topic 2. Consumption/Saving and Productivity shocks 14.452. Topic 2. Consumption/Saving and Productivity shocks Olivier Blanchard April 2006 Nr. 1 1. What starting point? Want to start with a model with at least two ingredients: Shocks, so uncertainty.

More information

problem. max Both k (0) and h (0) are given at time 0. (a) Write down the Hamilton-Jacobi-Bellman (HJB) Equation in the dynamic programming

problem. max Both k (0) and h (0) are given at time 0. (a) Write down the Hamilton-Jacobi-Bellman (HJB) Equation in the dynamic programming 1. Endogenous Growth with Human Capital Consider the following endogenous growth model with both physical capital (k (t)) and human capital (h (t)) in continuous time. The representative household solves

More information

Competitive Equilibrium and the Welfare Theorems

Competitive Equilibrium and the Welfare Theorems Competitive Equilibrium and the Welfare Theorems Craig Burnside Duke University September 2010 Craig Burnside (Duke University) Competitive Equilibrium September 2010 1 / 32 Competitive Equilibrium and

More information

Slides II - Dynamic Programming

Slides II - Dynamic Programming Slides II - Dynamic Programming Julio Garín University of Georgia Macroeconomic Theory II (Ph.D.) Spring 2017 Macroeconomic Theory II Slides II - Dynamic Programming Spring 2017 1 / 32 Outline 1. Lagrangian

More information

Projection. Wouter J. Den Haan London School of Economics. c by Wouter J. Den Haan

Projection. Wouter J. Den Haan London School of Economics. c by Wouter J. Den Haan Projection Wouter J. Den Haan London School of Economics c by Wouter J. Den Haan Model [ ] ct ν = E t βct+1 ν αz t+1kt+1 α 1 c t + k t+1 = z t k α t ln(z t+1 ) = ρ ln (z t ) + ε t+1 ε t+1 N(0, σ 2 ) k

More information

Suggested Solutions to Homework #3 Econ 511b (Part I), Spring 2004

Suggested Solutions to Homework #3 Econ 511b (Part I), Spring 2004 Suggested Solutions to Homework #3 Econ 5b (Part I), Spring 2004. Consider an exchange economy with two (types of) consumers. Type-A consumers comprise fraction λ of the economy s population and type-b

More information

Neoclassical Business Cycle Model

Neoclassical Business Cycle Model Neoclassical Business Cycle Model Prof. Eric Sims University of Notre Dame Fall 2015 1 / 36 Production Economy Last time: studied equilibrium in an endowment economy Now: study equilibrium in an economy

More information

Equilibrium in a Production Economy

Equilibrium in a Production Economy Equilibrium in a Production Economy Prof. Eric Sims University of Notre Dame Fall 2012 Sims (ND) Equilibrium in a Production Economy Fall 2012 1 / 23 Production Economy Last time: studied equilibrium in

More information

ECON607 Fall 2010 University of Hawaii Professor Hui He TA: Xiaodong Sun Assignment 2

ECON607 Fall 2010 University of Hawaii Professor Hui He TA: Xiaodong Sun Assignment 2 ECON607 Fall 200 University of Hawaii Professor Hui He TA: Xiaodong Sun Assignment 2 The due date for this assignment is Tuesday, October 2. ( Total points = 50). (Two-sector growth model) Consider the

More information

Projection Methods. Michal Kejak CERGE CERGE-EI ( ) 1 / 29

Projection Methods. Michal Kejak CERGE CERGE-EI ( ) 1 / 29 Projection Methods Michal Kejak CERGE CERGE-EI ( ) 1 / 29 Introduction numerical methods for dynamic economies nite-di erence methods initial value problems (Euler method) two-point boundary value problems

More information

1 Recursive Competitive Equilibrium

1 Recursive Competitive Equilibrium Feb 5th, 2007 Let s write the SPP problem in sequence representation: max {c t,k t+1 } t=0 β t u(f(k t ) k t+1 ) t=0 k 0 given Because of the INADA conditions we know that the solution is interior. So

More information

Introduction to Real Business Cycles: The Solow Model and Dynamic Optimization

Introduction to Real Business Cycles: The Solow Model and Dynamic Optimization Introduction to Real Business Cycles: The Solow Model and Dynamic Optimization Vivaldo Mendes a ISCTE IUL Department of Economics 24 September 2017 (Vivaldo M. Mendes ) Macroeconomics (M8674) 24 September

More information

Solutions for Homework #4

Solutions for Homework #4 Econ 50a (second half) Prof: Tony Smith TA: Theodore Papageorgiou Fall 2004 Yale University Dept. of Economics Solutions for Homework #4 Question (a) A Recursive Competitive Equilibrium for the economy

More information

Dynare Class on Heathcote-Perri JME 2002

Dynare Class on Heathcote-Perri JME 2002 Dynare Class on Heathcote-Perri JME 2002 Tim Uy University of Cambridge March 10, 2015 Introduction Solving DSGE models used to be very time consuming due to log-linearization required Dynare is a collection

More information

Appendices to: Revisiting the Welfare Effects of Eliminating Business Cycles

Appendices to: Revisiting the Welfare Effects of Eliminating Business Cycles Appendices to: Revisiting the Welfare Effects of Eliminating Business Cycles Per Krusell Toshihiko Mukoyama Ayşegül Şahin Anthony A. Smith, Jr. December 2008 A The integration principle applied to the

More information

... Solving Dynamic General Equilibrium Models Using Log Linear Approximation

... Solving Dynamic General Equilibrium Models Using Log Linear Approximation ... Solving Dynamic General Equilibrium Models Using Log Linear Approximation 1 Log-linearization strategy Example #1: A Simple RBC Model. Define a Model Solution Motivate the Need to Somehow Approximate

More information

A comparison of numerical methods for the. Solution of continuous-time DSGE models. Juan Carlos Parra Alvarez

A comparison of numerical methods for the. Solution of continuous-time DSGE models. Juan Carlos Parra Alvarez A comparison of numerical methods for the solution of continuous-time DSGE models Juan Carlos Parra Alvarez Department of Economics and Business, and CREATES Aarhus University, Denmark November 14, 2012

More information

Lecture 7: Stochastic Dynamic Programing and Markov Processes

Lecture 7: Stochastic Dynamic Programing and Markov Processes Lecture 7: Stochastic Dynamic Programing and Markov Processes Florian Scheuer References: SLP chapters 9, 10, 11; LS chapters 2 and 6 1 Examples 1.1 Neoclassical Growth Model with Stochastic Technology

More information

1 Bewley Economies with Aggregate Uncertainty

1 Bewley Economies with Aggregate Uncertainty 1 Bewley Economies with Aggregate Uncertainty Sofarwehaveassumedawayaggregatefluctuations (i.e., business cycles) in our description of the incomplete-markets economies with uninsurable idiosyncratic risk

More information

Applications for solving DSGE models. October 25th, 2011

Applications for solving DSGE models. October 25th, 2011 MATLAB Workshop Applications for solving DSGE models Freddy Rojas Cama Marola Castillo Quinto Preliminary October 25th, 2011 A model to solve The model The model A model is set up in order to draw conclusions

More information

Dynamic Discrete Choice Structural Models in Empirical IO

Dynamic Discrete Choice Structural Models in Empirical IO Dynamic Discrete Choice Structural Models in Empirical IO Lecture 4: Euler Equations and Finite Dependence in Dynamic Discrete Choice Models Victor Aguirregabiria (University of Toronto) Carlos III, Madrid

More information

Value Function Iteration

Value Function Iteration Value Function Iteration (Lectures on Solution Methods for Economists II) Jesús Fernández-Villaverde 1 and Pablo Guerrón 2 February 26, 2018 1 University of Pennsylvania 2 Boston College Theoretical Background

More information

Comprehensive Exam. Macro Spring 2014 Retake. August 22, 2014

Comprehensive Exam. Macro Spring 2014 Retake. August 22, 2014 Comprehensive Exam Macro Spring 2014 Retake August 22, 2014 You have a total of 180 minutes to complete the exam. If a question seems ambiguous, state why, sharpen it up and answer the sharpened-up question.

More information

DSGE-Models. Calibration and Introduction to Dynare. Institute of Econometrics and Economic Statistics

DSGE-Models. Calibration and Introduction to Dynare. Institute of Econometrics and Economic Statistics DSGE-Models Calibration and Introduction to Dynare Dr. Andrea Beccarini Willi Mutschler, M.Sc. Institute of Econometrics and Economic Statistics willi.mutschler@uni-muenster.de Summer 2012 Willi Mutschler

More information

Foundation of (virtually) all DSGE models (e.g., RBC model) is Solow growth model

Foundation of (virtually) all DSGE models (e.g., RBC model) is Solow growth model THE BASELINE RBC MODEL: THEORY AND COMPUTATION FEBRUARY, 202 STYLIZED MACRO FACTS Foundation of (virtually all DSGE models (e.g., RBC model is Solow growth model So want/need/desire business-cycle models

More information

1. Using the model and notations covered in class, the expected returns are:

1. Using the model and notations covered in class, the expected returns are: Econ 510a second half Yale University Fall 2006 Prof. Tony Smith HOMEWORK #5 This homework assignment is due at 5PM on Friday, December 8 in Marnix Amand s mailbox. Solution 1. a In the Mehra-Prescott

More information

Perturbation Methods

Perturbation Methods Perturbation Methods Jesús Fernández-Villaverde University of Pennsylvania May 28, 2015 Jesús Fernández-Villaverde (PENN) Perturbation Methods May 28, 2015 1 / 91 Introduction Introduction Remember that

More information

Graduate Macroeconomics - Econ 551

Graduate Macroeconomics - Econ 551 Graduate Macroeconomics - Econ 551 Tack Yun Indiana University Seoul National University Spring Semester January 2013 T. Yun (SNU) Macroeconomics 1/07/2013 1 / 32 Business Cycle Models for Emerging-Market

More information

Projection Methods. (Lectures on Solution Methods for Economists IV) Jesús Fernández-Villaverde 1 and Pablo Guerrón 2 March 7, 2018

Projection Methods. (Lectures on Solution Methods for Economists IV) Jesús Fernández-Villaverde 1 and Pablo Guerrón 2 March 7, 2018 Projection Methods (Lectures on Solution Methods for Economists IV) Jesús Fernández-Villaverde 1 and Pablo Guerrón 2 March 7, 2018 1 University of Pennsylvania 2 Boston College Introduction Remember that

More information

Course 16:198:520: Introduction To Artificial Intelligence Lecture 13. Decision Making. Abdeslam Boularias. Wednesday, December 7, 2016

Course 16:198:520: Introduction To Artificial Intelligence Lecture 13. Decision Making. Abdeslam Boularias. Wednesday, December 7, 2016 Course 16:198:520: Introduction To Artificial Intelligence Lecture 13 Decision Making Abdeslam Boularias Wednesday, December 7, 2016 1 / 45 Overview We consider probabilistic temporal models where the

More information

Dynamic (Stochastic) General Equilibrium and Growth

Dynamic (Stochastic) General Equilibrium and Growth Dynamic (Stochastic) General Equilibrium and Growth Martin Ellison Nuffi eld College Michaelmas Term 2018 Martin Ellison (Nuffi eld) D(S)GE and Growth Michaelmas Term 2018 1 / 43 Macroeconomics is Dynamic

More information

DYNARE SUMMER SCHOOL

DYNARE SUMMER SCHOOL DYNARE SUMMER SCHOOL Introduction to Dynare and local approximation. Michel Juillard June 12, 2017 Summer School website http://www.dynare.org/summerschool/2017 DYNARE 1. computes the solution of deterministic

More information

Solving Heterogeneous Agent Models with Dynare

Solving Heterogeneous Agent Models with Dynare Solving Heterogeneous Agent Models with Dynare Wouter J. Den Haan University of Amsterdam March 12, 2009 Individual agent Subject to employment, i.e., labor supply shocks: e i,t = ρ e e i,t 1 + ε i,t ε

More information

Productivity Losses from Financial Frictions: Can Self-financing Undo Capital Misallocation?

Productivity Losses from Financial Frictions: Can Self-financing Undo Capital Misallocation? Productivity Losses from Financial Frictions: Can Self-financing Undo Capital Misallocation? Benjamin Moll G Online Appendix: The Model in Discrete Time and with iid Shocks This Appendix presents a version

More information

Public Economics The Macroeconomic Perspective Chapter 2: The Ramsey Model. Burkhard Heer University of Augsburg, Germany

Public Economics The Macroeconomic Perspective Chapter 2: The Ramsey Model. Burkhard Heer University of Augsburg, Germany Public Economics The Macroeconomic Perspective Chapter 2: The Ramsey Model Burkhard Heer University of Augsburg, Germany October 3, 2018 Contents I 1 Central Planner 2 3 B. Heer c Public Economics: Chapter

More information

HOMEWORK #1 This homework assignment is due at 5PM on Friday, November 3 in Marnix Amand s mailbox.

HOMEWORK #1 This homework assignment is due at 5PM on Friday, November 3 in Marnix Amand s mailbox. Econ 50a (second half) Yale University Fall 2006 Prof. Tony Smith HOMEWORK # This homework assignment is due at 5PM on Friday, November 3 in Marnix Amand s mailbox.. Consider a growth model with capital

More information

Economic Growth: Lecture 13, Stochastic Growth

Economic Growth: Lecture 13, Stochastic Growth 14.452 Economic Growth: Lecture 13, Stochastic Growth Daron Acemoglu MIT December 10, 2013. Daron Acemoglu (MIT) Economic Growth Lecture 13 December 10, 2013. 1 / 52 Stochastic Growth Models Stochastic

More information

Suggested Solutions to Problem Set 2

Suggested Solutions to Problem Set 2 Macroeconomic Theory, Fall 03 SEF, HKU Instructor: Dr. Yulei Luo October 03 Suggested Solutions to Problem Set. 0 points] Consider the following Ramsey-Cass-Koopmans model with fiscal policy. First, we

More information

Economics 210B Due: September 16, Problem Set 10. s.t. k t+1 = R(k t c t ) for all t 0, and k 0 given, lim. and

Economics 210B Due: September 16, Problem Set 10. s.t. k t+1 = R(k t c t ) for all t 0, and k 0 given, lim. and Economics 210B Due: September 16, 2010 Problem 1: Constant returns to saving Consider the following problem. c0,k1,c1,k2,... β t Problem Set 10 1 α c1 α t s.t. k t+1 = R(k t c t ) for all t 0, and k 0

More information

Solving Models with Heterogeneous Agents Xpa algorithm

Solving Models with Heterogeneous Agents Xpa algorithm Solving Models with Heterogeneous Agents Xpa algorithm Wouter J. Den Haan London School of Economics c by Wouter J. Den Haan Individual agent Subject to employment shocks ε i,t {0, 1} or ε i,t {u, e} Incomplete

More information

Small Open Economy RBC Model Uribe, Chapter 4

Small Open Economy RBC Model Uribe, Chapter 4 Small Open Economy RBC Model Uribe, Chapter 4 1 Basic Model 1.1 Uzawa Utility E 0 t=0 θ t U (c t, h t ) θ 0 = 1 θ t+1 = β (c t, h t ) θ t ; β c < 0; β h > 0. Time-varying discount factor With a constant

More information

1 Jan 28: Overview and Review of Equilibrium

1 Jan 28: Overview and Review of Equilibrium 1 Jan 28: Overview and Review of Equilibrium 1.1 Introduction What is an equilibrium (EQM)? Loosely speaking, an equilibrium is a mapping from environments (preference, technology, information, market

More information

Lecture 1. Evolution of Market Concentration

Lecture 1. Evolution of Market Concentration Lecture 1 Evolution of Market Concentration Take a look at : Doraszelski and Pakes, A Framework for Applied Dynamic Analysis in IO, Handbook of I.O. Chapter. (see link at syllabus). Matt Shum s notes are

More information

Dynamic stochastic game and macroeconomic equilibrium

Dynamic stochastic game and macroeconomic equilibrium Dynamic stochastic game and macroeconomic equilibrium Tianxiao Zheng SAIF 1. Introduction We have studied single agent problems. However, macro-economy consists of a large number of agents including individuals/households,

More information

Monetary Economics: Solutions Problem Set 1

Monetary Economics: Solutions Problem Set 1 Monetary Economics: Solutions Problem Set 1 December 14, 2006 Exercise 1 A Households Households maximise their intertemporal utility function by optimally choosing consumption, savings, and the mix of

More information

Solving Models with Heterogeneous Agents: Reiter Hybrid Method

Solving Models with Heterogeneous Agents: Reiter Hybrid Method Solving Models with Heterogeneous Agents: Reiter Hybrid Method Wouter J. Den Haan London School of Economics c Wouter J. Den Haan Background Macroeconomic models with heterogeneous agents: idiosyncratic

More information

Risk Matters: Breaking Certainty Equivalence

Risk Matters: Breaking Certainty Equivalence Risk Matters: Breaking Certainty Equivalence Juan Carlos Parra-Alvarez (a,c), Hamza Polattimur (b), and Olaf Posch (b,c) (a) Aarhus University, (b) Universität Hamburg, (c) CREATES February 2017 Abstract

More information

Dynare. Wouter J. Den Haan London School of Economics. c by Wouter J. Den Haan

Dynare. Wouter J. Den Haan London School of Economics. c by Wouter J. Den Haan Dynare Wouter J. Den Haan London School of Economics c by Wouter J. Den Haan Introduction What is the objective of perturbation? Peculiarities of Dynare & some examples Incorporating Dynare in other Matlab

More information

Stochastic Problems. 1 Examples. 1.1 Neoclassical Growth Model with Stochastic Technology. 1.2 A Model of Job Search

Stochastic Problems. 1 Examples. 1.1 Neoclassical Growth Model with Stochastic Technology. 1.2 A Model of Job Search Stochastic Problems References: SLP chapters 9, 10, 11; L&S chapters 2 and 6 1 Examples 1.1 Neoclassical Growth Model with Stochastic Technology Production function y = Af k where A is random Let A s t

More information

UNIVERSITY OF WISCONSIN DEPARTMENT OF ECONOMICS MACROECONOMICS THEORY Preliminary Exam August 1, :00 am - 2:00 pm

UNIVERSITY OF WISCONSIN DEPARTMENT OF ECONOMICS MACROECONOMICS THEORY Preliminary Exam August 1, :00 am - 2:00 pm UNIVERSITY OF WISCONSIN DEPARTMENT OF ECONOMICS MACROECONOMICS THEORY Preliminary Exam August 1, 2017 9:00 am - 2:00 pm INSTRUCTIONS Please place a completed label (from the label sheet provided) on the

More information

Optimal Inflation Stabilization in a Medium-Scale Macroeconomic Model

Optimal Inflation Stabilization in a Medium-Scale Macroeconomic Model Optimal Inflation Stabilization in a Medium-Scale Macroeconomic Model Stephanie Schmitt-Grohé Martín Uribe Duke University 1 Objective of the Paper: Within a mediumscale estimated model of the macroeconomy

More information

Economics 701 Advanced Macroeconomics I Project 1 Professor Sanjay Chugh Fall 2011

Economics 701 Advanced Macroeconomics I Project 1 Professor Sanjay Chugh Fall 2011 Department of Economics University of Maryland Economics 701 Advanced Macroeconomics I Project 1 Professor Sanjay Chugh Fall 2011 Objective As a stepping stone to learning how to work with and computationally

More information

Applications of Mathematical Economics

Applications of Mathematical Economics Applications of Mathematical Economics Michael Curran Trinity College Dublin Overview Introduction. Data Preparation Filters. Dynamic Stochastic General Equilibrium Models: Sunspots and Blanchard-Kahn

More information

The Real Business Cycle Model

The Real Business Cycle Model The Real Business Cycle Model Macroeconomics II 2 The real business cycle model. Introduction This model explains the comovements in the fluctuations of aggregate economic variables around their trend.

More information

Fluctuations. Shocks, Uncertainty, and the Consumption/Saving Choice

Fluctuations. Shocks, Uncertainty, and the Consumption/Saving Choice Fluctuations. Shocks, Uncertainty, and the Consumption/Saving Choice Olivier Blanchard April 2002 14.452. Spring 2002. Topic 2. 14.452. Spring, 2002 2 Want to start with a model with two ingredients: ²

More information

Session 2 Working with Dynare

Session 2 Working with Dynare Session 2 Working with Dynare Seminar: Macroeconomics and International Economics Philipp Wegmüller UniBern Spring 2015 Philipp Wegmüller (UniBern) Session 2 Working with Dynare Spring 2015 1 / 20 Dynare

More information

Macroeconomics Qualifying Examination

Macroeconomics Qualifying Examination Macroeconomics Qualifying Examination January 2016 Department of Economics UNC Chapel Hill Instructions: This examination consists of 3 questions. Answer all questions. If you believe a question is ambiguously

More information

Lecture 2 The Centralized Economy

Lecture 2 The Centralized Economy Lecture 2 The Centralized Economy Economics 5118 Macroeconomic Theory Kam Yu Winter 2013 Outline 1 Introduction 2 The Basic DGE Closed Economy 3 Golden Rule Solution 4 Optimal Solution The Euler Equation

More information

When Inequality Matters for Macro and Macro Matters for Inequality

When Inequality Matters for Macro and Macro Matters for Inequality When Inequality Matters for Macro and Macro Matters for Inequality SeHyoun Ahn Princeton Benjamin Moll Princeton Greg Kaplan Chicago Tom Winberry Chicago Christian Wolf Princeton STLAR Conference, 21 April

More information

Lecture 6: Discrete-Time Dynamic Optimization

Lecture 6: Discrete-Time Dynamic Optimization Lecture 6: Discrete-Time Dynamic Optimization Yulei Luo Economics, HKU November 13, 2017 Luo, Y. (Economics, HKU) ECON0703: ME November 13, 2017 1 / 43 The Nature of Optimal Control In static optimization,

More information

Problem Set 4. Graduate Macro II, Spring 2011 The University of Notre Dame Professor Sims

Problem Set 4. Graduate Macro II, Spring 2011 The University of Notre Dame Professor Sims Problem Set 4 Graduate Macro II, Spring 2011 The University of Notre Dame Professor Sims Instructions: You may consult with other members of the class, but please make sure to turn in your own work. Where

More information

"0". Doing the stuff on SVARs from the February 28 slides

0. Doing the stuff on SVARs from the February 28 slides Monetary Policy, 7/3 2018 Henrik Jensen Department of Economics University of Copenhagen "0". Doing the stuff on SVARs from the February 28 slides 1. Money in the utility function (start) a. The basic

More information

Econometrics III: Problem Set # 2 Single Agent Dynamic Discrete Choice

Econometrics III: Problem Set # 2 Single Agent Dynamic Discrete Choice Holger Sieg Carnegie Mellon University Econometrics III: Problem Set # 2 Single Agent Dynamic Discrete Choice INSTRUCTIONS: This problem set was originally created by Ron Goettler. The objective of this

More information

Markov Perfect Equilibria in the Ramsey Model

Markov Perfect Equilibria in the Ramsey Model Markov Perfect Equilibria in the Ramsey Model Paul Pichler and Gerhard Sorger This Version: February 2006 Abstract We study the Ramsey (1928) model under the assumption that households act strategically.

More information

Ergodicity and Non-Ergodicity in Economics

Ergodicity and Non-Ergodicity in Economics Abstract An stochastic system is called ergodic if it tends in probability to a limiting form that is independent of the initial conditions. Breakdown of ergodicity gives rise to path dependence. We illustrate

More information

MA Advanced Macroeconomics: 7. The Real Business Cycle Model

MA Advanced Macroeconomics: 7. The Real Business Cycle Model MA Advanced Macroeconomics: 7. The Real Business Cycle Model Karl Whelan School of Economics, UCD Spring 2016 Karl Whelan (UCD) Real Business Cycles Spring 2016 1 / 38 Working Through A DSGE Model We have

More information

A Quick Introduction to Numerical Methods

A Quick Introduction to Numerical Methods Chapter 5 A Quick Introduction to Numerical Methods One of the main advantages of the recursive approach is that we can use the computer to solve numerically interesting models. There is a wide variety

More information

Nonlinear Solution of Heterogeneous Agent Models by Approximate Aggregation

Nonlinear Solution of Heterogeneous Agent Models by Approximate Aggregation Nonlinear Solution of Heterogeneous Agent Models by Approximate Aggregation Michael Reiter, Institute for Advanced Studies, Vienna February 21 Abstract The paper deals with the computation of DSGE models

More information

Bayesian Estimation of DSGE Models: Lessons from Second-order Approximations

Bayesian Estimation of DSGE Models: Lessons from Second-order Approximations Bayesian Estimation of DSGE Models: Lessons from Second-order Approximations Sungbae An Singapore Management University Bank Indonesia/BIS Workshop: STRUCTURAL DYNAMIC MACROECONOMIC MODELS IN ASIA-PACIFIC

More information

University of Warwick, EC9A0 Maths for Economists Lecture Notes 10: Dynamic Programming

University of Warwick, EC9A0 Maths for Economists Lecture Notes 10: Dynamic Programming University of Warwick, EC9A0 Maths for Economists 1 of 63 University of Warwick, EC9A0 Maths for Economists Lecture Notes 10: Dynamic Programming Peter J. Hammond Autumn 2013, revised 2014 University of

More information

Taking Perturbation to the Accuracy Frontier: A Hybrid of Local and Global Solutions

Taking Perturbation to the Accuracy Frontier: A Hybrid of Local and Global Solutions Dynare Working Papers Series http://www.dynare.org/wp/ Taking Perturbation to the Accuracy Frontier: A Hybrid of Local and Global Solutions Lilia Maliar Serguei Maliar Sébastien Villemot Working Paper

More information

Perturbation and Projection Methods for Solving DSGE Models

Perturbation and Projection Methods for Solving DSGE Models Perturbation and Projection Methods for Solving DSGE Models Lawrence J. Christiano Discussion of projections taken from Christiano Fisher, Algorithms for Solving Dynamic Models with Occasionally Binding

More information

Solving Deterministic Models

Solving Deterministic Models Solving Deterministic Models Shanghai Dynare Workshop Sébastien Villemot CEPREMAP October 27, 2013 Sébastien Villemot (CEPREMAP) Solving Deterministic Models October 27, 2013 1 / 42 Introduction Deterministic

More information

The Small-Open-Economy Real Business Cycle Model

The Small-Open-Economy Real Business Cycle Model The Small-Open-Economy Real Business Cycle Model Comments Some Empirical Regularities Variable Canadian Data σ xt ρ xt,x t ρ xt,gdp t y 2.8.6 c 2.5.7.59 i 9.8.3.64 h 2.54.8 tb y.9.66 -.3 Source: Mendoza

More information

Learning and Global Dynamics

Learning and Global Dynamics Learning and Global Dynamics James Bullard 10 February 2007 Learning and global dynamics The paper for this lecture is Liquidity Traps, Learning and Stagnation, by George Evans, Eran Guse, and Seppo Honkapohja.

More information

Deterministic Models

Deterministic Models Deterministic Models Perfect foreight, nonlinearities and occasionally binding constraints Sébastien Villemot CEPREMAP June 10, 2014 Sébastien Villemot (CEPREMAP) Deterministic Models June 10, 2014 1 /

More information

Graduate Macro Theory II: Notes on Quantitative Analysis in DSGE Models

Graduate Macro Theory II: Notes on Quantitative Analysis in DSGE Models Graduate Macro Theory II: Notes on Quantitative Analysis in DSGE Models Eric Sims University of Notre Dame Spring 2011 This note describes very briefly how to conduct quantitative analysis on a linearized

More information

Solution for Problem Set 3

Solution for Problem Set 3 Solution for Problem Set 3 Q. Heterogeneous Expectations. Consider following dynamic IS-LM economy in Lecture Notes 8: IS curve: y t = ar t + u t (.) where y t is output, r t is the real interest rate,

More information

Practice Questions for Mid-Term I. Question 1: Consider the Cobb-Douglas production function in intensive form:

Practice Questions for Mid-Term I. Question 1: Consider the Cobb-Douglas production function in intensive form: Practice Questions for Mid-Term I Question 1: Consider the Cobb-Douglas production function in intensive form: y f(k) = k α ; α (0, 1) (1) where y and k are output per worker and capital per worker respectively.

More information

Lecture 4 The Centralized Economy: Extensions

Lecture 4 The Centralized Economy: Extensions Lecture 4 The Centralized Economy: Extensions Leopold von Thadden University of Mainz and ECB (on leave) Advanced Macroeconomics, Winter Term 2013 1 / 36 I Motivation This Lecture considers some applications

More information

Simple New Keynesian Model without Capital. Lawrence J. Christiano

Simple New Keynesian Model without Capital. Lawrence J. Christiano Simple New Keynesian Model without Capital Lawrence J. Christiano Outline Formulate the nonlinear equilibrium conditions of the model. Need actual nonlinear conditions to study Ramsey optimal policy, even

More information