突然發現知乎上搜quant macro 還沒什麼資源,秉承一貫分享資源的熱情。

這裡給大家安利一波我的一個github 上傳作業包:

首頁已經做了大致介紹,並儘可能把我課上cover的內容的絕大多數相關課程和參考資料,參考程式碼都附了連結,我自己作業的Part B 部分的每一個problem set都做了參考說明和程式碼註釋, 等我明年有空了再把Part A補全修改 (flag~)

以下附一個首頁內容供關鍵詞搜尋, 等我閒下來,會好好排版這篇文章的並翻譯以下內容的再次(flag)!

Quantitative Macroeconomics, 2018-2019

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:

Jonathan Heathcote, Kjetil Storesletten, and Gianluca Violante (2009)。 Quantitative Macroeconomics with Heterogeneous Households, Annual Review of Economics

Guvenen, Fatih (2012)。 Macroeconomics with Heterogeneity: A Practical Guide, Richmond Fed QR

Per Krusell, Anthony Smith (2006)。 quantitative macroeconomic models with heterogeneous agents, Advances in Economics and Econometrics: Theory and Applications, Ninth World Congress

Textbook Reference:

Dynamic General Equilibrium Modeling, Computational Methods and Applications: with relative codes for Fortran

Applied Computational Economics and Finance: with CompEcon Toolbox for Matlab

Similar Course:

Quantitative Economics, NYU by Gianluca Violante

Solution Methods for Discrete-Time HA model with Idiosyncratic Shocks and Aggregate Uncertainty:

1. conventional VFI and PFI:

eg。1: See Part_A/PS4-solution where we practiced VFI and PFI with different improvements。

eg。2: See Part_B/PS1-solution/main。m, which I use KS algorithm(~300 minutes MATLAB)。

Notice that we use evenly-spaced grids (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)

Costs and benefits of VFI: The benefit of simple VFI is that it is very simple, but it is not very accurate and it is slow。

2. Euler Equation iteration

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

3. Endogenous Gridpoints Methods

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

eg。1: Christopher Carroll’s endogenous gridpoint method

4. Improvements made on above methods:

4.1. Linearization

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

4.2 Perturbation methods

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: see Part_B/Final Project。

eg。3 (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

See a comparison of different solution methods to solve Incomplete markets with Aggregate Risk (Krusell&Smith(1998) version):

Comparison of solutions to the incomplete markets model with aggregate uncertainty。 Wouter den Haan

4.3 Projection methods

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.4 Mixture of Perturbation and 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

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

4.5. Parameterized Expectations Algorithm (PEA)

4.6. Explicit Aggregation (Xpa)

4.7. Euler Equation iteration with projection methods

Just like previous algorithm, we still approximate Law of motion with our Perceived law of motion and update the parameters for simulation。

create state variables nodes:

Quantitative Macroeconomics(Quant Macro)資源分享

withs_t = { z_t, K_t, m_t }“ /> where

Quantitative Macroeconomics(Quant Macro)資源分享

approximate

Quantitative Macroeconomics(Quant Macro)資源分享

tranform the FOC:

Quantitative Macroeconomics(Quant Macro)資源分享

replace consumption by BC, FOC changes to:

Quantitative Macroeconomics(Quant Macro)資源分享

Quantitative Macroeconomics(Quant Macro)資源分享

where the expectation is transition matrix times each possible state would happen。

determine prices remains the same as before:

Quantitative Macroeconomics(Quant Macro)資源分享

by minimizing the error term (LHS-RHS) from Step。4:

Quantitative Macroeconomics(Quant Macro)資源分享

,we could find the best fitted parameters。