File: simul.m

package info (click to toggle)
dynare 4.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 40,640 kB
  • sloc: fortran: 82,231; cpp: 72,734; ansic: 28,874; pascal: 13,241; sh: 4,300; objc: 3,281; yacc: 2,833; makefile: 1,288; lex: 1,162; python: 162; lisp: 54; xml: 8
file content (108 lines) | stat: -rw-r--r-- 3,141 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
function simul()
% Computes deterministic simulations
%  
% INPUTS
%   None
%  
% OUTPUTS
%   none
%    
% ALGORITHM
%   
% SPECIAL REQUIREMENTS
%   none

% Copyright (C) 1996-2012 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

global M_ options_ oo_

test_for_deep_parameters_calibration(M_);

if options_.stack_solve_algo < 0 || options_.stack_solve_algo > 6
    error('SIMUL: stack_solve_algo must be between 0 and 6')
end

if ~options_.block && ~options_.bytecode && options_.stack_solve_algo ~= 0 ...
        && options_.stack_solve_algo ~= 6
    error('SIMUL: you must use stack_solve_algo=0 or stack_solve_algo=6 when not using block nor bytecode option')
end

if options_.block && ~options_.bytecode && options_.stack_solve_algo == 5
    error('SIMUL: you can''t use stack_solve_algo = 5 without bytecode option')
end

if (options_.block || options_.bytecode) && options_.stack_solve_algo == 6
    error('SIMUL: you can''t use stack_solve_algo = 6 with block or bytecode option')
end

if exist('OCTAVE_VERSION') && options_.stack_solve_algo == 2
    error('SIMUL: you can''t use stack_solve_algo = 2 under Octave')
end

if size(M_.lead_lag_incidence,2)-nnz(M_.lead_lag_incidence(M_.maximum_endo_lag+1,:)) > 0
    mess = ['SIMUL: error in model specification : variable ' M_.endo_names(find(M_.lead_lag_incidence(M_.maximum_lag+1,:)==0),:)] ;
    mess = [mess ' doesn''t appear as current variable.'] ; 
    error (mess) ;
end

if options_.periods == 0
    error('SIMUL: number of periods for the simulation isn''t specified')
end

if ~ options_.initval_file
    if ~isfield(options_,'datafile')
        make_ex_;
        make_y_;
    else
        read_data_;
    end
end

if isempty(options_.scalv) || options_.scalv == 0
    options_.scalv = oo_.steady_state ;
end

options_.scalv= 1 ;

if(options_.block)
    if(options_.bytecode)
        [info, oo_.endo_simul] = bytecode('dynamic');
        mexErrCheck('bytecode', info);
    else
        eval([M_.fname '_dynamic']);
    end;
else
    if(options_.bytecode)
        [info, oo_.endo_simul]=bytecode('dynamic');
        mexErrCheck('bytecode', info);
    else
        if M_.maximum_endo_lead == 0 % Purely backward model
            sim1_purely_backward;
        elseif M_.maximum_endo_lag == 0 % Purely forward model
            sim1_purely_forward;
        else % General case
            if options_.stack_solve_algo == 0
                sim1;
            else % stack_solve_algo = 6
                sim1_lbj;
            end
        end
    end;
end;

dyn2vec;