Unverified Commit c4e1d1e8 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Occbin: new syntax for constructing multi-regime equations

Ref. #569
parent 229282a1
Subproject commit 81d4fd5d83c08da2403a8faf3d2a006d3ab4bb1e
Subproject commit ebd9954d33fbeba970dc3ebb249a03c15b317141
......@@ -77,9 +77,6 @@ parameters
phiy // Output responsiveness
nu // Investment adjustment cost
sigups // Utilization
// Switching parameters
zlb
;
......@@ -108,7 +105,6 @@ sigs = 0.005; // Standard deviation
sigi = 0.002; // Standard deviation
phipi = 2.0; // Inflation responsiveness
phiy = 0.5; // Output responsiveness
zlb = 0 ; // ZLB dummy
inomlb = 1 ; // Inom LB
// ---------------- Model -----------------------------------------------//
......@@ -179,8 +175,10 @@ model;
[name = 'Notional Interest Rate (9)']
inomnot = inomnot(-1)^rhoi*(inombar*pigap^phipi*yg^phiy)^(1-rhoi)*exp(mp);
[name = 'Nominal Interest Rate (10)']
inom = (inomnot*(1-zlb)+zlb*inomlb);
[name = 'Nominal Interest Rate (10)', bind='zlb']
inom = inomlb;
[name = 'Nominal Interest Rate (10)', relax='zlb']
inom = inomnot;
[name = 'Inverse MUC (11)']
lam = c-h*c(-1)/g;
......
......@@ -79,9 +79,6 @@ parameters
phiy // Output responsiveness
nu // Investment adjustment cost
sigups // Utilization
// Switching parameters
zlb
;
......@@ -110,7 +107,6 @@ sigs = 0.005; // Standard deviation
sigi = 0.002; // Standard deviation
phipi = 2.0; // Inflation responsiveness
phiy = 0.5; // Output responsiveness
zlb = 0 ; // ZLB dummy
inomlb = 1 ; // Inom LB
// ---------------- Model -----------------------------------------------//
......@@ -181,8 +177,10 @@ model;
[name = 'Notional Interest Rate (9)']
inomnot = inomnot(-1)^rhoi*(inombar*pigap^phipi*yg^phiy)^(1-rhoi)*exp(mp);
[name = 'Nominal Interest Rate (10)']
inom = (inomnot*(1-zlb)+zlb*inomlb);
[name = 'Nominal Interest Rate (10)', bind='zlb']
inom = inomlb;
[name = 'Nominal Interest Rate (10)', relax='zlb']
inom = inomnot;
[name = 'Inverse MUC (11)']
lam = c-h*c(-1)/g;
......
......@@ -12,12 +12,15 @@ var b ${b}$ (long_name='borrowing')
;
varexo u $u$;
parameters RHO ${\rho}$, BETA ${\beta}$, M $M$, R $R$, SIGMA ${\sigma}$, GAMMAC $\gamma_c$, relax_borrcon ;
parameters RHO ${\rho}$, BETA ${\beta}$, M $M$, R $R$, SIGMA ${\sigma}$, GAMMAC $\gamma_c$;
model;
ec = c(1);
c = y + b - R*b(-1) ;
(1-relax_borrcon)*(b - M*y) + relax_borrcon*lb = 0;
[name = 'borrowing', bind='borrcon']
lb = 0;
[name = 'borrowing', relax='borrcon']
b = M*y;
lb = 1/c^GAMMAC - BETA*R/c(+1)^GAMMAC ;
log(y) = RHO*log(y(-1)) + u ;
c_hat = log(c) - log(steady_state(c));
......@@ -26,8 +29,8 @@ y_hat = log(y) - log(steady_state(y));
end;
occbin_constraints;
name 'relax_borrcon'; bind lb<-STEADY_STATE(lb); relax b>M*y; error_bind abs(lb+STEADY_STATE(lb)); error_relax abs(b-M*y);
%name 'relax_borrcon'; bind lb<-STEADY_STATE(lb); relax b>M*y;
name 'borrcon'; bind lb<-STEADY_STATE(lb); relax b>M*y; error_bind abs(lb+STEADY_STATE(lb)); error_relax abs(b-M*y);
%name 'borrcon'; bind lb<-STEADY_STATE(lb); relax b>M*y;
end;
steady_state_model;
......@@ -44,7 +47,6 @@ RHO = 0.9;
SIGMA = 0.05;
M = 1;
GAMMAC = 1;
relax_borrcon = 0;
shocks;
var u; stderr SIGMA;
......
......@@ -13,12 +13,15 @@ var b ${b}$ (long_name='borrowing')
varexo junk1 u junk2 ;
parameters RHO ${\rho}$, BETA ${\beta}$, M $M$, R $R$, SIGMA ${\sigma}$, GAMMAC $\gamma_c$, relax_borrcon ;
parameters RHO ${\rho}$, BETA ${\beta}$, M $M$, R $R$, SIGMA ${\sigma}$, GAMMAC $\gamma_c$;
model;
ec = c(1);
c = y + b - R*b(-1) ;
(1-relax_borrcon)*(b - M*y) + relax_borrcon*lb = 0;
[name = 'borrowing', bind='borrcon']
lb = 0;
[name = 'borrowing', relax='borrcon']
b = M*y;
lb = 1/c^GAMMAC - BETA*R/c(+1)^GAMMAC +junk1 + junk2;
log(y) = RHO*log(y(-1)) + u ;
c_hat = log(c) - log(steady_state(c));
......@@ -27,7 +30,7 @@ y_hat = log(y) - log(steady_state(y));
end;
occbin_constraints;
name 'relax_borrcon'; bind lb<-STEADY_STATE(lb); relax b>M*y; error_bind abs(lb+STEADY_STATE(lb)); error_relax abs(b-M*y);
name 'borrcon'; bind lb<-STEADY_STATE(lb); relax b>M*y; error_bind abs(lb+STEADY_STATE(lb)); error_relax abs(b-M*y);
end;
steady_state_model;
......@@ -44,7 +47,6 @@ RHO = 0.9;
SIGMA = 0.05;
M = 1;
GAMMAC = 1;
relax_borrcon = 0;
shocks;
var u; stderr SIGMA;
......
......@@ -8,7 +8,7 @@ varexo erra;
// parameters
parameters ALPHA, DELTAK, BETA, GAMMAC, RHOA, PHI, PSI, PSINEG, INEG, IRR;
parameters ALPHA, DELTAK, BETA, GAMMAC, RHOA, PHI, PSI;
model;
......@@ -20,20 +20,33 @@ model;
/////////////////////////////////////////////////////////////////
// 1.
-exp(c)^(-GAMMAC)*(1+2*INEG*PSI*(exp(k)/exp(k(-1))-1)/exp(k(-1)))
+ BETA*exp(c(1))^(-GAMMAC)*((1-DELTAK)-2*INEG*PSI*(exp(k(1))/exp(k)-1)*
[name='Euler', bind = 'INEG']
-exp(c)^(-GAMMAC)*(1+2*PSI*(exp(k)/exp(k(-1))-1)/exp(k(-1)))
+ BETA*exp(c(1))^(-GAMMAC)*((1-DELTAK)-2*PSI*(exp(k(1))/exp(k)-1)*
(-exp(k(1))/exp(k)^2)+ALPHA*exp(a(1))*exp(k)^(ALPHA-1))=
-lambdak+BETA*(1-DELTAK)*lambdak(1);
[name='Euler', relax = 'INEG']
-exp(c)^(-GAMMAC) + BETA*exp(c(1))^(-GAMMAC)*(1-DELTAK+ALPHA*exp(a(1))*exp(k)^(ALPHA-1))=
-lambdak+BETA*(1-DELTAK)*lambdak(1);
// 2.
exp(c)+exp(k)-(1-DELTAK)*exp(k(-1))+
INEG*PSI*(exp(k)/exp(k(-1))-1)^2=exp(a)*exp(k(-1))^(ALPHA);
[name='Budget constraint',bind = 'INEG']
exp(c)+exp(k)-(1-DELTAK)*exp(k(-1))+PSI*(exp(k)/exp(k(-1))-1)^2=exp(a)*exp(k(-1))^(ALPHA);
[name='Budget constraint',relax = 'INEG']
exp(c)+exp(k)-(1-DELTAK)*exp(k(-1))=exp(a)*exp(k(-1))^(ALPHA);
// 3.
exp(i) = exp(k)-(1-DELTAK)*exp(k(-1));
// 4.
lambdak*(1-IRR) + IRR*(i - log(PHI*ziss)) = 0;
[name='investment',bind='IRR,INEG']
(i - log(PHI*ziss)) = 0;
[name='investment',relax='IRR']
lambdak=0;
[name='investment',bind='IRR',relax='INEG']
(i - log(PHI*ziss)) = 0;
// 5.
a = RHOA*a(-1)+erra;
......
......@@ -8,7 +8,7 @@ varexo junk1 erra junk2;
// parameters
parameters ALPHA, DELTAK, BETA, GAMMAC, RHOA, PHI, PSI, PSINEG, INEG, IRR;
parameters ALPHA, DELTAK, BETA, GAMMAC, RHOA, PHI, PSI;
model;
......@@ -20,20 +20,33 @@ model;
/////////////////////////////////////////////////////////////////
// 1.
-exp(c)^(-GAMMAC)*(1+2*INEG*PSI*(exp(k)/exp(k(-1))-1)/exp(k(-1)))
+ BETA*exp(c(1))^(-GAMMAC)*((1-DELTAK)-2*INEG*PSI*(exp(k(1))/exp(k)-1)*
[name='Euler', bind = 'INEG']
-exp(c)^(-GAMMAC)*(1+2*PSI*(exp(k)/exp(k(-1))-1)/exp(k(-1)))
+ BETA*exp(c(1))^(-GAMMAC)*((1-DELTAK)-2*PSI*(exp(k(1))/exp(k)-1)*
(-exp(k(1))/exp(k)^2)+ALPHA*exp(a(1))*exp(k)^(ALPHA-1))=
-lambdak+BETA*(1-DELTAK)*lambdak(1);
[name='Euler', relax = 'INEG']
-exp(c)^(-GAMMAC) + BETA*exp(c(1))^(-GAMMAC)*(1-DELTAK+ALPHA*exp(a(1))*exp(k)^(ALPHA-1))=
-lambdak+BETA*(1-DELTAK)*lambdak(1);
// 2.
exp(c)+exp(k)-(1-DELTAK)*exp(k(-1))+
INEG*PSI*(exp(k)/exp(k(-1))-1)^2=exp(a)*exp(k(-1))^(ALPHA) + junk1 + junk2;
[name='Budget constraint',bind = 'INEG']
exp(c)+exp(k)-(1-DELTAK)*exp(k(-1))+PSI*(exp(k)/exp(k(-1))-1)^2=exp(a)*exp(k(-1))^(ALPHA) + junk1 + junk2;
[name='Budget constraint',relax = 'INEG']
exp(c)+exp(k)-(1-DELTAK)*exp(k(-1))=exp(a)*exp(k(-1))^(ALPHA) + junk1 + junk2;
// 3.
exp(i) = exp(k)-(1-DELTAK)*exp(k(-1));
// 4.
lambdak*(1-IRR) + IRR*(i - log(PHI*ziss)) = 0;
[name='investment',bind='IRR,INEG']
(i - log(PHI*ziss)) = 0;
[name='investment',relax='IRR']
lambdak=0;
[name='investment',bind='IRR',relax='INEG']
(i - log(PHI*ziss)) = 0;
// 5.
a = RHOA*a(-1)+erra;
......@@ -61,4 +74,4 @@ end
if max(max(abs(oo_.Smoother.SteadyState-orig_results.oo_.Smoother.SteadyState)))>1e-10
error('SmoothedShocks do not match')
end
\ No newline at end of file
end
......@@ -18,8 +18,6 @@ GAMMAC=2;
RHOA = 0.9;
PHI = 0.975;
PSI = 5; % adjustment cost for capital if investment is negative
INEG = 0;
IRR = 0;
shocks;
var erra; stderr 0.015;
......
......@@ -7,9 +7,9 @@ varexo erra;
// parameters
parameters ALPHA, DELTAK, BETA, GAMMAC, RHOA, PHI, PSI, PSINEG, INEG, IRR;
parameters ALPHA, DELTAK, BETA, GAMMAC, RHOA, PHI, PSI, PSINEG;
model(occbin);
model;
# zkss = ((1/BETA-1+DELTAK)/ALPHA)^(1/(ALPHA-1));
# zcss = -DELTAK*zkss + zkss^ALPHA;
......@@ -19,28 +19,33 @@ model(occbin);
/////////////////////////////////////////////////////////////////
// 1.
-exp(c)^(-GAMMAC)*(1+2*INEG*PSI*(exp(k)/exp(k(-1))-1)/exp(k(-1)))
+ BETA*exp(c(1))^(-GAMMAC)*((1-DELTAK)-2*INEG*PSI*(exp(k(1))/exp(k)-1)*
[name='Euler', bind = 'INEG']
-exp(c)^(-GAMMAC)*(1+2*PSI*(exp(k)/exp(k(-1))-1)/exp(k(-1)))
+ BETA*exp(c(1))^(-GAMMAC)*((1-DELTAK)-2*PSI*(exp(k(1))/exp(k)-1)*
(-exp(k(1))/exp(k)^2)+ALPHA*exp(a(1))*exp(k)^(ALPHA-1))=
-lambdak+BETA*(1-DELTAK)*lambdak(1);
[name='Euler', relax = 'INEG']
-exp(c)^(-GAMMAC) + BETA*exp(c(1))^(-GAMMAC)*(1-DELTAK+ALPHA*exp(a(1))*exp(k)^(ALPHA-1))=
-lambdak+BETA*(1-DELTAK)*lambdak(1);
// 2.
exp(c)+exp(k)-(1-DELTAK)*exp(k(-1))+
INEG*PSI*(exp(k)/exp(k(-1))-1)^2=exp(a)*exp(k(-1))^(ALPHA);
[name='Budget constraint',bind = 'INEG']
exp(c)+exp(k)-(1-DELTAK)*exp(k(-1))+PSI*(exp(k)/exp(k(-1))-1)^2=exp(a)*exp(k(-1))^(ALPHA);
[name='Budget constraint',relax = 'INEG']
exp(c)+exp(k)-(1-DELTAK)*exp(k(-1))=exp(a)*exp(k(-1))^(ALPHA);
// 3.
[pswitch = 'INEG',
// bind = 'exp(i+i_ss)<-0.000001',
// relax = 'exp(i+i_ss)>-0.000001' ]
bind = 'i<-b',
relax = 'i>-0.000001' ]
exp(i) = exp(k)-(1-DELTAK)*exp(k(-1));
// 4.
[pswitch = 'IRR',
bind = 'i<PHI-1',
relax = 'lambdak<0' ]
lambdak*(1-IRR) + IRR*(i - log(PHI*ziss)) = 0;
[name='investment',bind='IRR,INEG']
(i - log(PHI*ziss)) = 0;
[name='investment',relax='IRR']
lambdak=0;
[name='investment',bind='IRR',relax='INEG']
(i - log(PHI*ziss)) = 0;
// 5.
a = RHOA*a(-1)+erra;
......@@ -48,6 +53,11 @@ a = RHOA*a(-1)+erra;
end;
occbin_constraints;
name 'IRR'; bind i<PHI-1; relax lambdak<0;
name 'INEG'; bind i<-b; relax i>-0.000001; // Failure here because b does not exist
end;
steady_state_model;
kss = ((1/BETA-1+DELTAK)/ALPHA)^(1/(ALPHA-1));
css = -DELTAK*kss +kss^ALPHA;
......@@ -68,8 +78,6 @@ GAMMAC=2;
RHOA = 0.9;
PHI = 0.975;
PSI = 5; % adjustment cost for capital if investment is negative
INEG = 0;
IRR = 0;
shocks;
var erra; stderr 0.015;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment