# Why the inflation rate increase when suffer from technology shock?

Dear professor,
I have finished my code to solve the optimal simple policy rules. But the impluse response function is not what I expected. When I add a positive technology shock to the model, the inflation rate increases. But in most of literatures, the inflation rate should decrease because more products are produced. Now I paste the dynare code below. Could you help me check how to solve this problem? Am I introducing the wrong shock?
Of course , when you run code, you must load the steady-state data in “SteadyState.mat” (see attachment) which I obtain by a numerical method. Of course, I also upload the code below in mod to an attachment named “Policynounemployment”.
Thank you very much!!!

``````% addpath c:\dynare\4.4.3\matlab%在MATLAB中加载dynare
% for solving the optimal monetary policy rule's parameters
var d pigap vgap ygap AP AS y yW c i G gdp k lambda q H m m2 HS HP yS yP pW pS pP kS kP nS nP bS bP w wSe wPe RSL RPL Rk Rd RS RP RSI RPI pi tao miu v vS vP omgS omgP fomgS fomgP gomgS gomgP fdomgS fdomgP gdomgS gdomgP FomgS FomgP;% 共58个 variables，AP和AS通过外生冲击引入，但是也为内生变量
varexo eaS eaP eaM;
parameters rhoaS rhoaP omgk gamma beta eta psiH psiM delta psi g alphaP alphaS theta sigma mS mP ksiS ksiP gc fai lS lP omgm kappa fai_tao_y fai_tao_pi fai_tao_v fai_taoT_y fai_taoT_pi fai_taoT_v fai_miu_y fai_miu_pi fai_miu_v taos taoTs mius ys pis vs ASs APs;
% Parameter Calibration

beta=0.995; eta=2; psiH=18; delta=0.05; APs=1; ASs=1;
psi = 10; g = 1.0125; alphaS = 0.5; alphaP=0.85; theta = 0.9; sigma = 3;
mS = 0.15; mP = 0.15; ksiS = 0.97; ksiP = 0.92;%mP设定的不能太小，否则会出现gdomgS/Ps为负，无解的情形，而mS设定也要适度，否则要么HSs太大，要么为0;ksiP不能太大，也会出现无解的情形。
gc=0.14; fai=0.6; lS = 0.3;  lP = 0.1;
psiM =0.06; omgm = 0.37; kappa =1.587 ;
gamma = 10;rhoaS = 0.95; rhoaP = 0.95; omgk = 1;

ASs = 1; APs = 1; taos = 0.15; taoTs = 0.01; mius = 1; pis = 1+0.035/4;

fai_miu_u = 0.65; fai_miu_pi = -0.35 ;  fai_miu_v = -0.2;

fomgSs = 1/(kappa-1) * omgm^kappa * omgSs^(1-kappa);
fomgPs = 1/(kappa-1) * omgm^kappa * omgPs^(1-kappa);

fdomgSs = - omgm^kappa * omgSs^(-kappa);
fdomgPs = - omgm^kappa * omgPs^(-kappa);

gomgSs = (1 - lS) * (1 - mS) * kappa * omgm / (kappa-1) + lS * omgSs + (1-lS) * (1- (1-mS) * kappa / (kappa-1)) * omgSs^ (1-kappa) * omgm^kappa;
gomgPs = (1 - lP) * (1 - mP) * kappa * omgm / (kappa-1) + lP * omgPs + (1-lP) * (1- (1-mP) * kappa / (kappa-1)) * omgPs^ (1-kappa) * omgm^kappa;

gdomgSs = lS + (1-lS) * ( 1-mS * kappa ) * omgSs^(-kappa) * omgm^kappa;
gdomgPs = lP + (1-lP) * ( 1-mP * kappa ) * omgPs^(-kappa) * omgm^kappa;

FomgSs = kappa * omgSs^(1-kappa) * omgm^kappa / (1-kappa) - kappa * omgm / (1-kappa);
FomgPs = kappa * omgPs^(1-kappa) * omgm^kappa / (1-kappa) - kappa * omgm / (1-kappa);

mius = 1;
qs = 1;
Rks = qs * g / beta - qs * ( 1 - delta );
Rds = pis * g / beta;
RSs = (Rds - 1) / (1-taos) + 1;
RPs = (Rds - 1) / (1-taos ) + 1;
HPs = Hs -HSs;
ws = cs * psiH * (Hs) ^eta;
kSs = (1-alphaS) * ws * HSs / (alphaS * theta * Rks);
kPs = (1-alphaP) * ws * HPs / (alphaP * theta * Rks);
ks = g * (kSs + kPs);
is = (1 - (1-delta) / g) * ks;
%A8
ySs = ASs * kSs ^(1-alphaS) * HSs^(theta * alphaS);
% A16
yPs = APs * kPs ^(1-alphaP) * HPs^(theta * alphaP);
%A26
pWs =(psi - 1) / psi;
% A35
yWs = (fai * ySs^((sigma - 1)/sigma) + (1-fai) * yPs^((sigma - 1)/sigma))^(sigma / (sigma - 1));
%A36
pSs = pWs * fai * yWs^(1/sigma) / ySs^(1 / sigma);
%A37
pPs = pWs * (1 - fai) * yWs^(1/sigma) / yPs^(1 / sigma);
%A9
% A17
%A10
wSes = alphaS * (1-theta) * ws * HSs / (alphaS * theta);
%A18
wPes = alphaP * (1-theta) * ws * HPs / (alphaP * theta);
%A12
RSIs = pSs * ySs / (ws * HSs / (alphaS * theta));
%A20
RPIs = pPs * yPs / (ws * HPs / (alphaP * theta));
%A15
nSs = wSes + ksiS * RSIs * ws * HSs / (alphaS * theta) * fomgSs;
% A23
nPs = wPes + ksiP * RPIs * ws * HPs / (alphaP * theta) * fomgPs;
%A13
bSs = gomgSs * ws * HSs / (alphaS * theta) * (RSIs / RSs);
%A21
bPs = gomgPs * ws * HPs / (alphaP * theta) * (RPIs / RPs);
% //A14///////////////////////////////////////////////////////
fun1 = (bSs + nSs/(pis * g)) - ws *  HSs / (alphaS * theta);
fun11 = nSs / (pis * g) / (ws * HSs / (alphaS * theta)) - (- gdomgSs * RSIs * fomgSs / (fdomgSs * RSs));
% //A22
fun2 = (bPs + nPs/(pis * g)) - ws *  HPs / (alphaP * theta);
fun22 = nPs / (pis * g) / (ws * HPs / (alphaP * theta)) - (- gdomgPs * RPIs * fomgPs / (fdomgPs * RPs));
%A45
RSLs = omgSs * RSIs * ws * HSs / (alphaS * theta) / bSs;
%A46
RPLs = omgPs * RPIs * (nPs/(pis * g) + bPs) / bPs;
%A43
vSs = 1 - RSIs * gomgSs * ws * HSs / (alphaS * theta) / (bSs * RSLs);
%A44
vPs = 1 - RPIs * gomgPs * ws * HPs / (alphaP * theta) / (bPs * RPLs);
% //A41//////////////////////////////////////////////////////
vs = bSs * vSs / (bPs + bSs) + bPs * vPs / (bPs + bSs);
%A40
gdps = (is + cs) / (1 - gc);
%A32
Gs = gdps * gc;
% A33
ys = cs + is + Gs + RSIs * mS * FomgSs * ws * HSs / (alphaS * theta) + RPIs * mP * FomgPs * ws * HPs / (alphaP * theta);
% //A34////////////////////////////////////////////////////
fun4 =ys - yWs;
lambdas = 1 / cs;
% A5
ms = cs * psiM / (1 - beta / (pis * g));
%A31
ds = bSs / (1 - taos) + bPs / (1 - taos);
m2s = ms + ds;

pigaps=0;
vgaps=0;
ygaps=0;

model; %(linear);
%(1) home Euler equation
k=(1-delta)*k(-1)/g+(1-omgk/2*(i*g/i(-1)-g)^2)*i;
%(2)
lambda=1/c;
%(3)
w=psiH*H^eta/lambda;
%(4)
beta * Rd(+1) * lambda(+1) / (pi(+1) * lambda * g) = 1;
%(5)
psiM / (lambda * m) + beta * lambda(+1) / (pi(+1) * g * lambda) = 1;
%(6)
q = beta * lambda(+1) / (lambda * g) * (Rk(+1) + q(+1) * (1 - delta));
%(7)
1 = q * (1 - omgk / 2 * (i * g / i(-1) - g)^2 - omgk * (g*i/i(-1) - g) * i * g / i(-1) )+ beta * q(+1) * lambda(+1) / (lambda * g) * omgk * (i(+1) * g / i - g) * (i(+1)*g/i)^2;
% (8)
yS=AS * (kS)^(1-alphaS) * (HS)^(theta * alphaS);
%(9)
w * HS = alphaS * theta * ( nS(-1) / (pi * g) + bS);%第九个有点误差出现，因为这个方式是求解的，有一点误差
% (10)
wSe = alphaS * (1-theta) * (nS(-1)/(pi * g) + bS); %第十个也有点误差出现了。
% (11)
Rk * kS = (1-alphaS) * (nS(-1)/(pi * g)+bS);
%(12)
RSI  = pS * yS /(nS(-1)/(pi * g)+bS);
%(13)
RSI * (nS(-1)/(pi * g)+bS) * gomgS = bS * RS;
%(14)
nS(-1)/(pi * g) / (nS(-1)/(pi * g)+bS) = -gdomgS * RSI * fomgS / (fdomgS * RS);
%(15)
nS = wSe + ksiS * RSI * (nS(-1)/(pi * g) + bS) * fomgS;
% (16)
yP = AP * (kP)^(1-alphaP) * (HP)^(theta*alphaP);
%(17)
w * HP = alphaP * theta * (nP(-1)/(pi * g)+bP);
% (18)
wPe = alphaP * (1-theta) * (nP(-1)/(pi * g)+bP);
% (19)
Rk * kP = (1-alphaP) * (nP(-1)/(pi * g)+bP);
%(20)
RPI  = pP * yP /(nP(-1)/(pi * g)+bP);
%(21)
RPI * (nP(-1)/(pi * g)+bP) * gomgP = bP * RP;
%(22)
nP(-1)/(pi * g) / (nP(-1)/(pi * g)+bP) = -gdomgP * RPI * fomgP / (fdomgP * RP);
%(23)
nP = wPe + ksiP * RPI * (nP(-1)/(pi * g) + bP) * fomgP;
%(24)
RS - 1 = (Rd - 1) / (1-tao);
%(25)
( RP - 1 ) * ( 1 - tao  ) = Rd - 1;
%(26)
pW = (psi-1) / psi + gamma * pi *( pi / pis - 1 ) * c / (pis * psi * y) - beta * lambda(+1) * gamma * pi(+1) * (pi(+1) / pis - 1) * c(+1) / ( pis * psi * y * lambda);
% (27)

%(28)
tao = taos + fai_tao_y * ( y - ys ) + fai_tao_pi * (pi - pis) ;%+ fai_tao_v * (v - vs) ;
%(29)
miu = mius  + fai_miu_y * ( y - ys ) + fai_miu_pi * (pi - pis);% + fai_miu_v * (v - vs) ;
% (30)
miu = m2 / m2(-1);
%(31)
d = bS / ( 1- tao) + bP / ( 1 - tao);
m2 = m + d ;
% (32)
G = gdp * gc ;
%(33)
y = c + i + G + gamma * (pi / pis - 1)^2 * c / 2 + RSI * (nS(-1)/(pi * g) + bS) * mS * FomgS +  RPI * (nP(-1)/(pi * g) + bP) * mP * FomgP;
% (34)
y = yW;
%(35)
yW = (fai * yS^((sigma-1)/sigma) + (1-fai) * yP^((sigma-1)/sigma))^(sigma/(sigma-1));
%(36)
yS = fai^sigma * yW * (pW / pS)^sigma ;
%(37)
yP = (1-fai)^sigma * yW * (pW / pP)^sigma ;
%(38)
k(-1) / g = kS + kP;
% (39)
H = HS + HP;
%(40)
gdp = i + c + G;
%(41)
v = bP / (bP+bS) * vP + bS / (bP+bS) * vS;
%(43)
vS = 1 - RSI * (nS(-1) / (pi * g) + bS) * gomgS / (bS * RSL);
%(44)
vP = 1 - RPI * (nP(-1) / (pi * g) + bP) * gomgP / (bP * RPL);
% (45)贷款利率
omgS = RSL * bS / ( (nS(-1)/(pi * g) + bS) * RSI);
%(46)贷款利率
RPL = omgP * RPI * (nP(-1)/(pi * g) + bP) / bP;

// shock
%(47)technology shock
log(AS) = log(ASs)*rhoaS + log(AS(-1))*(1-rhoaS) + eaS ;
%(48)technology shock
log(AP) = log(APs)*rhoaP +log(AP(-1))*(1-rhoaP) +eaS ;

fomgS = 1/(kappa-1) * omgm^kappa * omgS^(1-kappa);
fdomgS = - omgm^kappa * omgS^(-kappa);
gomgS = (1 - lS) * (1 - mS) * kappa * omgm / (kappa-1) + lS * omgS + (1-lS) * (1- (1-mS) * kappa / (kappa-1)) * omgS^ (1-kappa) * omgm^kappa;
gdomgS = lS + (1-lS) * ( 1-mS * kappa ) * omgS^(-kappa) * omgm^kappa;

fomgP = 1/(kappa-1) * omgm^kappa * omgP^(1-kappa);
fdomgP = - omgm^kappa * omgP^(-kappa);
gomgP = (1 - lP) * (1 - mP) * kappa * omgm / (kappa-1) + lP * omgP + (1-lP) * (1- (1-mP) * kappa / (kappa-1)) * omgP^ (1-kappa) * omgm^kappa;
gdomgP = lP + (1-lP) * ( 1-mP * kappa ) * omgP^(-kappa) * omgm^kappa;

FomgS = kappa * omgS^(1-kappa) * omgm^kappa / (1-kappa) - kappa * omgm / (1-kappa);
FomgP = kappa * omgP^(1-kappa) * omgm^kappa / (1-kappa) - kappa * omgm / (1-kappa);

pigap=pi-pis;
vgap=v-vs;
ygap=y-ys;
end;

initval;% %Initial guesses for steady-state computation把稳态值赋予给内生变量
d = ds;
AP = APs;
AS = ASs;
y = ys;
yW = yWs;
c = cs;
i = is;
G = Gs;
gdp = gdps;
k = ks;
lambda = lambdas;
q = qs ;
H = Hs;
m = ms;
m2 = m2s;
HS = HSs;
HP = HPs;
yS = ySs;
yP = yPs;
pW = pWs;
pS = pSs;
pP = pPs;
kS = kSs;
kP = kPs;
nS = nSs;
nP = nPs;
bS  = bSs;
bP  = bPs;
w  =ws;
wSe = wSes;
wPe  =wPes;
RSL  =RSLs;
RPL  =RPLs;
Rk  = Rks;
Rd  = Rds;
RP  = RPs;
RSI = RSIs;
RPI  = RPIs;
pi  = pis;
tao  = taos;
miu  =  mius;
v  = vs;
vS  = vSs;
vP  = vPs;
omgS  = omgSs;
omgP  = omgPs;
fomgS  = fomgSs;
fomgP = fomgPs;
gomgS  = gomgSs;
gomgP  =gomgPs;
fdomgS = fdomgSs;
fdomgP =fdomgPs;
gdomgS  =gdomgSs;
gdomgP =gdomgPs;
FomgS  = FomgSs;
FomgP = FomgPs;

pigap=pigaps;
vgap=vgaps;
ygap = ygaps;
end;

shocks;
var eaS;
stderr 0.01;%如果把冲击的标准差设定为0.3，反应系数突然增加到了4000多
end;

optim_weights;
pigap 1;
vgap 1;
ygap 1;
end;

%结果对初值的依赖性非常大，参数初值的方向也要写对，否则出现BK条件不满足
fai_tao_y = -0.5 ; fai_tao_pi  = 0;  fai_tao_v =0; %严重依赖于初值
fai_miu_y = 0.2; fai_miu_pi =-0.4 ;  fai_miu_v = 0; %此处只有这个能设定为数，因为每个政策中都会出现，其它应初始值设定为0；而且对fai_miu_pi的初值以来严重
fai_taoT_y = 0.8;   fai_taoT_pi =0 ;  fai_taoT_v = 0 ;

osr_params fai_miu_pi fai_miu_y fai_miu_v  fai_tao_pi fai_tao_y fai_tao_v fai_taoT_pi  ;
osr y yP yS yW pS pP pW pi H c i tao miu;
``````

Policynounemployment.mod (9.9 KB) SteadyState.mat (389 Bytes)

Hi,
with a model that large it is impossible to tell. I can only recommend doing the debugging with a simpler model.