make a simulation with a model
[result]=simulate(model,tsmat,startdate,enddate,lag,fromdate,todate,arg1,...,argn)
* model = a model typed list created by the function create_model
* tsmat = a tsmat, containing values for endogenous, exogenous and residuals variables (perferably created by the function create_dbmod)
* startdate = a string, the starting date of the simulation
* enddate = a string, the end date of the simulation
* lag = an integer, 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)
* fromdate = a string, the starting date for the preservation of the data in the tsmat output
* todate = a string, the final date for the preservation of the data in the tsmat output
* arg1,...,argn = an optional argument, which can be
- '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)
* result = a tsmat, containing the results of the simulation, with:
-result('meth') = 'model simulation'
- result('model name') = a string, the name of the
- result('model') = a model tlist, used for the simulation
- result('simulation results') = a tsmat, the results of
- result('function values') = a (N X 1) vector, collecting
global GROCERDIR // load the model small load(GROCERDIR+'\data\small.dat') // load the database small_db load(GROCERDIR+'\data\small_db.dat') // simulate the small model with database small_db from 1981q1 to 2006q4, keeping // the data from 1978q1 and using the lagged endogenous variables as starting values sim_histo=simulate(small,small_db,'1981q1','2006q4',1,'1978q1','2006q4') // display the comparison of simulation results with the original database small_db prt_tsmat('pcer',['1990q1';'2006q4'],list('small_db','sim_histo(''simulation results'')'),['td_pib1','td_pib3']) | ![]() | ![]() |