% Matlab File: implendowment.m %Chapter 1. The basic model %One good, endownment model with perfect capital mobility %This program is part of the book "Open Economy Macroeconomics in %Developing Countries" (forthcoming MIT Press) by Carlos A. Vegh. Use of %this program or modifications thereof should be acknowledged by citing %this manuscript. This program is a modification of the original %King, Plosser, and Rebelo's (1988) programs. I am grateful to Guillermo %Vuletin for his help in writing this program. % Revised: June 2007 % This program requires as input the output of Program #2, namely % the markov decision rules as summarized by Mke and H. % IMPULSE RESPONSES % The calculation of impulse reponses involves two elements. First, it is % necessary to specify initial conditions for the controlled state(k). Second, % one needs to specify an values of the exogenous variables, i.e., % an (ns+ne x 1) vector of initial conditions. Consider just % a total factor productivity shock from the steady-state position. % a y S = zeros(ns+ne,1); Key = menu('Choose a shock','a','y'); Key2 = input('Choose size of impulse '); S(Key,1) = Key2; clear Key, Key2; % S(1) = 10; % Specify the number of periods for which the impulse response is to calculated nir = 30; % Initialize the impulse response matrix IR=zeros(nir,ns+ne+ncs+nc+nf+ncs+1); % Calculate the impulse reponse for the nir periods. % Save the impulse response in the diary imp.out %diary imp.out for i=1:nir; %Index of Impulse Response Period; IR(i,1)=i; %State and Exogneous Variables; IR(i,2:ns+ne+1)=S'; %Shadow Price, Controls and Other Flows; IR(i,ns+ne+2:ns+ne+ncs+nc+nf+ncs+1)=(H*S)'; % Update the state vector:; S = Mke*S; end %'Impulse Response to Shock in Productivity' %'Ordered as Follows' %'Date K B A G p TRF Lambda theta C N I/K y y/n MPK i tb r1 r2' IR(1:nir,1:ns+ne+ncs+1); IR(1:nir,ncs+ns+ne+2:ns+ne+ncs+nc+nf+ncs+1); %diary off 'strike any key to see impulse response plots' pause plotimpendowment