| 1 |
options_.debug=true; |
| 2 |
|
| 3 |
options_.lik_init=1; |
| 4 |
estimation(order=1,datafile='../fsdat_simul',nobs=192,mode_file=@{mode_file_name},mode_compute=0,kalman_algo=1,loglinear,mh_replic=0,smoother,filtered_vars,forecast=8,filter_step_ahead=[1:8],consider_all_endogenous); |
| 5 |
fval_algo_1=oo_.likelihood_at_initial_parameters; |
| 6 |
if isfield(oo_,'SmoothedMeasurementErrors') |
| 7 |
SmoothedMeasurementErrors(:,:,1)=cell2mat(struct2cell(oo_.SmoothedMeasurementErrors)); |
| 8 |
end |
| 9 |
SmoothedShocks(:,:,1)=cell2mat(struct2cell(oo_.SmoothedShocks)); |
| 10 |
SmoothedVariables(:,:,1)=cell2mat(struct2cell(oo_.SmoothedVariables)); |
| 11 |
|
| 12 |
options_.lik_init=1; |
| 13 |
estimation(order=1,datafile='../fsdat_simul',nobs=192,mode_file=@{mode_file_name},mode_compute=0,kalman_algo=2,loglinear,mh_replic=0,smoother,filtered_vars,forecast=8,filter_step_ahead=[1:8],consider_all_endogenous); |
| 14 |
fval_algo_2=oo_.likelihood_at_initial_parameters; |
| 15 |
if isfield(oo_,'SmoothedMeasurementErrors') |
| 16 |
SmoothedMeasurementErrors(:,:,2)=cell2mat(struct2cell(oo_.SmoothedMeasurementErrors)); |
| 17 |
end |
| 18 |
SmoothedShocks(:,:,2)=cell2mat(struct2cell(oo_.SmoothedShocks)); |
| 19 |
SmoothedVariables(:,:,2)=cell2mat(struct2cell(oo_.SmoothedVariables)); |
| 20 |
|
| 21 |
options_.lik_init=1; |
| 22 |
estimation(order=1,datafile='../fsdat_simul',nobs=192,mode_file=@{mode_file_name},mode_compute=0,kalman_algo=3,loglinear,mh_replic=0,smoother,filtered_vars,forecast=8,filter_step_ahead=[1:8],consider_all_endogenous); |
| 23 |
fval_algo_3=oo_.likelihood_at_initial_parameters; |
| 24 |
if isfield(oo_,'SmoothedMeasurementErrors') |
| 25 |
SmoothedMeasurementErrors(:,:,3)=cell2mat(struct2cell(oo_.SmoothedMeasurementErrors)); |
| 26 |
end |
| 27 |
SmoothedShocks(:,:,3)=cell2mat(struct2cell(oo_.SmoothedShocks)); |
| 28 |
SmoothedVariables(:,:,3)=cell2mat(struct2cell(oo_.SmoothedVariables)); |
| 29 |
|
| 30 |
options_.lik_init=1; |
| 31 |
estimation(order=1,datafile='../fsdat_simul',nobs=192,mode_file=@{mode_file_name},mode_compute=0,kalman_algo=4,loglinear,mh_replic=0,smoother,filtered_vars,forecast=8,filter_step_ahead=[1:8],consider_all_endogenous); |
| 32 |
fval_algo_4=oo_.likelihood_at_initial_parameters; |
| 33 |
if isfield(oo_,'SmoothedMeasurementErrors') |
| 34 |
SmoothedMeasurementErrors(:,:,4)=cell2mat(struct2cell(oo_.SmoothedMeasurementErrors)); |
| 35 |
end |
| 36 |
SmoothedShocks(:,:,4)=cell2mat(struct2cell(oo_.SmoothedShocks)); |
| 37 |
SmoothedVariables(:,:,4)=cell2mat(struct2cell(oo_.SmoothedVariables)); |
| 38 |
|
| 39 |
if isfield(oo_,'SmoothedMeasurementErrors') |
| 40 |
if max(max(abs(SmoothedMeasurementErrors-repmat(SmoothedMeasurementErrors(:,:,1),[1,1,4]))))>1e-6 |
| 41 |
error('SmoothedMeasurementErrors do not match') |
| 42 |
end |
| 43 |
end |
| 44 |
|
| 45 |
if max(max(abs(SmoothedShocks-repmat(SmoothedShocks(:,:,1),[1,1,4]))))>1e-6 |
| 46 |
error('SmoothedShocks do not match') |
| 47 |
end |
| 48 |
|
| 49 |
if max(max(abs(SmoothedVariables-repmat(SmoothedVariables(:,:,1),[1,1,4]))))>1e-6 |
| 50 |
error('SmoothedVariables do not match') |
| 51 |
end |
| 52 |
|
| 53 |
if max(abs([fval_algo_2,fval_algo_3,fval_algo_4]-fval_algo_1))>1e-5 |
| 54 |
error('Likelihoods do not match') |
| 55 |
end |