2005-02-18 20:54:39 +01:00
|
|
|
function initial_estimation_checks(xparam1,gend,data)
|
2007-10-01 13:53:28 +02:00
|
|
|
global dr1_test bayestopt_ estim_params_ options_ oo_ M_
|
2005-02-18 20:54:39 +01:00
|
|
|
|
2007-10-01 13:53:28 +02:00
|
|
|
nv = size(data,1);
|
|
|
|
if nv-size(options_.varobs,1)
|
2005-02-18 20:54:39 +01:00
|
|
|
disp(' ')
|
2007-10-01 13:53:28 +02:00
|
|
|
disp(['Declared number of observed variables = ' int2str(size(options_.varobs,1))])
|
|
|
|
disp(['Number of variables in the database = ' int2str(nv)])
|
|
|
|
disp(' ')
|
|
|
|
error(['Estimation can''t take place because the declared number of observed' ...
|
|
|
|
'variables doesn''t match the number of variables in the database.'])
|
|
|
|
end
|
|
|
|
if nv > M_.exo_nbr+estim_params_.nvn
|
2005-02-18 20:54:39 +01:00
|
|
|
error(['Estimation can''t take place because there are less shocks than' ...
|
2007-10-01 13:53:28 +02:00
|
|
|
'observed variables'])
|
|
|
|
end
|
|
|
|
r = rank(data);
|
|
|
|
if r < nv
|
2005-02-18 20:54:39 +01:00
|
|
|
error(['Estimation can''t take place because the data are perfectly' ...
|
|
|
|
' correlated']);
|
2007-10-01 13:53:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if ~isempty(strmatch('dsge_prior_weight',M_.param_names))
|
2007-10-03 16:40:43 +02:00
|
|
|
[fval,cost_flag,info] = DsgeVarLikelihood(xparam1,gend);
|
2007-10-01 13:53:28 +02:00
|
|
|
else
|
|
|
|
[fval,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend,data);
|
|
|
|
end
|
2005-02-18 20:54:39 +01:00
|
|
|
|
2007-10-01 13:53:28 +02:00
|
|
|
% when their is an analytical steadystate, check that the values
|
|
|
|
% returned by *_steadystate match with the static model
|
|
|
|
if options_.steadystate_flag
|
|
|
|
[oo_.steady_state,check] = feval([M_.fname '_steadystate'],...
|
|
|
|
oo_.steady_state,...
|
|
|
|
[oo_.exo_steady_state; ...
|
|
|
|
oo_.exo_det_steady_state]);
|
|
|
|
% Check if the steady state obtained from the _steadystate file is a
|
|
|
|
% steady state.
|
|
|
|
check1 = 0;
|
|
|
|
if isfield(options_,'unit_root_vars')
|
|
|
|
if isempty(options_.unit_root_vars)
|
|
|
|
check1 = max(abs(feval([M_.fname '_static'],...
|
|
|
|
oo_.steady_state,...
|
|
|
|
[oo_.exo_steady_state; ...
|
|
|
|
oo_.exo_det_steady_state]))) > options_.dynatol ;
|
|
|
|
if check1
|
|
|
|
error(['The seadystate values returned by ' M_.fname ...
|
|
|
|
'_steadystate.m don''t solve the static model!' ])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2006-06-28 19:35:05 +02:00
|
|
|
|
2007-10-01 13:53:28 +02:00
|
|
|
if info(1) > 0
|
|
|
|
disp('Error in computing likelihood for initial parameter values')
|
|
|
|
print_info(info)
|
|
|
|
end
|
2006-08-10 16:33:14 +02:00
|
|
|
|
2007-10-01 13:53:28 +02:00
|
|
|
disp(['Initial value of the log posterior (or likelihood): ' num2str(-fval)]);
|