-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,988 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
var c n y r pi yhat ghat g beta; | ||
varexo ub ug; | ||
|
||
parameters alpha gamma chi varphi epsilon betass rhog rhob gbar phipi phig; | ||
|
||
gamma = 2; | ||
chi = 11; | ||
varphi = 1; | ||
epsilon = 7; | ||
betass = (1/1.04)^(1/12); | ||
rhob = 0.95; | ||
rhog = 0.9; | ||
alpha = 0.9; | ||
gbar = 0.07; | ||
phipi = 2; | ||
phig = 0; | ||
|
||
model; | ||
# nu_u = gamma*STEADY_STATE(y)/STEADY_STATE(c); | ||
# nu_v = varphi*STEADY_STATE(y)/STEADY_STATE(n); | ||
# capgamma = nu_u/(nu_u + nu_v); | ||
# kappa = (1-alpha)*(1-alpha*betass)/alpha*(nu_u + nu_v); | ||
y = n; | ||
y = c + g; | ||
yhat-ghat = yhat(+1)-ghat(+1) - 1/nu_u*(r - pi(+1) + log(beta(+1))); | ||
yhat = log(y/STEADY_STATE(y)); | ||
ghat = (g-STEADY_STATE(g))/STEADY_STATE(y); | ||
pi = beta(+1)*pi(+1) + kappa*(yhat-capgamma*ghat); | ||
r = max(-log(betass) + phipi*pi + phig*log(g/gbar),0); | ||
g/gbar = (g(-1)/gbar)^rhog*exp(ug); | ||
beta/betass = (beta(-1)/betass)^rhob*exp(ub); | ||
end; | ||
|
||
shocks; | ||
var ug; stderr .01; | ||
var ub; stderr .01; | ||
end; | ||
|
||
yss = fsolve(@(y) epsilon/(epsilon-1)*chi*y^varphi*(y-gbar)^gamma - 1,0.5); | ||
|
||
initval; | ||
beta = betass; | ||
g = gbar; | ||
r = -log(beta); | ||
y = yss; | ||
c = y - g; | ||
n = y; | ||
end; | ||
|
||
steady; | ||
|
||
shocks; | ||
var ub; | ||
periods 1:1; | ||
values 0.005; | ||
end; | ||
|
||
simul(periods=200, maxit=500, stack_solve_algo=0); | ||
|
||
figure(1) | ||
subplot(311) | ||
plot(1200*r); | ||
title('r') | ||
hold on | ||
xlim([0 50]) | ||
subplot(312) | ||
plot(y/yss-1); | ||
title('y/yss'); | ||
hold on | ||
xlim([0 50]) | ||
subplot(313) | ||
plot(pi); | ||
title('pi'); | ||
hold on | ||
xlim([0 50]) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
var c n y r pi yhat ghat g beta; | ||
varexo ub ug; | ||
|
||
parameters alpha gamma chi varphi epsilon betass rhog rhob gbar phipi phig; | ||
|
||
@# define stochastic = 0 | ||
|
||
gamma = 2; | ||
chi = 11; | ||
varphi = 1; | ||
epsilon = 7; | ||
betass = (1/1.04)^(1/12); | ||
rhob = 0.95; | ||
rhog = 0.9; | ||
alpha = 0.9; | ||
gbar = 0.07; | ||
phipi = 2; | ||
phig = 0; | ||
|
||
model; | ||
# nu_u = gamma*STEADY_STATE(y)/STEADY_STATE(c); | ||
# nu_v = varphi*STEADY_STATE(y)/STEADY_STATE(n); | ||
# capgamma = nu_u/(nu_u + nu_v); | ||
# kappa = (1-alpha)*(1-alpha*betass)/alpha*(nu_u + nu_v); | ||
y = n; | ||
y = c + g; | ||
yhat-ghat = yhat(+1)-ghat(+1) - 1/nu_u*(r - pi(+1) + log(beta(+1))); | ||
yhat = log(y/STEADY_STATE(y)); | ||
ghat = (g-STEADY_STATE(g))/STEADY_STATE(y); | ||
pi = beta(+1)*pi(+1) + kappa*(yhat-capgamma*ghat); | ||
r = max(-log(betass) + phipi*pi + phig*log(g/gbar),0); | ||
%r = -log(betass) + phipi*pi + phig*log(g/gbar); | ||
g/gbar = (g(-1)/gbar)^rhog*exp(ug); | ||
beta/betass = (beta(-1)/betass)^rhob*exp(ub); | ||
end; | ||
|
||
shocks; | ||
var ug; stderr .01; | ||
var ub; stderr .01; | ||
end; | ||
|
||
yss = fsolve(@(y) epsilon/(epsilon-1)*chi*y^varphi*(y-gbar)^gamma - 1, 0.5); | ||
|
||
initval; | ||
beta = betass; | ||
g = gbar; | ||
r = -log(beta); | ||
y = yss; | ||
c = y - g; | ||
n = y; | ||
end; | ||
|
||
steady; | ||
|
||
@# if stochastic==1 | ||
shocks; | ||
var ub; stderr .01; | ||
var ug; stderr .01; | ||
end; | ||
stoch_simul(order=1,nograph,noprint,nomoments,nocorr,nofunctions); | ||
irf_calvo_ub | ||
@# else | ||
shocks; | ||
var ub; | ||
periods 1:1 2:200; | ||
values 0.01 0; | ||
end; | ||
simul(periods=200, maxit=500, stack_solve_algo=0); | ||
figure(1) | ||
subplot(311) | ||
plot(1200*r); | ||
title('r') | ||
hold on | ||
xlim([0 50]) | ||
subplot(312) | ||
plot(y/yss-1); | ||
title('y/yss'); | ||
hold on | ||
xlim([0 50]) | ||
subplot(313) | ||
plot(1200*pi); | ||
title('pi'); | ||
hold on | ||
xlim([0 50]) | ||
@# endif | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
var c n y r pi pstar w Delta K F; | ||
var beta g; | ||
varexo ub ug; | ||
|
||
parameters gamma betass chi varphi epsilon rhob rhog lambda gbar phir phipi phig; | ||
|
||
gamma = 2; | ||
chi = 11; | ||
varphi = 1; | ||
epsilon = 7; | ||
betass = (1/1.04)^(1/12); | ||
rhob = 0.95; | ||
rhog = 0.9; | ||
lambda = 1/10; | ||
gbar = 0.07; | ||
phipi = 2; | ||
phig = 0; | ||
phir = 0; | ||
|
||
model; | ||
c^(-gamma)*w = chi*n^varphi; | ||
1 = r*beta(+1)*(c(+1)/c)^(-gamma)/pi(+1); | ||
n = y*Delta; | ||
y = c + g; | ||
1 = lambda*pstar^(1-epsilon) + (1-lambda)*pi^(epsilon-1); | ||
Delta = lambda*pstar^(-epsilon) + (1-lambda)*pi^epsilon*Delta(-1); | ||
pstar = K/F; | ||
K = c^(-gamma)*epsilon/(epsilon-1)*w*y + beta(+1)*(1-lambda)*pi(+1)^epsilon*K(+1); | ||
F = c^(-gamma)*y + beta(+1)*(1-lambda)*pi(+1)^(epsilon-1)*F(+1); | ||
r = max((1/betass)*(r(-1)/(1/betass))^phir*((pi/1)^phipi*(g/gbar)^phig)^(1-phir),1); | ||
g/gbar = (g(-1)/gbar)^rhog*exp(ug); | ||
beta/betass = (beta(-1)/betass)^rhob*exp(ub); | ||
end; | ||
|
||
|
||
yss = fsolve(@(y) epsilon/(epsilon-1)*chi*y^varphi*(y-gbar)^gamma - 1, .3); | ||
|
||
initval; | ||
y = yss; | ||
g = gbar; | ||
c = y - g; | ||
n = y; | ||
beta = betass; | ||
r = 1/beta; | ||
pi = 1; | ||
pstar = 1; | ||
w = chi*n^varphi*c^gamma; | ||
Delta = 1; | ||
K = c^(-gamma)*epsilon/(epsilon-1)*w*y/(1-beta*lambda); | ||
F = c^(-gamma)*y/(1-beta*lambda); | ||
end; | ||
|
||
steady; | ||
|
||
shocks; | ||
var ub; | ||
periods 1:1 ; | ||
values 0.005; | ||
end; | ||
|
||
simul(periods=200, maxit=500, stack_solve_algo=0); | ||
|
||
figure(1) | ||
subplot(311) | ||
plot(1200*(r-1)); | ||
title('r') | ||
hold on | ||
xlim([0 50]) | ||
subplot(312) | ||
plot(y/yss-1); | ||
title('y/yss'); | ||
hold on | ||
xlim([0 50]) | ||
subplot(313) | ||
plot(pi-1); | ||
title('pi'); | ||
hold on | ||
xlim([0 50]) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
var c n y r pi pstar w Delta K F; | ||
var beta g; | ||
varexo ub ug; | ||
|
||
parameters gamma betass chi varphi epsilon rhob rhog lambda gbar phir phipi phig; | ||
|
||
@# define stochastic = 0 | ||
|
||
gamma = 2; | ||
chi = 11; | ||
varphi = 1; | ||
epsilon = 7; | ||
betass = (1/1.04)^(1/12); | ||
rhob = 0.95; | ||
rhog = 0.9; | ||
lambda = 1/10; | ||
gbar = 0.07; | ||
phipi = 2; | ||
phig = 0; | ||
phir = 0; | ||
|
||
model; | ||
c^(-gamma)*w = chi*n^varphi; | ||
1 = r*beta(+1)*(c(+1)/c)^(-gamma)/pi(+1); | ||
n = y*Delta; | ||
y = c + g; | ||
1 = lambda*pstar^(1-epsilon) + (1-lambda)*pi^(epsilon-1); | ||
Delta = lambda*pstar^(-epsilon) + (1-lambda)*pi^epsilon*Delta(-1); | ||
pstar = K/F; | ||
K = c^(-gamma)*epsilon/(epsilon-1)*w*y + beta(+1)*(1-lambda)*pi(+1)^epsilon*K(+1); | ||
F = c^(-gamma)*y + beta(+1)*(1-lambda)*pi(+1)^(epsilon-1)*F(+1); | ||
r = max((1/betass)*(r(-1)/(1/betass))^phir*((pi/1)^phipi*(g/gbar)^phig)^(1-phir),1); | ||
%r = ((1/betass)*(r(-1)/(1/betass))^phir*((pi/1)^phipi*(g/gbar)^phig)^(1-phir)); | ||
g/gbar = (g(-1)/gbar)^rhog*exp(ug); | ||
beta/betass = (beta(-1)/betass)^rhob*exp(ub); | ||
end; | ||
|
||
|
||
yss = fsolve(@(y) epsilon/(epsilon-1)*chi*y^varphi*(y-gbar)^gamma - 1, .3); | ||
initval; | ||
y = yss; | ||
g = gbar; | ||
c = y - g; | ||
n = y; | ||
beta = betass; | ||
r = 1/beta; | ||
pi = 1; | ||
pstar = 1; | ||
w = chi*n^varphi*c^gamma; | ||
Delta = 1; | ||
K = c^(-gamma)*epsilon/(epsilon-1)*w*y/(1-beta*lambda); | ||
F = c^(-gamma)*y/(1-beta*lambda); | ||
end; | ||
|
||
steady; | ||
|
||
@# if stochastic==1 | ||
shocks; | ||
var ub; stderr .01; | ||
var ug; stderr .01; | ||
end; | ||
stoch_simul(order=1,nograph,noprint,nomoments,nocorr,nofunctions); | ||
irf_calvo_ub | ||
@# else | ||
shocks; | ||
var ub; | ||
periods 1:1 2:200; | ||
values 0.01 0; | ||
end; | ||
simul(periods=200, maxit=500, stack_solve_algo=0); | ||
figure(1) | ||
subplot(311) | ||
plot(1200*(r-1)); | ||
title('r') | ||
hold on | ||
xlim([0 50]) | ||
subplot(312) | ||
plot(y/yss-1); | ||
title('y/yss'); | ||
hold on | ||
xlim([0 50]) | ||
subplot(313) | ||
plot(1200*(pi-1)); | ||
title('pi'); | ||
hold on | ||
xlim([0 50]) | ||
@# endif | ||
|
||
|
||
|
Oops, something went wrong.