<< simulate Creation and simulation of macroeconometric models Printings and graphs >>

grocer >> Creation and simulation of macroeconometric models > simulate_eq

simulate_eq

simulate an equation of a model

CALLING SEQUENCE

[sim_eq,model_eq]=simulate_eq(model,model_db,name_eq,name_endo,startdate,enddate,arg1,...,argn)

PARAMETERS

Input

* model = a model typed list created by the function create_model

* model_db = a tsmat, containing values for endogenous, exogenous and residuals variables (perferably created by the function create_dbmod)

* name_eq = the name of the equation

* name_endo = the name of the variable in the equation that will be considered as endogenous

* startdate = a string, the starting date of the simulation

* enddate = a string, the end date of the simulation

* arg1,...,argn = optional arguments that should start with:

   - an interger, the lag used for the starting values of the simulation (0: current values in the database,1: the results of the simulation at the previous period)

   - a string, the starting date for the preservation of the data in the tsmat output

   - a string, the final date for the preservation of the data in the tsmat output

and thereafter optional arguments, among which:

   -'meth=xx' where xx is either 'Newton' for the Newton method or 'Gauss-Seidel' for the Gauss-Seidel method

   -'ftol=xx' where xx is the value of the convergence criterion for the function absolute value (default: 1e-8)

   -'deltol=xx' where xx is the value of the convergence criterion for the absolute value of the variation of the endogenous variables (default: 1e-8)

   -'exp=xx' where xx is the value of the exponent applied to the number of endogenous variables in the heart to

obtain the number of Gauss-Seidel simulations performed before switching back to the Newton method, when the Newton method hs not converged intially (default: 0.5)

Output

* sim_eq = a tsmat, containing the results of the simulation, with:

   - result('meth') = 'model simulation'

   - result('model name') = a string, the name of the simulated model

   - result('model') = a model tlist, used for the simulation

   - result('simulation results') = a tsmat, the results of the simulation

   - result('function values') = a (N X 1) vector, collecting the errors terms of the equations

* model_eq = the model created from the selected equation

DESCRIPTION

Simulates an equation of a model.

EXAMPLE

global GROCERDIR;
// load the model small:
load(GROCERDIR+'\data\small.dat')
// load the database small_db:
load(GROCERDIR+'\data\small_db.dat')
// simulate the 'td_p3m_d1' equation of model small on the period '1981q1' to
// '2006q4', with variable td_p3m_d1 as an endogenous variable
s=simulate_eq(small,small_db,'td_p3m_d1','td_p3m_d1','1981q1','2006q4')
s_db=s('simulation results');
// display the percentage error of the simulated and original database for variable
// td_p3m_d1
prt_tsmat('pcer',['1981q1';'2006q4'],list('small_db','s_db'),'td_p3m_d1')

AUTHOR

Éric Dubois 2019

Report an issue
<< simulate Creation and simulation of macroeconometric models Printings and graphs >>