README.txt ---------- Author: Klaus Reiner Schenk-Hoppé (klaus@schenk-hoppe.net, www.schenk-hoppe.net) and Urs Schweri (urs.schweri@bf.uzh.ch) Last update November, 2011. This file gives a brief overview of the MATLAB and C files which have been developed to carry out the calculations reported in the paper "Firm Life Cycles Under Additive Shocks" by Klaus Reiner Schenk-Hoppé (University of Leeds) and Urs Schweri (University of Zurich) The scripts are available at the web page www.schenk-hoppe.net/software.htm Preparation Steps: ------------------ Unzip the file MatlabCode.zip. Add the two subfolders "scripts" and "functions" (which are created during the unzipping) to your Matlab path. Next compile the C-code file VYOpt.c. In Matlab this is done by the command mex VYOpt.c Depending on the operation system a separate C-compiler has to be installed and configured on your system. Scripts: --------- This section describes the scripts used to obtain the results in the paper. The scripts are: 00_Production_Function.m: Plots the production function (not plotted in the paper) 01_standard_IID_case.m: Figures and calculations for sections 3.1 and 3.2 02_IID_case_with_multiple_shocks.m: Figures and calculations for section 3.3 03_Business_Cycle_various_cases.m: Figures and calculations for section 4.1 04_Business_Cycle_various_shock_sizes.m: Figures and calculations for section 4.2 05_Business_Cycle_Central_Bank_Case.m: Calculations for section 5 A typical example: ------------------ This section shows how to use the Matlab functions applied in the numerical part of the paper. The explanations should enable you to run your own examples. All parameters of the model have to be entered in a matlab structure. This looks as follows: % Functional from of the production function either CobbDouglas or Polynom param.case = 'CobbDouglas'; param.beta = 0.9; param.alpha = 0.9; param.gamma = 1.5; param.delta = 0.1; param.s = [0, 0.9]; % shocks in the two states param.p = [0.95, 0.2; % Transition matrix 0.05, 0.8]; The next step is to run the model [Vk, kOpt, Vy, kOptY] = Viterate(param, gridPoints, tol, IterMax); Input arguments: param: the above defined parameters gridPoints: Number of points in the grid tol: The maximal difference between two V has to be smaller than this to stop the algorithm. IterMax: Number of iterations to stop the algorithm Output arguments: Vk: Matrix of V depending on k and the states Vy: Matrix of V depending on y and the states kOpt: optimal capital level for every k kOptY: optimal capital level for every y Comment: the notation in the paper is done for V(y, s), i.e. Vy and kOptY. Alternatively the model can be also written as V(k, s), i.e. Vk and kOpt. Some standard plots of the model are obtained by plotY(kOptY, Vy, param) plotYSingle(kOptY, Vy, param)