Home > matlab > initial_estimation_checks.m

initial_estimation_checks

PURPOSE ^

function initial_estimation_checks(xparam1,gend,data,data_index,number_of_observations,no_more_missing_observations)

SYNOPSIS ^

function DynareResults = initial_estimation_checks(objective_function,xparam1,DynareDataset,Model,EstimatedParameters,DynareOptions,BayesInfo,DynareResults)

DESCRIPTION ^

 function initial_estimation_checks(xparam1,gend,data,data_index,number_of_observations,no_more_missing_observations)
 Checks data (complex values, ML evaluation, initial values, BK conditions,..)

 INPUTS
    xparam1:          vector of parameters to be estimated
    gend:             scalar specifying the number of observations
    data:             matrix of data

 OUTPUTS
    DynareResults     structure of temporary results

 SPECIAL REQUIREMENTS
    none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function DynareResults = initial_estimation_checks(objective_function,xparam1,DynareDataset,Model,EstimatedParameters,DynareOptions,BayesInfo,DynareResults)
0002 % function initial_estimation_checks(xparam1,gend,data,data_index,number_of_observations,no_more_missing_observations)
0003 % Checks data (complex values, ML evaluation, initial values, BK conditions,..)
0004 %
0005 % INPUTS
0006 %    xparam1:          vector of parameters to be estimated
0007 %    gend:             scalar specifying the number of observations
0008 %    data:             matrix of data
0009 %
0010 % OUTPUTS
0011 %    DynareResults     structure of temporary results
0012 %
0013 % SPECIAL REQUIREMENTS
0014 %    none
0015 
0016 % Copyright (C) 2003-2011 Dynare Team
0017 %
0018 % This file is part of Dynare.
0019 %
0020 % Dynare is free software: you can redistribute it and/or modify
0021 % it under the terms of the GNU General Public License as published by
0022 % the Free Software Foundation, either version 3 of the License, or
0023 % (at your option) any later version.
0024 %
0025 % Dynare is distributed in the hope that it will be useful,
0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0028 % GNU General Public License for more details.
0029 %
0030 % You should have received a copy of the GNU General Public License
0031 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0032 
0033 if DynareDataset.info.nvobs>Model.exo_nbr+EstimatedParameters.nvn
0034     error(['initial_estimation_checks:: Estimation can''t take place because there are less shocks than observed variables!'])
0035 end
0036 
0037 % check if steady state solves static model (except if diffuse_filter == 1)
0038 [DynareResults.steady_state] = evaluate_steady_state(DynareResults.steady_state,Model,DynareOptions,DynareResults,DynareOptions.diffuse_filter==0);
0039 
0040 % Evaluate the likelihood.
0041 [fval,junk1,junk2,a,b,c,d] = feval(objective_function,xparam1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);
0042 
0043 if DynareOptions.dsge_var || strcmp(func2str(objective_function),'non_linear_dsge_likelihood')
0044     info = b;
0045 else
0046     info = d;
0047 end
0048 
0049 if DynareOptions.mode_compute==5
0050     if ~strcmp(func2str(objective_function),'dsge_likelihood')
0051         error('Options mode_compute=5 is not compatible with non linear filters or Dsge-VAR models!')
0052     end
0053 end
0054 
0055 if info(1) > 0
0056     disp('Error in computing likelihood for initial parameter values')
0057     print_info(info, DynareOptions.noprint)
0058 end
0059 
0060 if any(abs(DynareResults.steady_state(BayesInfo.mfys))>1e-9) && (DynareOptions.prefilter==1)
0061     disp(['You are trying to estimate a model with a non zero steady state for the observed endogenous'])
0062     disp(['variables using demeaned data!'])
0063     error('You should change something in your mod file...')
0064 end
0065 
0066 disp(['Initial value of the log posterior (or likelihood): ' num2str(-fval)]);

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005