Commit 7667d392 authored by Stéphane Adjemian's avatar Stéphane Adjemian

Added example (RBC model with CES production function).

Julia version is between 100 and 1000 times faster than Matlab version.
parent 50ca87fc
......@@ -2,4 +2,8 @@
.juliahistory
deps/deps.jl
deps/usr/*
\ No newline at end of file
deps/usr/*
examples/rbc-ces/rbc_jDynamic.jl
examples/rbc-ces/rbc_j.jl
examples/rbc-ces/rbc_jStatic.jl
\ No newline at end of file
#!/usr/bin/sh
rm -rf rbc_jDynamic.jl rbc_j.jl rbc_jStatic.jl
rm -rf +rbc_m rbc_m rbc_m.log rbc_m_results.mat
# Put Dynare.jl files in the path.
pushfirst!(LOAD_PATH, abspath("../../src"))
using Dynare
using SteadyState
# Preprocess the modfile
@dynare "rbc_j.mod"
model = rbc_j.model_
oo = rbc_j.oo_
yinit = [0.4193967, 0.3764809, 0.3538641, 0.4032740, 0.9500000, 0, 3.051005982347480*1.0e+08]
@time steady!(model, oo, yinit)
var Capital, Output, Labour, Consumption, Efficiency, efficiency, ExpectedTerm;
varexo EfficiencyInnovation;
parameters beta, theta, tau, alpha, psi, delta, rho, effstar, sigma;
/*
** Calibration
*/
beta = 0.990;
theta = 0.357;
tau = 30.000;
alpha = 0.450;
psi = -9.000; // Elasticity of substitution is 1/(1-psi)
delta = 0.020;
rho = 0.950;
effstar = 1.000;
sigma = 0.010;
model;
// Eq. n°1:
efficiency = rho*efficiency(-1) + sigma*EfficiencyInnovation;
// Eq. n°2:
Efficiency = effstar*exp(efficiency); //-.5*sigma*sigma/(1-rho*rho)
// Eq. n°3:
Output = Efficiency*(alpha*(Capital(-1)^psi)+(1-alpha)*(Labour^psi))^(1/psi);
// Eq. n°4:
Consumption + Capital - Output - (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 - ExpectedTerm(1);
// Eq. n°7:
ExpectedTerm = beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption)*(alpha*((Output/Capital(-1))^(1-psi))+1-delta);
end;
// Compute steady state ratios.
Efficiency_ss = effstar;
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/Efficiency_ss)^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;
// Compute steady state share of capital.
ShareOfCapital=alpha/(alpha+(1-alpha)*Labour_per_unit_of_Capital^psi);
/// Compute steady state of the endogenous variables.
Labour_ss=1/(1+Consumption_per_unit_of_Labour/((1-alpha)*theta/(1-theta)*Output_per_unit_of_Labour^(1-psi)));
Consumption_ss = Consumption_per_unit_of_Labour*Labour_ss;
Capital_ss = Labour_ss/Labour_per_unit_of_Capital;
Output_ss = Output_per_unit_of_Capital*Capital_ss;
ExpectedTerm_ss = beta*((((Consumption_ss^theta)*((1-Labour_ss)^(1-theta)))^(1-tau))/Consumption_ss)*(alpha*((Output_ss/Capital_ss)^(1-psi))+1-delta);
//steady_state_model;
initval;
efficiency = 0;
Efficiency = .95*effstar;
Labour = Labour_ss;
Consumption = 1.1*Consumption_ss;
Capital = .85*Capital_ss;
Output = Output_ss;
ExpectedTerm = ExpectedTerm_ss;
end;
@#include "rbc_j.mod"
oo_.steady_state
t0 = clock();
steady;
format long
oo_.steady_state
etime(clock(), t0)
Markdown is supported
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