Commit 7a875fe5 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added new test files for (Stochastic) Extended Path method. Simulation of an...

Added new test files for (Stochastic) Extended Path method. Simulation of an RBC model with CES technology and irreversible investment constraint.
parent 3815daad
@#define extended_path_version = 1
var Capital, Output, Labour, Consumption, Efficiency, efficiency, ExpectedTerm, LagrangeMultiplier;
varexo EfficiencyInnovation;
parameters beta, theta, tau, alpha, psi, delta, rho, effstar, sigma2;
/*
** Calibration
*/
beta = 0.990;
theta = 0.357;
tau = 2.000;
alpha = 0.450;
psi = -0.500;
delta = 0.020;
rho = 0.995;
effstar = 1.000;
sigma2 = 0.001;
@#if extended_path_version
rho = 0.800;
@#endif
external_function(name=mean_preserving_spread);
model(block,bytecode,cutoff=0);
// Eq. n°1:
efficiency = rho*efficiency(-1) + EfficiencyInnovation;
// Eq. n°2:
Efficiency = effstar*exp(efficiency-mean_preserving_spread(rho));
// Eq. n°3:
Output = Efficiency*(alpha*(Capital(-1)^psi)+(1-alpha)*(Labour^psi))^(1/psi);
// Eq. n°4:
Capital = max(Output-Consumption + (1-delta)*Capital(-1),(1-delta)*Capital(-1));
// Eq. n°5:
((1-theta)/theta)*(Consumption/(1-Labour)) - (1-alpha)*(Output/Labour)^(1-psi);
// Eq. n°6:
(((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption - LagrangeMultiplier - ExpectedTerm(1);
// Eq. n°7:
(Capital==(1-delta)*Capital(-1))*(Output-Consumption) + (1-(Capital==(1-delta)*Capital(-1)))*LagrangeMultiplier = 0;
// Eq. n°8:
ExpectedTerm = beta*(((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption)*(alpha*((Output/Capital(-1))^(1-psi))+(1-delta))-(1-delta)*LagrangeMultiplier);
end;
@#if extended_path_version
shocks;
var EfficiencyInnovation = sigma2;
end;
steady;
options_.maxit_ = 100;
options_.ep.verbosity = 0;
options_.ep.stochastic = 0;
options_.console_mode = 0;
ts = extended_path([],100);
plot(ts(2,:)-ts(4,:));
@#else
shocks;
var EfficiencyInnovation;
periods 1;
values -.4;
end;
steady;
options_.maxit_ = 100;
simul(periods=4000);
n = 100;
plot(Output(1:n)-Consumption(1:n),'-b','linewidth',2)
@#endif
\ No newline at end of file
function [ys, info] = rbcii_steadystate(ys, exogenous)
% Steady state routine for rbc.mod (Business Cycle model with endogenous labour and CES production function)
% AUTHOR(S)
% stephane DOT adjemian AT univ DASH lemans DOT fr
% frederic DOT karame AT univ DASH evry DOT fr
% Output_per_unit_of_Capital = (((1/beta)-1+delta)/alpha)^(1/(1-psi));
% Consumption_per_unit_of_Capital = Output_per_unit_of_Capital - delta;
% Labour_per_unit_of_Capital = (((Output_per_unit_of_Capital/effstar)^psi-alpha)/(1-alpha))^(1/psi);
% Output_per_unit_of_Labour = Output_per_unit_of_Capital/Labour_per_unit_of_Capital;
% Consumption_per_unit_of_Labour = Consumption_per_unit_of_Capital/Labour_per_unit_of_Capital;
% SteadyStateLabour = 1/(1 + Consumption_per_unit_of_Labour/((theta*(1-alpha)/(1-theta))*(Output_per_unit_of_Labour^(1-psi))));
% SteadyStateConsumption = Consumption_per_unit_of_Labour*SteadyStateLabour;
% SteadyStateCapital = SteadyStateLabour/Labour_per_unit_of_Capital;
% SteadyStateOutput = Output_per_unit_of_Capital*SteadyStateCapital;
% ShareOfCapital = alpha/(alpha+(1-alpha)*Labour_per_unit_of_Capital^psi);
global M_
info = 0;
% Compute steady state ratios.
Output_per_unit_of_Capital=((1/M_.params(1)-1+M_.params(6))/M_.params(4))^(1/(1-M_.params(5)));
Consumption_per_unit_of_Capital=Output_per_unit_of_Capital-M_.params(6);
Labour_per_unit_of_Capital=(((Output_per_unit_of_Capital/M_.params(8))^M_.params(5)-M_.params(4))/(1-M_.params(4)))^(1/M_.params(5));
Output_per_unit_of_Labour=Output_per_unit_of_Capital/Labour_per_unit_of_Capital;
Consumption_per_unit_of_Labour=Consumption_per_unit_of_Capital/Labour_per_unit_of_Capital;
% Compute steady state share of capital.
ShareOfCapital=M_.params(4)/(M_.params(4)+(1-M_.params(4))*Labour_per_unit_of_Capital^M_.params(5));
% Compute steady state of the endogenous variables.
SteadyStateLabour=1/(1+Consumption_per_unit_of_Labour/((1-M_.params(4))*M_.params(2)/(1-M_.params(2))*Output_per_unit_of_Labour^(1-M_.params(5))));
SteadyStateConsumption=Consumption_per_unit_of_Labour*SteadyStateLabour;
SteadyStateCapital=SteadyStateLabour/Labour_per_unit_of_Capital;
SteadyStateOutput=Output_per_unit_of_Capital*SteadyStateCapital;
% Fill returned argument ys with steady state values.
ys(2)=SteadyStateOutput;
ys(4)=SteadyStateConsumption;
ys(1)=SteadyStateCapital;
ys(3)=SteadyStateLabour;
ys(5)=M_.params(8);
ys(6)=0;
ys(7)=M_.params(1)*((((SteadyStateConsumption^M_.params(2))*((1-SteadyStateLabour)^(1-M_.params(2))))^(1-M_.params(3)))/SteadyStateConsumption)* ...
(M_.params(4)*((SteadyStateOutput/SteadyStateCapital)^(1-M_.params(5)))+1-M_.params(6));
ys(8)=0;
\ No newline at end of file
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