%RAMSEY_MOMENTS.M produces a table of first and second moments implied by the model ``Optimal Fiscal and Monetary Policy Under Sticky Prices,'' by Stephanie Schmitt-Grohe and Martin Uribe (JET, February 2006). %(c) S. Schmitt-Grohe and M. Uribe, May 2006. clear load ramsey_run %produced by ramsey_run.m nx=size(hx,1); ny=size(gx,1); nv=nx+ny; T=100; %Simulation horizon n = 500; %number of simulated economies %VarCov matrix of exog. shocls std_matrix = diag([STD_EPSG; STD_EPSZ]); %Set initial seed randn('state',sum(100*clock)); %all variables var_cu = [controlvar_cu statevar_cu]; %Index of variables noutput = find(var_cu=='output_cu'); nh = find(var_cu=='h_cu'); nc = find(var_cu=='c_cu'); npai = find(var_cu=='pai_cu'); nr = find(var_cu=='r_cu'); ntau = find(var_cu=='tau_cu'); ng = find(var_cu=='g_cu'); nz = find(var_cu=='z_cu'); npick = [ntau npai nr noutput nh nc]; %initialize table table = zeros(numel(npick),6); for jn=1:n %Report progress jn %Initial condition x0 = zeros(nx,1); %Generate innovations shocks = sign(randn(T,size(ETAMATRIX,2))); %Generate 2nd-order accurate path of endogenous variables. [Y,X] = simu_2nd(gx, hx, gxx, hxx, gss, hss, ETAMATRIX, sig, x0, shocks); %For a first-order accurate path, replace this line with [Y,X] = simu_2nd(gx, hx, 0*gxx, 0*hxx, 0*gss, 0*hss, ETAMATRIX, sig, x0, shocks); V = [Y X]; %Standard Deviations stdV = std(V); %Correlations corrV = corrcoef(V); %Serial Correlations corrcoef([V(2:end,:) V(1:end-1,:)]); sercorrV = diag(ans(1:nv,nv+1:end)); %Steady-State Values ncontrolvar = eval(controlvar_cu)'; nstatevar = eval(statevar_cu)'; nvar = [ncontrolvar;nstatevar]; %Means meanV = mean(V)'+nvar; table_jn = [meanV(npick) stdV(npick)' sercorrV(npick) corrV(npick,noutput) corrV(npick,ng) corrV(npick,nz)]; weight_jn = 1/jn; table = table * (1-weight_jn) + table_jn * weight_jn; end %for jn table(1,1) = table(1,1)*100; table(2,1)=(table(2,1)-1)*100; table(3,1)=(table(3,1)-1)*100; table(1:3,2)=table(1:3,2)*100; table disp('NOTE') disp('Columns: (1) mean, (2) std. dev., (3) ser. corr., (4) corr. with output, (5) corr. with log(g), (6) corr. with log(z) ') disp('Rows: (1) tax rate, (2) inflation, (3) nominal interest rate, (4) output, (5) hours, (6) consumption') %Save output save ramsey_moments.mat