Skip to content

Instantly share code, notes, and snippets.

View stepan-a's full-sized avatar

Stéphane Adjemian stepan-a

View GitHub Profile
@stepan-a
stepan-a / example_dseries_calling_x13.m
Last active July 25, 2017 09:28
An example showing how to use the new @x13 class with dseries
% Define some data.
ydata = [ 281007.5986
309129.2123
297609.241
317353.2609
284676.2167
319282.2681
310842.9111
324842.4655
@stepan-a
stepan-a / example1_model_block_declared_vars.mod
Last active April 3, 2017 16:53
Dynare, on the fly declaration of symbol types
// Declaration of some endogenous variables.
var c;
/*
** REMARKS
**
** Some declarations for the endogenous variables are missing. They are declared below in
** the model block.
**
*/
var white_noise ar1 junk;
varexo e;
parameters phi;
phi=1;
model;
white_noise=e;
ar1=phi*ar1(-1)+e;
@stepan-a
stepan-a / gist:4f7925c52b8d59a061a0
Created April 15, 2015 16:15
log of ls2003a.mod (generated on sedna)
Starting Dynare (version 4.5-unstable).
Starting preprocessing of the model file ...
Found 11 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Processing outputs ...done
@stepan-a
stepan-a / rbc-ces-estimation.mod
Last active August 14, 2023 13:48
Estimation of an RBC model with CES production function
var Capital, Output, Labour, Consumption, Efficiency, efficiency ;
varexo EfficiencyInnovation;
parameters beta, theta, tau, alpha, Epsilon, delta, rho, effstar, sigma;
/*
** Calibration
*/
@stepan-a
stepan-a / ramst.mod
Created November 28, 2013 11:33
How to simulate a perfect foresight RBC model with a productivity level growing linearly during twenty periods from one to two (and staying permanently and this level)?
var c k;
varexo x;
parameters alph gam delt bet;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
@stepan-a
stepan-a / transition .mod
Created November 27, 2013 16:13
How to simulate a transition with noise using the extended_path command (Dynare)?
var y;
varexo e;
parameters rho, sigma, ybar;
ybar = 2;
rho = .99;
sigma = .01;
@stepan-a
stepan-a / transition.mod
Created November 27, 2013 16:05
How to simulate a transition with noise using the stoch_simul command (Dynare)?
var y;
varexo e;
parameters rho, sigma, ybar;
ybar = 2;
rho = .99;
sigma = .01;
@stepan-a
stepan-a / rbc.mod
Created October 14, 2013 11:57
Perfect foresight simulation: The RBC model.
var Consumption, Capital, Output, LoggedProductivity;
varexo LoggedProductivityInnovation ;
parameters beta, alpha, delta, rho ;
beta = .99;
alpha = .33;
delta = .02;
rho = .98;
@stepan-a
stepan-a / MatlabGlobalConstant.md
Created October 4, 2013 12:08
This set of Matlab/Octave routines illustrates why global constant should be avoided.

Global constant should be avoided in Matlab/Octave. The reason is that Matlab checks, on every call to a function with global variables, that the globals are not changed. To illustrate this we consider an example where we need to cumulate a constant. This constant can be defined as a global variable, in a function or as an input argument of a function. Running the matlab's script test.m, shows that the code with a global constant (fun_with_global_constant.m) is 30 slower than the code where the constant is defined in a function (fun_without_global_constant.m and getconstant.m) and 60 times slower than the code where the constant is passed as an argument (fun_with_arg.m).