1function check_model(DynareModel)
2
3% Copyright (C) 2005-2013 Dynare Team
4%
5% This file is part of Dynare.
6%
7% Dynare is free software: you can redistribute it and/or modify
8% it under the terms of the GNU General Public License as published by
9% the Free Software Foundation, either version 3 of the License, or
10% (at your option) any later version.
11%
12% Dynare is distributed in the hope that it will be useful,
13% but WITHOUT ANY WARRANTY; without even the implied warranty of
14% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15% GNU General Public License for more details.
16%
17% You should have received a copy of the GNU General Public License
18% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
19
20xlen = DynareModel.maximum_exo_lag+DynareModel.maximum_exo_lead + 1;
21if ~ DynareModel.lead_lag_incidence(DynareModel.maximum_lag+1,:) > 0
22    error ('RESOL: Error in model specification: some variables don"t appear as current') ;
23end
24
25if xlen > 1
26    error (['RESOL: stochastic exogenous variables must appear only at the' ...
27            ' current period. Use additional endogenous variables']) ;
28end
29
30if (DynareModel.exo_det_nbr > 0) && (DynareModel.maximum_lag > 1 || DynareModel.maximum_lead > 1)
31    error(['Exogenous deterministic variables are currently only allowed in' ...
32           ' models with leads and lags on only one period'])
33end
34
35if ~check_consistency_covariances(DynareModel.Sigma_e)
36    error('The specified covariances for the structural errors are not consistent with the variances as they imply a correlation larger than +-1')
37end
38if ~isequal(DynareModel.H,0)
39    if ~check_consistency_covariances(DynareModel.H)
40        error('The specified covariances for the measurement errors are not consistent with the variances as they imply a correlation larger than +-1')
41    end
42end