%SIMU.M function [pai,R, tau, m,mf, v, vf, y, yf, c, h, d, g, S, sd, la, THETA, BETTA, A, B, fval] = simu(debt_target,yf,A,B); %[pai,R, tau, m,mf, v, vf, y, yf, c, h, d, g, S, sd, la, THETA, BETTA, A, B, fval] = simu(debt_target,yf,A,B); computes the steady state of the Ramsey equilibrium in the model of Schmitt-Grohe, Stephanie and Martin Uribe, %``Foreign Demand for Domestic Currency and The Optimal Rate of Inflation'' %Journal of Money, Credit and Banking, forthcoming. % %(c) Stephanie Schmitt-Grohe and Martin Uribe % Date: January 5, 2011 if nargin<1 debt_target = 0.20; end if nargin<2 yf = 0.06; end if nargin < 3 A = 0.0111/2; end if nargin<4 B = 0.07524; end BETTA = 1/1.04; %subjective discount factor g = 0.04; %government spending THETA = 2.90; %preference parameter U=log c + THETA log(1-h) OPTIONS = OPTIMSET('tolx',1e-15,'tolfun',1e-15); la_min = 0.01; la_max = 1; dist = 1 while dist>0.0001 la = (la_min+la_max) / 2; [vh,fval] = fsolve('findvh',[0 1/3],OPTIONS,la,yf,A,B,THETA,BETTA,g); Vs = sqrt(B/A); %satiation velocity Vmax = sqrt((1+B)/A); v = Vs + (Vmax-Vs) * abs(vh(1)) / (1+abs(vh(1))); h = abs(vh(2)) / (1+abs(vh(2))); vf = v; S=A*v+B/v-2*sqrt(A*B); Sv = A-B/v^2; GAMA = 1 + S + v*Sv; %Solving the feasibility constraint in the steady-state yields c = (h - g + yf / vf * (1-(1-v^2*Sv) / BETTA)) / (1+S); R = 1/ (1- v^2*Sv); pai = BETTA * R; m = c / v; mf = yf / vf; Uc = 1/c; Uh = -THETA / (1-h); tau = 1+Uh/Uc*GAMA; %Real government debt d = ((1+S)*c + m * (1-1/pai) - (1-tau)*h ) / (R/pai-1); %Output y = h; %Debt to GD ratio sd = d/y; if sd>debt_target la_max = la; else la_min = la end dist = abs(sd-debt_target); [R tau sd] fval pause(1) end