I seem to have a problem with my code of a non-linearised basic NK model.
While first-order IRFS seem fine, second-order IRFS appear very weird (no smooth coming back to steady state but rather kinky jumps).
I wonder whether one here has a simple explanation for this.
the code reads
- Code: Select all
close all; clc;
var
C %consumption
R %nominal interest rate
Pie %gross inflation
w %real wage
N %labour
mc %real marginal costs
Y %output
x1 %auxiliary variable (Schmitt-Grohé and Uribe)
x2 %see above
pop %optimal price divided by actual aggregate price level
d %price dispersion
psi; %monetary policy shock
varexo err;
parameters beta sigma kappa epsilon theta phi rho;
beta = 0.99; %discount factor
sigma = 3; %risk aversion
kappa = 3; %Frisch elasticity
epsilon = 11; %elast. of subs. btw. diff. goods
theta = 0.7; %Calvo parameter
phi = 1.5; %strength of monetary policy
rho = 0.9; %persistence of shock
model;
C^(-sigma) = beta*(R/Pie(+1))*C(+1)^(-sigma); %Euler equation
N^(kappa)*C^(sigma) = w; %labour supply
mc = w; %real marginal costs (linear prod. fct) with A=1 (mc=w/A)
x1 = (epsilon/(epsilon-1))* x2;
x1 = Y*pop^(1-epsilon) + (Pie(+1)*pop(+1)/pop)^(epsilon-1)*theta*beta*(1/Pie(+1))*(C(+1)/C)^(-sigma)*x1(+1);
x2 = Y*pop^(-epsilon)*mc + (Pie(+1)*pop(+1)/pop)^(epsilon)*theta*beta*(1/Pie(+1))*(C(+1)/C)^(-sigma)*x2(+1);
1 = theta*Pie^(epsilon-1) + (1-theta)*pop^(1-epsilon); %'law of motion of prices'
C = Y; %market clearing
Y = N/d; %production function
d = (1-theta)*pop^(-epsilon) + (theta*Pie^(epsilon))*d(-1); %law of motion of price dispersion
R = (1/beta)*Pie^(phi)+psi; %Taylor rule
psi = rho*psi(-1)+err; %monetary policy shock
end;
shocks;
var err=0.001;
end;
initval;
C=((epsilon-1)/epsilon)^(1/(kappa+sigma));
Pie = 1;
R = 1/beta;
mc = (epsilon-1)/epsilon;
w = mc;
pop = 1;
Y = C;
N = C;
d = 1;
end;
steady;
check;
steady(solve_algo=4);
stoch_simul(periods=200,irf=20,order=2, pruning) Y d Pie ;
Thanks in advance for any helpful comments!