
clc; clear all; close all

%% This code computes the steady state of a TANK model 
% The calibration is from Gali et al. (JEEA 2007)
% Author: Valerio Nispi Landi
% First version: 10/04/2021

%% Structural Parameters (quarterly calibration)
betta=0.99;                    % discount factor
alppha=0.3;                    % elasticity of production wrt capital
epsilon=5;                    % elasticity of substitution btw differentiated goods
delta=0.025;                  % depreciation rate
sigma=1;                      % relative risk aversion
phi=0.35;                     % inverse of Frisch elasticity
eta=0.35;                     % fraction of rule-of thumb
g=0.188;                      % public spending over GDP ratio
D=1.35;                       % public debt over GDP ratio
x=0.5;                       % habit parameter
%% Steady State
pi=1;                        % inflation targeting 
y=1;                         % gdp
h=1/3;                       % hours of work
rr=1/betta;                   % real interest rate
r=pi/betta;                   % nominal interest rate
q=1;                         % marginal value of investment (in terms of lambda)  
rk=1/betta-(1-delta);         % rental rate of capital
mc=(epsilon-1)/epsilon;      % real marginal costs
k=alppha*mc*y/rk;             % capital
w=(1-alppha)*mc*y/h;          % real wage
inv=delta*k;                   % invnvestment
c=y-inv-g;                     % consumption
t_r=w*h-c;                   % r taxes
d=4*D;                       % public debt
t_o=(g+(1/betta-1)*d-eta*t_r)/(1-eta); % o taxes
lambda=c^(-sigma);           % marginal utlity of consumption
a=y/(k^(alppha)*h^(1-alppha)); % tfp
kappaL=w/(h^(phi)*c^(sigma));% labor preference parameter
%% Steady-state values
gss=g;
ass=a;
piss=pi;
rss=r;
t_oss=t_o;
t_rss=t_r;
dss=d;

%% Parameters not affecting the steady state
phipi=1.5;                % mp response to inflation
phiy=0.0;                 % mp response to output
kappaI=2.5;              % investment adjustment cost (as in CEE). If 0, q is constant
rhoa=0.9;                 % tfp persistence
rhog=0.9;                 % public spending persistence
rhom=0.0;                 % monetary policy inertia
phig=0.1;                 % tax reaction to g
phid=0.33;                % tax reaction to debt
calvo=0.66;               % price rigidity in calvo framework
% adjusment cost coefficient to have the same linear Phillips Curve of the Calvo framework 
kappaP=(epsilon-1)*calvo/(piss^2*(1-calvo)*(1-betta*calvo)); 

%% Save parameters
save par betta alppha delta sigma phi gss ass kappaL piss rss epsilon eta...
         phipi phiy kappaI rhoa rhog rhom kappaP phig phid t_oss t_rss dss
     

