Commit ebc08c6d authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Fixed bug related to the names of the matlab's structures.

parent f2ca6d0a
function oo = initial_estimation_checks(xparam1,dataset,M,estim_params,options,bayestopt,oo); %initial_estimation_checks(xparam1,gend,data,data_index,number_of_observations,no_more_missing_observations
function DynareResults = initial_estimation_checks(xparam1,DynareDataset,Model,EstimatedParameters,DynareOptions,BayesInfo,DynareResults)
% 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,..)
%
......@@ -30,54 +30,54 @@ function oo = initial_estimation_checks(xparam1,dataset,M,estim_params,options,b
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if dataset.info.nvobs>M.exo_nbr+estim_params.nvn
if DynareDataset.info.nvobs>Model.exo_nbr+EstimatedParameters.nvn
error(['initial_estimation_checks:: Estimation can''t take place because there are less shocks than observed variables!'])
end
if options.dsge_var
if DynareOptions.dsge_var
[fval,cost_flag,info] = DsgeVarLikelihood(xparam1,gend);
else
[fval,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
[fval,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);
end
% when their is an analytical steadystate, check that the values
% returned by *_steadystate match with the static model
if options.steadystate_flag
[ys,check] = feval([M.fname '_steadystate'],...
oo.steady_state,...
[oo.exo_steady_state; ...
oo.exo_det_steady_state]);
if size(ys,1) < M.endo_nbr
if length(M.aux_vars) > 0
ys = add_auxiliary_variables_to_steadystate(ys,M.aux_vars,...
M.fname,...
oo.exo_steady_state,...
oo.exo_det_steady_state,...
M.params,...
options.bytecode);
if DynareOptions.steadystate_flag
[ys,check] = feval([Model.fname '_steadystate'],...
DynareResults.steady_state,...
[DynareResults.exo_steady_state; ...
DynareResults.exo_det_steady_state]);
if size(ys,1) < Model.endo_nbr
if length(Model.aux_vars) > 0
ys = add_auxiliary_variables_to_steadystate(ys,Model.aux_vars,...
Model.fname,...
DynareResults.exo_steady_state,...
DynareResults.exo_det_steady_state,...
Model.params,...
DynareOptions.bytecode);
else
error([M.fname '_steadystate.m doesn''t match the model']);
error([Model.fname '_steadystate.m doesn''t match the model']);
end
end
oo.steady_state = ys;
DynareResults.steady_state = ys;
% Check if the steady state obtained from the _steadystate file is a
% steady state.
check1 = 0;
if isfield(options,'unit_root_vars') && options.diffuse_filter == 0
if isempty(options.unit_root_vars)
if ~options.bytecode
check1 = max(abs(feval([M.fname '_static'],...
oo.steady_state,...
[oo.exo_steady_state; ...
oo.exo_det_steady_state], M.params))) > options.dynatol ;
if isfield(DynareOptions,'unit_root_vars') && DynareOptions.diffuse_filter == 0
if isempty(DynareOptions.unit_root_vars)
if ~DynareOptions.bytecode
check1 = max(abs(feval([Model.fname '_static'],...
DynareResults.steady_state,...
[DynareResults.exo_steady_state; ...
DynareResults.exo_det_steady_state], Model.params))) > DynareOptions.dynatol ;
else
[info, res] = bytecode('static','evaluate',oo.steady_state,...
[oo.exo_steady_state; ...
oo.exo_det_steady_state], M.params);
check1 = max(abs(res)) > options.dynatol;
[info, res] = bytecode('static','evaluate',DynareResults.steady_state,...
[DynareResults.exo_steady_state; ...
DynareResults.exo_det_steady_state], Model.params);
check1 = max(abs(res)) > DynareOptions.dynatol;
end
if check1
error(['The seadystate values returned by ' M.fname ...
error(['The seadystate values returned by ' Model.fname ...
'_steadystate.m don''t solve the static model!' ])
end
end
......@@ -86,10 +86,10 @@ end
if info(1) > 0
disp('Error in computing likelihood for initial parameter values')
print_info(info, options.noprint)
print_info(info, DynareOptions.noprint)
end
if any(abs(oo.steady_state(bayestopt.mfys))>1e-9) && (options.prefilter==1)
if any(abs(DynareResults.steady_state(bayestopt.mfys))>1e-9) && (DynareOptions.prefilter==1)
disp(['You are trying to estimate a model with a non zero steady state for the observed endogenous'])
disp(['variables using demeaned data!'])
error('You should change something in your mod file...')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment