diff --git a/tests/kalman/likelihood_from_dynare/fs2000_estimation_check.inc b/tests/kalman/likelihood_from_dynare/fs2000_estimation_check.inc index 0721204ac..32e7f9f05 100644 --- a/tests/kalman/likelihood_from_dynare/fs2000_estimation_check.inc +++ b/tests/kalman/likelihood_from_dynare/fs2000_estimation_check.inc @@ -51,18 +51,38 @@ SmoothedMeasurementErrors(:,:,6)=cell2mat(struct2cell(oo_.SmoothedMeasurementErr SmoothedShocks(:,:,6)=cell2mat(struct2cell(oo_.SmoothedShocks)); SmoothedVariables(:,:,6)=cell2mat(struct2cell(oo_.SmoothedVariables)); -if max(max(abs(SmoothedMeasurementErrors-repmat(SmoothedMeasurementErrors(:,:,1),1,1,6))))>1e-8 - error('SmoothedMeasurementErrors do not match') -end -if max(max(abs(SmoothedShocks-repmat(SmoothedShocks(:,:,1),1,1,6))))>1e-8 - error('SmoothedShocks do not match') -end +if matlab_ver_less_than('8.2') + if max(max(abs(SmoothedMeasurementErrors-repmat(SmoothedMeasurementErrors(:,:,1),[1,1,6]))))>1e-8 + error('SmoothedMeasurementErrors do not match') + end -if max(max(abs(SmoothedVariables-repmat(SmoothedVariables(:,:,1),1,1,6))))>1e-8 - error('SmoothedVariables do not match') -end + if max(max(abs(SmoothedShocks-repmat(SmoothedShocks(:,:,1),[1,1,6]))))>1e-8 + error('SmoothedShocks do not match') + end -if max(abs([fval_algo_2,fval_algo_3,fval_algo_4,fval_algo_5,fval_algo_6]-fval_algo_1))>1e-6 - error('Likelihoods do not match') + if max(max(abs(SmoothedVariables-repmat(SmoothedVariables(:,:,1),[1,1,6]))))>1e-8 + error('SmoothedVariables do not match') + end + + if max(abs([fval_algo_2,fval_algo_3,fval_algo_4,fval_algo_5,fval_algo_6]-fval_algo_1))>1e-6 + error('Likelihoods do not match') + end + +else + if max(max(abs(SmoothedMeasurementErrors-repmat(SmoothedMeasurementErrors(:,:,1),1,1,6))))>1e-8 + error('SmoothedMeasurementErrors do not match') + end + + if max(max(abs(SmoothedShocks-repmat(SmoothedShocks(:,:,1),1,1,6))))>1e-8 + error('SmoothedShocks do not match') + end + + if max(max(abs(SmoothedVariables-repmat(SmoothedVariables(:,:,1),1,1,6))))>1e-8 + error('SmoothedVariables do not match') + end + + if max(abs([fval_algo_2,fval_algo_3,fval_algo_4,fval_algo_5,fval_algo_6]-fval_algo_1))>1e-6 + error('Likelihoods do not match') + end end diff --git a/tests/kalman/likelihood_from_dynare/fs2000ns_estimation_check.inc b/tests/kalman/likelihood_from_dynare/fs2000ns_estimation_check.inc index c676230cc..b2a260804 100644 --- a/tests/kalman/likelihood_from_dynare/fs2000ns_estimation_check.inc +++ b/tests/kalman/likelihood_from_dynare/fs2000ns_estimation_check.inc @@ -18,19 +18,38 @@ SmoothedMeasurementErrors(:,:,2)=cell2mat(struct2cell(oo_.SmoothedMeasurementErr SmoothedShocks(:,:,2)=cell2mat(struct2cell(oo_.SmoothedShocks)); SmoothedVariables(:,:,2)=cell2mat(struct2cell(oo_.SmoothedVariables)); -if max(max(abs(SmoothedMeasurementErrors-repmat(SmoothedMeasurementErrors(:,:,1),1,1,2))))>1e-8 - error('SmoothedMeasurementErrors do not match') -end +if matlab_ver_less_than('8.2') + if max(max(abs(SmoothedMeasurementErrors-repmat(SmoothedMeasurementErrors(:,:,1),[1,1,2]))))>1e-8 + error('SmoothedMeasurementErrors do not match') + end -if max(max(abs(SmoothedShocks-repmat(SmoothedShocks(:,:,1),1,1,2))))>1e-8 - error('SmoothedShocks do not match') -end + if max(max(abs(SmoothedShocks-repmat(SmoothedShocks(:,:,1),[1,1,2]))))>1e-8 + error('SmoothedShocks do not match') + end -if max(max(abs(SmoothedVariables-repmat(SmoothedVariables(:,:,1),1,1,2))))>1e-8 - error('SmoothedVariables do not match') -end + if max(max(abs(SmoothedVariables-repmat(SmoothedVariables(:,:,1),[1,1,2]))))>1e-8 + error('SmoothedVariables do not match') + end -if max(abs(fval_algo_2-fval_algo_4))>1e-6 - fprintf('\nLikelihood difference: %4.3f\n',max(abs(fval_algo_2-fval_algo_4))) - error('Likelihoods do not match') -end \ No newline at end of file + if max(abs(fval_algo_2-fval_algo_4))>1e-6 + fprintf('\nLikelihood difference: %4.3f\n',max(abs(fval_algo_2-fval_algo_4))) + error('Likelihoods do not match') + end +else + if max(max(abs(SmoothedMeasurementErrors-repmat(SmoothedMeasurementErrors(:,:,1),1,1,2))))>1e-8 + error('SmoothedMeasurementErrors do not match') + end + + if max(max(abs(SmoothedShocks-repmat(SmoothedShocks(:,:,1),1,1,2))))>1e-8 + error('SmoothedShocks do not match') + end + + if max(max(abs(SmoothedVariables-repmat(SmoothedVariables(:,:,1),1,1,2))))>1e-8 + error('SmoothedVariables do not match') + end + + if max(abs(fval_algo_2-fval_algo_4))>1e-6 + fprintf('\nLikelihood difference: %4.3f\n',max(abs(fval_algo_2-fval_algo_4))) + error('Likelihoods do not match') + end +end