Testsuite: remove obsolete Julia tests

remove-submodule
Sébastien Villemot 2023-06-12 13:58:57 +02:00
parent 37870e4a40
commit 9c88bab247
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
8 changed files with 0 additions and 343 deletions

View File

@ -1,16 +0,0 @@
To compile the Dynare mod files ```rbc1.mod``` and/or ```rbc2.mod``` and produce a julia module, just do
```
include("test1.jl")
```
```
include("test2.jl")
```
or
```
include("test3.jl")
```
in a script or in julia's shell. The first script, evaluates the steady state of the model, using analytical solution or a numerical solver. The two other scripts do nothing except compiling the mod files. The ```test1pfm.jl``` script shows how to solve a perfect foresight model (transition to the steady state or effects of an expected shock).
Note that Julia's packages ```NLsolve.jl``` and ```PyPlot.jl``` are required.

View File

@ -1,8 +0,0 @@
#/bin/sh
rm -f *~
rm -f rbc1.jl rbc2.jl
rm -f rbc1Dynamic.jl rbc2Dynamic.jl
rm -f rbc1Static.jl rbc2Static.jl
rm -f rbc1SteadyState2.jl
rm -f rbc1_set_auxiliary_variables.jl rbc2_set_auxiliary_variables.jl
rm -rf rbc1 rbc2

View File

@ -1,76 +0,0 @@
var Capital , Output, Labour, Consumption, Efficiency, efficiency ;
varexo EfficiencyInnovation;
parameters beta, theta, tau, alpha, Epsilon, delta, rho, effstar, sigma;
beta = 0.990;
theta = 0.357;
tau = 30.000;
alpha = 0.450;
delta = 0.020;
rho = 0.950;
effstar = 1.500;
sigma = 0.010;
Epsilon = 0.500;
model;
#Psi = (Epsilon-1)/Epsilon;
// Eq. n°1:
efficiency = rho*efficiency(-1) + sigma*EfficiencyInnovation;
// Eq. n°2:
Efficiency = effstar*exp(efficiency);
// 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)*Efficiency^((1-Psi))*(alpha*(Capital(-1)/Labour)^Psi+1-alpha)^((1-Psi)/Psi);
// Eq. n°6:
(((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption
- beta*(Consumption(1)^theta*(1-Labour(1))^(1-theta))^(1-tau)/Consumption(1)*(alpha*Efficiency(1)^Psi*(Output(1)/Capital)^(1-Psi)+1-delta);
end;
steady_state_model;
efficiency = 0;
Efficiency = effstar;
psi = (Epsilon-1)/Epsilon;
Output_per_unit_of_Capital = ( (1/beta-1+delta) / (alpha*effstar^psi) )^(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)^psi-alpha)^(1/psi)/(1-alpha)^(1/psi);
gamma_1 = theta*(1-alpha)/(1-theta)*(Output_per_unit_of_Capital/Labour_per_unit_of_Capital)^(1-psi);
gamma_2 = (Output_per_unit_of_Capital-delta)/Labour_per_unit_of_Capital;
Labour = 1/(1+gamma_2/gamma_1);
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;
ShareOfCapital= alpha^(1/(1-psi))*effstar^psi/(1/beta-1+delta)^(psi/(1-psi));
Consumption = Consumption_per_unit_of_Labour*Labour;
Capital = Labour/Labour_per_unit_of_Capital;
Output = Output_per_unit_of_Capital*Capital;
end;
shocks;
var EfficiencyInnovation = 1;
end;

View File

@ -1,44 +0,0 @@
var Capital , Output, Labour, Consumption, Efficiency, efficiency ;
varexo EfficiencyInnovation;
parameters beta, theta, tau, alpha, Epsilon, delta, rho, effstar, sigma;
beta = 0.990;
theta = 0.357;
tau = 30.000;
alpha = 0.450;
delta = 0.020;
rho = 0.950;
effstar = 1.500;
sigma = 0.010;
Epsilon = 0.500;
model;
#Psi = (Epsilon-1)/Epsilon;
// Eq. n°1:
efficiency = rho*efficiency(-1) + sigma*EfficiencyInnovation;
// Eq. n°2:
Efficiency = effstar*exp(efficiency);
// 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)*Efficiency^((1-Psi))*(alpha*(Capital(-1)/Labour)^Psi+1-alpha)^((1-Psi)/Psi);
// Eq. n°6:
(((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption
- beta*(Consumption(1)^theta*(1-Labour(1))^(1-theta))^(1-tau)/Consumption(1)*(alpha*Efficiency(1)^Psi*(Output(1)/Capital)^(1-Psi)+1-delta);
end;
shocks;
var EfficiencyInnovation = 1;
end;

View File

@ -1,80 +0,0 @@
# Modification of the path (for packages). Should be done in ~/.juliarc.jl with a fixed path instead.
if isempty(findin([abspath("../../../julia")], LOAD_PATH))
unshift!(LOAD_PATH, abspath("../../../julia"))
end
using Dynare
using SteadyState
# Compile the rbc.mod file -> produce a module with the model definition.
@dynare "rbc1.mod"
# First call to the steady state routine (analytical)
@time SteadyState.steady!(model_, oo_)
# First call to the steady state routine (analytical)
@time SteadyState.steady!(model_, oo_)
steadyState = deepcopy(oo_.steady_state)
y_init = copy(steadyState)
y_init[1] = 1.1*steadyState[1]
y_init[2] = 0.9*steadyState[2]
# First call to the steady state routine (numerical)
println("First call to the numerical steady state routine")
@time SteadyState.steady!(model_, oo_, y_init)
# Check results
@assert maximum(abs.(oo_.steady_state-steadyState))<1e-6
yinit = deepcopy(steadyState)
yinit[1] = 1.1*steadyState[1]
yinit[2] = 0.9*steadyState[2]
# Second call to the steady state routine (numerical)
println("Second call to the numerical steady state routine")
@time SteadyState.steady!(model_, oo_, yinit)
params = model_.params
# change alpha
println("Change α")
model_.params = deepcopy(params)
model_.params[4] = max(min(1.0, params[4]*1.1), 0.0)
@time ys = SteadyState.steady(model_, oo_) # Analytical steady state
@time SteadyState.steady!(model_, oo_, steadyState)
@assert maximum(abs.(oo_.steady_state-ys))<1e-6
# change delta
println("Change δ")
model_.params = deepcopy(params)
model_.params[6] = max(min(1.0, params[6]*1.1), 0.0)
@time ys = SteadyState.steady(model_, oo_) # Analytical steady state
@time SteadyState.steady!(model_, oo_, steadyState)
@assert maximum(abs.(oo_.steady_state-ys))<1e-6
# change beta
println("Change β")
model_.params = deepcopy(params)
model_.params[1] = max(min(1-1e-6, params[1]*0.99), 0.0)
@time ys = SteadyState.steady(model_, oo_) # Analytical steady state
@time SteadyState.steady!(model_, oo_, steadyState)
@assert maximum(abs.(oo_.steady_state-ys))<1e-6
# change tau
println("Change τ")
model_.params = deepcopy(params)
model_.params[3] = params[3]/1.1
@time ys = SteadyState.steady(model_, oo_)
@time SteadyState.steady!(model_, oo_, steadyState)
@assert maximum(abs.(oo_.steady_state-ys))<1e-6
# change Epsilon
println("Change ϵ")
model_.params = deepcopy(params)
model_.params[5] = params[5]*1.1
@time ys = SteadyState.steady(model_, oo_)
@time SteadyState.steady!(model_, oo_, steadyState)
@assert maximum(abs.(oo_.steady_state-ys))<1e-6

View File

@ -1,84 +0,0 @@
# Modification of the path (for packages). Should be done in ~/.juliarc.jl with a fixed path instead.
if isempty(findin([abspath("../../../julia")], LOAD_PATH))
unshift!(LOAD_PATH, abspath("../../../julia"))
end
# Load packages
using Plots
using Dynare
using SteadyState
using PerfectForesightModelSolver
plotlyjs() # Choose a backend
# Compile the rbc.mod file -> produce a module with the model definition.
@dynare "rbc1.mod"
@time SteadyState.steady!(model_, oo_)
println(oo_.steady_state)
# Initialize paths for the endogenous variables
endogenousvariables = repmat(oo_.steady_state, 1, options_.pfmsolver.periods+2)
# Destroy part of the initial stock of physical capital.
endogenousvariables[1, 1] = .8*endogenousvariables[1, 1]
# Set path for the innovations (no shocks).
exogenousvariables = repmat(oo_.exo_steady_state', options_.pfmsolver.periods+2, 1)
# Simulate the transition to the steady state
@time simulate_perfect_foresight_model!(endogenousvariables, exogenousvariables, oo_.steady_state, model_, options_)
n = 200
dates = collect(0:n-1)
#plt[:figure](1)
plot(dates, vec(endogenousvariables[1,1:n]), color="black", linewidth=2.0, linestyle="-")
# Initialize paths for the endogenous variables
endogenousvariables = repmat(oo_.steady_state, 1, options_.pfmsolver.periods+2)
# Destroy part of the initial stock of physical capital...
endogenousvariables[1, 1] = .8*endogenousvariables[1, 1]
# ... and assume that TFP is initially above its steady state level.
endogenousvariables[6, 1] = .5
# Set path for the innovations (no shocks).
exogenousvariables = repmat(oo_.exo_steady_state', options_.pfmsolver.periods+2, 1)
# Simulate the transition to the steady state (we should have an hump shaped transition)
@time simulate_perfect_foresight_model!(endogenousvariables, exogenousvariables, oo_.steady_state, model_, options_)
n = 200
dates = collect(0:n-1)
plot(dates, vec(endogenousvariables[1,1:n]), color="red", linewidth=2.0, linestyle="-")
# Initialize paths for the endogenous variables
endogenousvariables = repmat(oo_.steady_state, 1, options_.pfmsolver.periods+2)
# Set path for the innovations (no shocks).
exogenousvariables = repmat(oo_.exo_steady_state', options_.pfmsolver.periods+2, 1)
# Assume positive expected TFP shock in period 10
exogenousvariables[10+1, 1] = 2
# Simulate the paths for the endogenous variables, given the expected shock
@time simulate_perfect_foresight_model!(endogenousvariables, exogenousvariables, oo_.steady_state, model_, options_)
# dates = collect(0:n-1)
# n = 200
# plt[:figure](2)
# subplot(221)
# title("Efficiency")
# plot(dates, vec(endogenousvariables[5,1:n]), color="black", linewidth=2.0, linestyle="-")
# subplot(223)
# title("Output")
# plot(dates, vec(endogenousvariables[2,1:n]), color="black", linewidth=2.0, linestyle="-")
# subplot(222)
# title("Consumption")
# plot(dates, vec(endogenousvariables[4,1:n]), color="black", linewidth=2.0, linestyle="-")
# subplot(224)
# title("Labour")
# plot(dates, vec(endogenousvariables[3,1:n]), color="black", linewidth=2.0, linestyle="-")
# suptitle("Expected positive expected shock")

View File

@ -1,14 +0,0 @@
# Modification of the path (for packages). Should be done in ~/.juliarc.jl with a fixed path instead.
if isempty(findin([abspath("../../../julia")], LOAD_PATH))
unshift!(LOAD_PATH, abspath("../../../julia"))
end
# Load Dynare package(s)
using Dynare
using SteadyState
# Compile the rbc.mod file -> produce a module with the model definition.
@dynare "rbc1.mod"
# Compute the steady state
steady_state!(model_, oo_)

View File

@ -1,21 +0,0 @@
# Modification of the path (for packages). Should be done in ~/.juliarc.jl with a fixed path instead.
if isempty(findin([abspath("../../../julia")], LOAD_PATH))
unshift!(LOAD_PATH, abspath("../../../julia"))
end
# Load Dynare package
importall Dynare
# Compile the rbc.mod file -> produce a module with the model definition.
@dynare "rbc1.mod" "rbc2.mod"
# The previous command is equivalent to:
#
# @compile "rbc1.mod"
# using rbc1
print(rbc1.model_.fname)
print(rbc2.model_.fname)