

%-------------------------------------------------------------------------------------------

                    The macroeconomic Effect of Non-Zero Trend Inflation

%-------------------------------------------------------------------------------------------


% endogenous variables 
 
var 
c                          %consumption
b                          %money demand shock
m                          %nominal balances
lambda                     %lagrange multiplier
r                          %nominal interest rate
pi                         %inflation rate
h                          %hours worked
i                          %real investment
k                          %capital stock
y                          %output
ys                         %aggregate output 
s                          %aggregate prices indicator
q                          % real rental rate of capital
w                          % real wages
psi                        % real marginal cost
a                          %technology level
pstar                      %optimal price
x                          %price evolution indicator 1
z                          %price evolution price indicator 2
;

%exogenous shocks 

varex epsilonr epsilona epsilonb;

%model parameters

parameters beta, sigma, eta, alpha, theta, delta, phi, d, rhor, rhopi, rhoy, rhob, epsilonb, rhoa, epsilona, epsilonr, ybar, pibar ;

%---------------------calibration-------------------------------------------------------------------------------------

beta=0.99;                      %discount factor

sigma=0.25;                     %elasticity of substitution between consumption and real balances

eta=1.5;                        % 

alpha=0.34;                     %elasticity of substitution between capital and hours worked

theta=8.00;                     %elasticity of substitution between types of differentiated intermediate goods

delta=0.025;                    %depreciation rate of capital

phi=10.0;                       %parameter of adjustment costs of investment

d=0.75;                         %calvo parameter

rhor=0.80;                      %the Taylor rule interest rate parameter

rhopi=1.50;                     %the Taylor rule inflation rate parameter

rhoy=0.20;                      %the Taylor rule output parameter

rhob=0.80;                      %money demand shock parameter

epsilonb=0.01;                  %std.dev of money demand stochastic shock 

rhoa=0.80;                      %technologic shock parameter

epsilona=0.01;                  %std.dev of the technologic shock

epsilonr=0.01;                  %std.dev of the monetary policy shock

ybar=1.44;                      %steady state output

pibar=(1.0)^(1/4);              %steady state price

model;

%---------FOC Households--------------------------------------------------------------------------------------

exp(c)^1/sigma = exp(lambda)*(exp(c)^((sigma-1)/sigma) + exp(b)^(1/sigma)*exp(m)^(sigma-1/sigma));

exp(b)^(1/sigma)*exp(m)^(-1/sigma) = exp(lambda)*(1 - 1/r)*(exp(c)^((sigma-1)/sigma) + exp(b)^(1/sigma)*exp(m)^(sigma-1/sigma));

exp(lambda) = beta*(exp(lambda(+1)*(r/pi(+1))));

eta*(1/1-exp(h)) = exp(lambda)*w;

exp(lambda)*(1 + phi*(exp(i)/exp(k(-1)) - delta)) = beta*(exp(lambda(+1))*(1 +exp(q(+1)) - delta + phi*(((exp(i(+1))/exp(k))- delta)+ (phi/2)*((exp(i(+1))/exp(k))-delta)^2)));

%-----------law of the accumilation of capital------------------------------------------------------------------

exp(k) = (1 - delta)*exp(k(-1)) + exp(i);

%-----------FOC firms-------------------------------------------------------------------------------------

exp(q) = (1 - alpha)*exp(psi)*(exp(ys)/exp(k(-1)));
exp(w) = alpha*exp(psi)*(exp(ys)/exp(h));
exp(ys) = exp(a)*(exp(k(-1))^(1-alpha))*exp(h)^alpha;
exp(ys) = exp(y)*exp(s);
exp(y) = exp(c) + exp(k) + (1 - delta)*exp(k) + ((phi/2)*((exp(i)/exp(k(-1))) - delta)^2)*exp(k(-1));

%-------------Taylor rule--------------------------------------------------------------

r = (1 - rhor)*r + rhor*r(-1) + rhopi(exp(pi)/pibar) + rhoy*(exp(y)/ybar)+ epsilonr;  

%-----------------Shock---------------------------------------------------------------------------------

b = rhob*b(-1) + (1 - rhob)*b + epsilonb,
a = (1 - rhoa)*a + rhoa*a(-1) + epsilona;

%--------------------calvo pricing--------------------------------------------------------------------------

exp(s) = (1 - d)*exp(pstar)^(-theta) + d*exp(pi)^theta*exp(s(-1));
1 = d*exp(pi)^(theta-1) + (1 - d)*exp(pstar)^(1-theta);
exp(x) = exp(y)*exp(psi)*exp(pstar)^(-theta-1) + d*beta*((exp(lambda(+1))/exp(lambda))*((exp(pstar)/exp(pstar(+1)))^(-theta-1))*(exp(pi(+1))^theta)*exp(x(+1)));
exp(z) = exp(y)*exp(pstar(-1))^(-theta) + d*beta*((exp(lambda(+1))/exp(lambda))*((exp(pstar)/exp(pstar(+1)))^(-theta))*(exp(pi(+1))^(theta-1))*exp(z(+1)));
exp(x) = (theta/(theta-1))*exp(z);

end;

initval;
m=0;

%p=0

c=0;
h=0;
w=0;

%q=0

y=0;
i=0;
k=0;

%x=0

psi=0;
r=0;
q=0;
a=0;

%z=0

pi=0;
epsilona=0;
epsilonb=0;
epsilonr=0;

end;


shocks; 

var epsilonr; stderr 0.4;  
%var epsilona; stderr 1;
%var epsilonb; stderr 1.736;

end;

steady;
check;

stoch_simul(periods=40000,order=2, irf=20, AR=6) y c n i m w pi r;
