make_y_.m: fix interaction with steady_state_model

closes https://git.dynare.org/Dynare/dynare/-/issues/1866
bgp-dev
Johannes Pfeifer 2022-10-13 12:31:36 +02:00
parent 62da76590a
commit cbbbdf4b3d
8 changed files with 171 additions and 9 deletions

View File

@ -29,12 +29,6 @@ function oo_=make_y_(M_, options_, oo_)
global ys0_
if options_.steadystate_flag
[oo_.steady_state,M_.params,~] = ...
evaluate_steady_state_file(oo_.steady_state,oo_.exo_steady_state,M_, ...
options_,~options_.steadystate.nocheck);
end
if isempty(oo_.steady_state)
oo_.steady_state = zeros(M_.endo_nbr,1);
end

View File

@ -278,6 +278,8 @@ MODFILES = \
simul/simul_ZLB_purely_forward_no_solution.mod \
simul/Irreversible_investment.mod \
simul/linear_state_space_arma.mod \
perfect_foresight/initval_endval_blocks/initval_endval_test.mod \
perfect_foresight/initval_endval_blocks/histval_initval_test.mod \
conditional_forecasts/1/fs2000_cal.mod \
conditional_forecasts/2/fs2000_est.mod \
conditional_forecasts/3/fs2000_conditional_forecast_initval.mod \

View File

@ -63,6 +63,11 @@ end;
//steady;
initval;
EfficiencyInnovation=0;
end;
steady;
shocks;
var EfficiencyInnovation;
periods 1;

View File

@ -61,7 +61,10 @@ ExpectedTerm=beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consum
LagrangeMultiplier=0;
end;
//steady;
initval;
EfficiencyInnovation=0;
end;
steady;
shocks;
var EfficiencyInnovation;

View File

@ -62,7 +62,10 @@ ExpectedTerm=beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consum
LagrangeMultiplier=0;
end;
//steady;
initval;
EfficiencyInnovation=0;
end;
steady;
shocks;
var EfficiencyInnovation;

View File

@ -62,7 +62,10 @@ ExpectedTerm=beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consum
LagrangeMultiplier=0;
end;
//steady;
initval;
EfficiencyInnovation=0;
end;
steady;
shocks;
var EfficiencyInnovation;

View File

@ -0,0 +1,76 @@
var Y K I L q KL_ratio Profit d;
predetermined_variables K;
varexo eta;
parameters alpha beta delta psi w Pi A r;
alpha = 1/3;
delta = 0.02;
beta = 0.98;
psi = 0.0003393;
Pi = 1;
A = 4.942921;
w = 20.2966;
r = 0.02;
model;
//[name = 'FOC wrt L', mcp = 'L>0']
(1-alpha)*A*((K)^alpha)*(L^(-alpha)) = w*(1-eta);
[name = 'FOC wrt K(+1)', mcp = 'q>0']
beta*alpha*A*(K(+1)^(alpha-1))*(L(+1)^(1-alpha)) + beta*(1-delta)*q(+1) = q;
KL_ratio = K/L;
//[name = 'FOC wrt I', mcp = 'I>0']
I = (1/psi)*(1 - (Pi/q));
//[name = 'Law of Motion for K', mcp = 'K>0']
K(+1) = (1-delta)*K + I - (psi/2)*(I^2);
//[name = 'Output Function', mcp = 'Y>0']
Y = A*(K^alpha)*(L^(1-alpha));
Profit = Y - w*L - Pi*I;
//[name = 'dividend definition', mcp = 'd>0']
d = Profit;
end;
steady_state_model;
KL_ratio = ( (w*(1-eta))/((1-alpha)*A) )^(1/alpha);
q = (beta*alpha*A*(KL_ratio^(alpha-1))) / (1-beta*(1-delta));
I = (1/psi) * (1 - (Pi/q));
K = (1/delta)*(I - (psi/2)*(I^2));
L = (1/KL_ratio) * K;
Y = A*(K^(alpha))*(L^(1-alpha));
Profit = Y - w*L - Pi*I;
d = Profit;
end;
histval;
K(0) = 5000;
end;
initval;
eta = 0;
K = 1000;
I = 1938.246;
q = 1.07481;
L = 42.43821;
KL_ratio = 233.6644;
Y = 36641.31;
end;
perfect_foresight_setup(periods=200);
if oo_.endo_simul(strmatch('K',M_.endo_names,'exact'),1)~=5000
error('initval does not match')
end
if oo_.endo_simul(strmatch('K',M_.endo_names,'exact'),end)~=1000
error('endval does not match')
end

View File

@ -0,0 +1,76 @@
var Y K I L q KL_ratio Profit d;
predetermined_variables K;
varexo eta;
parameters alpha beta delta psi w Pi A r;
alpha = 1/3;
delta = 0.02;
beta = 0.98;
psi = 0.0003393;
Pi = 1;
A = 4.942921;
w = 20.2966;
r = 0.02;
model;
//[name = 'FOC wrt L', mcp = 'L>0']
(1-alpha)*A*((K)^alpha)*(L^(-alpha)) = w*(1-eta);
[name = 'FOC wrt K(+1)', mcp = 'q>0']
beta*alpha*A*(K(+1)^(alpha-1))*(L(+1)^(1-alpha)) + beta*(1-delta)*q(+1) = q;
KL_ratio = K/L;
//[name = 'FOC wrt I', mcp = 'I>0']
I = (1/psi)*(1 - (Pi/q));
//[name = 'Law of Motion for K', mcp = 'K>0']
K(+1) = (1-delta)*K + I - (psi/2)*(I^2);
//[name = 'Output Function', mcp = 'Y>0']
Y = A*(K^alpha)*(L^(1-alpha));
Profit = Y - w*L - Pi*I;
//[name = 'dividend definition', mcp = 'd>0']
d = Profit;
end;
steady_state_model;
KL_ratio = ( (w*(1-eta))/((1-alpha)*A) )^(1/alpha);
q = (beta*alpha*A*(KL_ratio^(alpha-1))) / (1-beta*(1-delta));
I = (1/psi) * (1 - (Pi/q));
K = (1/delta)*(I - (psi/2)*(I^2));
L = (1/KL_ratio) * K;
Y = A*(K^(alpha))*(L^(1-alpha));
Profit = Y - w*L - Pi*I;
d = Profit;
end;
initval;
K = 5000;
end;
endval;
eta = 0;
K = 1000;
I = 1938.246;
q = 1.07481;
L = 42.43821;
KL_ratio = 233.6644;
Y = 36641.31;
end;
perfect_foresight_setup(periods=200);
if oo_.endo_simul(strmatch('K',M_.endo_names,'exact'),1)~=5000
error('initval does not match')
end
if oo_.endo_simul(strmatch('K',M_.endo_names,'exact'),end)~=1000
error('endval does not match')
end