function Draw_Graph %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This code draws figures 1 and 2 from the working paper: % Fiscal Policy Can reduce Unemploymewnt But There is a Better Alternative % (c) Roger E. A. Farmer, departyment of Economics UCLA % May 5 2009: Corrected May 22nd RF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Choose parameters in the function set params opt=findopt; % The function opt finds the social optimum pkstar=opt(3); thet=setparams; betaT=thet(2); % The following code generates a range of interest rate values for the graphs % You may need to adjust the upper and lower bounds if you alter the parameters % of the model. I give two possible bounds - one for pye=0.9 and one for pye=0.98 % R=1/betaT+.1:.001:1.1; % Use this for pye=0.9 R=1/betaT+.007:.0005:1.05; % Use this for pye =0.98 plot(([IR(R,pkstar);IS(R,pkstar,0,0)])',R); figure(2); G=[0;0;0]; % G,B and pk must all have the same number of values, one for each plot B=[0;0;10]; pk=[pkstar;pkstar/2;pkstar/2]; plot(([IR(R,pk);IS(R,pk,B,G)])', kron(ones(6,1),R)' ); end function thet = setparams % This function sets the parameters clear all; bet=0.97; % Rate of discount chi=0.66; % chi = 1-alpha chi is labor's share of income pye=0.98; % Survival probability betaT=(1-pye.*(1-bet.*pye))./(pye.^2); alphaT=(1-bet.*pye).*(1-pye)./(1-pye*(1-bet.*pye)); thet=[alphaT;betaT;bet;chi;pye]; end function Z = IS(R,pk,B,G) % This functions defines the IS cuvre in the % steady state if nargin<4; G=0; end if nargin<3; B=0; end if nargin<2; pk=1; end thet = setparams; alphaT=thet(1); Z=kron(ones(size(B,1),1),(alphaT.*g(R)./(1-alphaT.*g(R)))).*kron(ones(1,size(R,2)),(pk+B))... + kron(ones(1,size(R,2)),G); end function Z=IR(R,pk) % This function computes the IR curve if nargin<2; pk=1; end thet=setparams; alpha=1-thet(4); Z=kron(ones(size(B,1),1),(alphaT.*g(R)./(1-alphaT.*g(R)))).*(kron(ones(1,size(R,2)),pk)+kron(1./R,B)) + kron(ones(1,size(R,2)),G); end function x=solveforR(R) % This function is used to compute the interest % factor that supports the social optimum thet=setparams; alpha=1-thet(4); alphaT=thet(1); x= (R-1)/alpha - alphaT*g(R)/(1-alphaT*g(R)); end function y = g(R) % This defines the function g(R) from page 18 % of the paper. thet=setparams; betaT=thet(2); y=1./(1-1./(R.*betaT)); end function opt=findopt % This function computes the values of R and pk % that support the social optimum thet = setparams; Rstar=fsolve(@solveforR,1.02); alph=1-thet(4); Zstar = 0.5./(1-alph); pkstar=alph*Zstar/(Rstar-1); opt=[Zstar,Rstar,pkstar]; end