clc; format short g; clear all; close all; % import data from Excel X = importdata('econ7720_VAR_data.xls') % define variables for the VAR Y = X.data.Sheet1(:,1); % Y = log of real GDP P = X.data.Sheet1(:,2); % P = log of implicit GDP deflator PCOM = X.data.Sheet1(:,3); % PCOM = smoothed change in index of sensitive commodity prices FF = X.data.Sheet1(:,4); % FF = federal funds rate NBR = X.data.Sheet1(:,5); % TR = log of total reserves TR = X.data.Sheet1(:,6); % NBR = log of nonborrowed reserves + extended credit M1 = X.data.Sheet1(:,7); % M1 = log of M1 money stock M2 = X.data.Sheet1(:,8); % M2 = log of M2 money stock MB = X.data.Sheet1(:,9); % MB = log of M0 money stock (monetary base) % First Identification Scheme: % X1(t) = [Y(t) P(t) PCOM(t)]' S(t) = FF(t) X2(t) = [NBR(t) TR(t) M(t)]' %-------------------------------------------------------------------------- % estimate the reduced-form VAR(p) p = 4; % p = desired lag length output1 = var([Y P PCOM FF NBR TR M1],p,1) % use Sims triangular (resursive) identification procedure T = 20; % desired horizon for impulse response functions s = 1; % desired horizon for variance decompositions output2 = sims_ident(output1,T,s) % graph the identified impulse response function to a monetary shock time = [0:1:T]; n = output1.neqs; irf_Y = output2.pIRF(n*3+1,:); irf_P = output2.pIRF(n*3+2,:); irf_PCOM = output2.pIRF(n*3+3,:); irf_FF = output2.pIRF(n*3+4,:); irf_NBR = output2.pIRF(n*3+5,:); irf_TR = output2.pIRF(n*3+6,:); irf_M = output2.pIRF(n*3+7,:); figure, subplot(4,2,1) plot(time,irf_Y), title('Y'), axis([-2 T -.8 .2]), grid on subplot(4,2,2) plot(time,irf_P), title('P'), axis([-2 T -.9 .2]), grid on subplot(4,2,3) plot(time,irf_PCOM), title('PCOM'), axis([-2 T -.25 .15]), grid on subplot(4,2,4) plot(time,irf_FF), title('FF'), axis([-2 T -.6 1]), grid on subplot(4,2,5) plot(time,irf_NBR), title('NBR'), axis([-2 T -1 .8]), grid on subplot(4,2,6) plot(time,irf_TR), title('TR'), axis([-2 T -.8 .6]), grid on subplot(4,2,7) plot(time,irf_M), title('M'), axis([-2 T -.6 .3]), grid on %-------------------------------------------------------------------------- % % Second Identification Scheme: % % X1(t) = [Y(t) P(t) PCOM(t)]' S(t) = NBR(t) X2(t) = [FF(t) TR(t) M(t)]' % %-------------------------------------------------------------------------- % % estimate the reduced-form VAR(p) % p = 4; % p = desired lag length % output1 = var([Y P PCOM NBR FF TR M1],p,1) % % % use Sims triangular (resursive) identification procedure % T = 20; % desired horizon for impulse response functions % s = 1; % desired horizon for variance decompositions % output2 = sims_ident(output1,T,s) % % % graph the identified impulse response function to a monetary shock % time = [0:1:T]; % n = output1.neqs; % % irf_Y = output2.nIRF(n*3+1,:); % irf_P = output2.nIRF(n*3+2,:); % irf_PCOM = output2.nIRF(n*3+3,:); % irf_NBR = output2.nIRF(n*3+4,:); % irf_FF = output2.nIRF(n*3+5,:); % irf_TR = output2.nIRF(n*3+6,:); % irf_M = output2.nIRF(n*3+7,:); % % figure, % subplot(4,2,1) % plot(time,irf_Y), title('Y'), axis([-2 T -.6 .2]), grid on % subplot(4,2,2) % plot(time,irf_P), title('P'), axis([-2 T -.6 .2]), grid on % subplot(4,2,3) % plot(time,irf_PCOM), title('PCOM'), axis([-2 T -.20 .10]), grid on % subplot(4,2,4) % plot(time,irf_NBR), title('NBR'), axis([-2 T -2 .90]), grid on % subplot(4,2,5) % plot(time,irf_FF), title('FF'), axis([-2 T -.3 .6]), grid on % subplot(4,2,6) % plot(time,irf_TR), title('TR'), axis([-2 T -1.25 .5]), grid on % subplot(4,2,7) % plot(time,irf_M), title('M'), axis([-2 T -.75 .25]), grid on % %-------------------------------------------------------------------------- % % Third Identification Scheme: % % X1(t) = [Y(t) P(t) PCOM(t) TR(t)]' S(t) = NBR(t) X2(t) = [FF(t) M(t)]' % %-------------------------------------------------------------------------- % % estimate the reduced-form VAR(p) % p = 4; % p = desired lag length % output1 = var([Y P PCOM TR NBR FF M1],p,1) % % % use Sims triangular (resursive) identification procedure % T = 20; % desired horizon for impulse response functions % s = 1; % desired horizon for variance decompositions % output2 = sims_ident(output1,T,s) % % % graph the identified impulse response function to a monetary shock % time = [0:1:T]; % n = output1.neqs; % % irf_Y = output2.nIRF(n*4+1,:); % irf_P = output2.nIRF(n*4+2,:); % irf_PCOM = output2.nIRF(n*4+3,:); % irf_TR = output2.nIRF(n*4+4,:); % irf_NBR = output2.nIRF(n*4+5,:); % irf_FF = output2.nIRF(n*4+6,:); % irf_M = output2.nIRF(n*4+7,:); % % figure, % subplot(4,2,1) % plot(time,irf_Y), title('Y'), axis([-2 T -.8 .2]), grid on % subplot(4,2,2) % plot(time,irf_P), title('P'), axis([-2 T -.7 .2]), grid on % subplot(4,2,3) % plot(time,irf_PCOM), title('PCOM'), axis([-2 T -.2 .2]), grid on % subplot(4,2,4) % plot(time,irf_TR), title('TR'), axis([-2 T -.6 .8]), grid on % subplot(4,2,5) % plot(time,irf_NBR), title('NBR'), axis([-2 T -1.5 1]), grid on % subplot(4,2,6) % plot(time,irf_FF), title('FF'), axis([-2 T -.4 .8]), grid on % subplot(4,2,7) % plot(time,irf_M), title('M'), axis([-2 T -.5 .5]), grid on % %-------------------------------------------------------------------------- % % First Robustness Check: exclude Y(t) from policymaker's information set % % X1(t) = [P(t) PCOM(t)]' S(t) = FF(t) X2(t) = [Y(t) NBR(t) TR(t) M(t)]' % %-------------------------------------------------------------------------- % % estimate the reduced-form VAR(p) % p = 4; % p = desired lag length % output1 = var([P PCOM FF Y NBR TR M1],p,1) % % % use Sims triangular (resursive) identification procedure % T = 20; % desired horizon for impulse response functions % s = 1; % desired horizon for variance decompositions % output2 = sims_ident(output1,T,s) % % % graph the identified impulse response function to a monetary shock % time = [0:1:T]; % n = output1.neqs; % % irf_Y = output2.pIRF(n*2+4,:); % % figure, % plot(time,irf_Y), title('Y'), axis([-2 T -.8 .3]), grid on % % %-------------------------------------------------------------------------- % % Second Robustness Check: exclude PCOM(t) from the VAR altogether % % X1(t) = [Y(t) P(t)]' S(t) = FF(t) X2(t) = [NBR(t) TR(t) M(t)]' % %-------------------------------------------------------------------------- % % estimate the reduced-form VAR(p) % p = 4; % p = desired lag length % output1 = var([Y P FF NBR TR M1],p,1) % % % use Sims triangular (resursive) identification procedure % T = 20; % desired horizon for impulse response functions % s = 1; % desired horizon for variance decompositions % output2 = sims_ident(output1,T,s) % % % graph the identified impulse response function to a monetary shock % time = [0:1:T]; % n = output1.neqs; % % irf_P = output2.pIRF(n*2+2,:); % % figure, % plot(time,irf_P), title('P'), axis([-2 T -.5 .5]), grid on % %-------------------------------------------------------------------------- % % Third Robustness Check: equate policy with shocks to MB, M1, or M2 % % X1(t) = [Y(t) P(t) PCOM(t)]' S(t) = M(t) X2(t) = [FF(t) NBR(t)]' % %-------------------------------------------------------------------------- % % estimate the reduced-form VAR(p) % p = 4; % p = desired lag length % output1 = var([Y P PCOM M2 FF NBR],p,1) % % % use Sims triangular (resursive) identification procedure % T = 20; % desired horizon for impulse response functions % s = 1; % desired horizon for variance decompositions % output2 = sims_ident(output1,T,s) % % % graph the identified impulse response function to a monetary shock % time = [0:1:T]; % n = output1.neqs; % % irf_Y = output2.nIRF(n*3+1,:); % irf_P = output2.nIRF(n*3+2,:); % irf_PCOM = output2.nIRF(n*3+3,:); % irf_M = output2.nIRF(n*3+4,:); % irf_FF = output2.nIRF(n*3+5,:); % irf_NBR = output2.nIRF(n*3+6,:); % % % figure, % subplot(3,2,1) % plot(time,irf_Y), title('Y'), grid on % subplot(3,2,2) % plot(time,irf_P), title('P'), grid on % subplot(3,2,3) % plot(time,irf_PCOM), title('PCOM'), grid on % subplot(3,2,4) % plot(time,irf_M), title('M'), grid on % subplot(3,2,5) % plot(time,irf_FF), title('FF'), grid on % subplot(3,2,6) % plot(time,irf_NBR), title('NBR'), grid on % %--------------------------------------------------------------------------