Giter Club home page Giter Club logo

quantmacro's Introduction

Quantitative Macroeconomics, 2018-2019

Economics PhD 2nd Year Course, UAB

Intro

Our course is separated into two parts.

Part A is from basic numerical methods to solution of Representative Agent Models (permanent income, life-cycle) with VFI, PFI; and eventually going to Heterogenous Agents with Incomplete Markets. In the end, we need to solve Recursive Stationary Equilibrium of the Aiyagari-Bewley-Hugget-Imrohoroglu (ABHI) Model.

Part B accesses to Krusell and Smith (1998) model (Heterogenous agents, incomplete markets and aggregate uncertainty), and defaultable sovereign debt.

Background Readings:

Textbook Reference:

Similar Course:

Quantitative Economics, NYU by Gianluca Violante


Main Strategies of solving our models:

1. conventional Value Function Iteration (VFI) and Policy Function Iteration (PFI)

VFI and PFI is the well-known basic algorithms of dynamic programming.

For Discretization, we practiced evenly-spaced grids, chebyshev polynomials (finer grids yield better approximations but are costly in terms of computer time, for algorithm containing numerical optimization and root-finding, Matlab performs worse than Python and Julia)

In our course, VFI and PFI are implemented by brute-force iteration of value function given discrete state space. Similar way could calculate decision variable by fminbnd (i.e. kp = fminbnd(@valfun,kmin,kmax); ), where since “fminbnd” assumes a continuous choice set, basically it will search over all values of kp between “kmin” and “kmax”, which will include points not in the original capital grid. For this reason, we need to interpolate values of the value function off of the grid. (i.e. g = interp1(kmat,v0,k,'linear'); val= utility(c) + beta*g;):

while dif>tol & its<maxits
   for i = 1:N
      k0 = kmat(i,1);
      k1 = fminbnd(@valfun,kmin,kmax);
      v1(i,1) =−valfun(k1);
      k11(i,1) = k1;
   end
   dif = norm(v1−v0);
   v0 = v1;
   its = its+1
end

for i = 1:N
   con(i,1) = kmat(i,1)ˆ(alpha)−k11(i,1) + (1−∆)*kmat(i,1);
   polfun(i,1) = kmat(i,1)ˆ(alpha)−k11(i,1) + (1−∆)*kmat(i,1);
end

Where the value function for a neoclassical growth model with no uncertainty and CRRA utility are calculated by interpolation.

function val=valfun(k)

global v0 beta ∆ alpha kmat k0 s

g = interp1(kmat,v0,k,'linear'); % smooths out previous value function

c = k0ˆalpha−k + (1−∆)*k0;       % consumption
if c≤0
   val =−9999−999*abs(c); % keeps it from going negative
else
   val=(1/(1−s))*(cˆ(1−s)−1) + beta*g;
end

val = −val; % make it negative since we're maximizing and code is to minimize.

eg.1: See Part_A/PS4-solution where we practiced VFI and PFI using a couple of improvements to speed up (e.g., concavity of value function, previous solution, monotonicity of decision rules).

eg.2: See Part_B/PS1-solution/main.m, which I use VFI associated with KS algorithm for solving Krusell and Smith model (~300 minutes MATLAB).

Costs and benefits of VFI and PFI: simple and have a solution for sure, but slow and inaccurate.

Some extensions:

  • Euler Equation iteration

EEI is faster than VFI (still pretty slow), but much more accurate. For EEI, we update policy function with Euler Equation.

  • Endogenous Gridpoints Methods

similar to EEI, but avoid solving non-linear equations.

eg.1: Christopher Carroll’s endogenous gridpoint method

2. Perturbation method (for more details, go to Part_B/Final Project )

Perturbation method (local) approximate the policy function around the no uncertainty case, and this can deal with large problems but require model equations be differentiable, hence, cannot deal perfectly with zero lower bound and occasionally binding constraints.

To approximate the policy function, we could apply 1st-order taylor expansion, or higher-order, and some more recent resources from Matlab toolbox, the "Automatic Differentiation" method.

eg.1: Perturbation methods of solving Krusell&Smith(1998): Solving the Incomplete Markets Model withAggregate Uncertainty Using a Perturbation Method. Kim, Kim, and Kollmann.

eg.2 (can be <10 seconds MATLAB): with the borrowing constraint replaced by a penalty function and the finite-state Markov process replaced by a stochastic process with continuous support; or the most recent work done by Christian Bayer, "Solving heterogeneous agent models in discrete time with many idiosyncratic states by perturbation methods", (with Ralph Luetticke), July 2018, CEPR DP No. 13071, MALTAB code

3. Projection methods (for more details, go to Part_B/Final Project )

eg.1: parameterization of the cross-sectional distribution: do not obtain next period's cross-sectional moments by simulation techniques,but by explicitly integrating the individual choices;

eg.2: no parameterization of the cross-sectional distribution: derives the aggregate laws of motion directly from the individual policy rules by simply aggregating them;

4. Linearization

We learned this method during our Macro II by using Dynare, billions of resources could be found via Internet.


Advanced Extensions

Perturbation + Projection methods:

I will replicate this method in my Final Project of Unit 2.

A guide to understand different methods on solving K&S model and comparisons of different solution methods to solve K&S model: Comparison of solutions to the incomplete markets model with aggregate uncertainty. Wouter den Haan

eg.1: Reiter Michael, 2009. "Solving heterogeneous-agent models by projection and perturbation," Journal of Economic Dynamics and Control, Elsevier, vol. 33(3), pages 649-665, March.

eg.2: Thomas Winberry, 2018 forthcoming. "A Method for Solving and Estimating Heterogeneous Agent Macro Models," Quantitative Economics


Parameterized Expectations Algorithm (PEA)

Explicit Aggregation (Xpa)

Euler Equation iteration with projection methods

...

quantmacro's People

Contributors

zhouweimin-econ avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.