Further adjust tolerance of Octave unit tests

time-shift
Johannes Pfeifer 2016-12-27 20:32:29 +01:00
parent 17e343d769
commit 6c9a08d7e2
3 changed files with 33 additions and 11 deletions

View File

@ -95,10 +95,14 @@ rplot Consumption;
rplot Capital;
D = load('rbc_det_results');
if norm(D.oo_.endo_simul - oo_.endo_simul) > 1e-8;
disp(norm(D.oo_.endo_simul - oo_.endo_simul));
error(sprintf('rbc_det_stack_solve_algo_7 failed with solve_algo=%u',options_.solve_algo));
if isoctave && options_.solve_algo==0
%%acount for somehow weaker convergence criterion in Octave's fsolve
tol_crit=1e-4;
else
tol_crit=1e-8;
end
if norm(D.oo_.endo_simul - oo_.endo_simul) > tol_crit;
disp(norm(D.oo_.endo_simul - oo_.endo_simul));
error(sprintf('rbc_det_stack_solve_algo_7 failed with solve_algo=%u',options_.solve_algo));
end;
@#endfor

View File

@ -26,7 +26,13 @@ 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
if isoctave
tol_crit=5e-6;
else
tol_crit=1e-8;
end
if max(max(abs(SmoothedVariables-repmat(SmoothedVariables(:,:,1),[1,1,2]))))>tol_crit
error('SmoothedVariables do not match')
end

View File

@ -16,9 +16,15 @@ if mean(abs(oo_.FilteredVariables.Mean.Y_obs(1:end-1)-Y_obs(2:end)'))>1e-3 ||...
error('Filtered Variables are wrong')
end
if isoctave
tol_crit=3e-2 ;
else
tol_crit=2e-2 ;
end
if abs(corr(oo_.FilteredVariables.Mean.Y_obs(2:end-1)-Y_obs(3:end)',oo_.FilteredVariables.Mean.Y_obs(1:end-2)-Y_obs(2:end-1)'))>2e-2 ||...
abs(corr(oo_.FilteredVariables.Mean.P_obs(2:end-1)-P_obs(3:end)',oo_.FilteredVariables.Mean.P_obs(1:end-2)-P_obs(2:end-1)'))>2e-2 ||...
abs(corr(oo_.FilteredVariables.Mean.junk2(2:end-1)-junk2(3:end)',oo_.FilteredVariables.Mean.junk2(1:end-2)-junk2(2:end-1)'))>2e-2
abs(corr(oo_.FilteredVariables.Mean.junk2(2:end-1)-junk2(3:end)',oo_.FilteredVariables.Mean.junk2(1:end-2)-junk2(2:end-1)'))>tol_crit
error('Filtered Variables are wrong')
end
@ -30,18 +36,24 @@ if max(abs(squeeze(oo_.FilteredVariablesKStepAhead(1,1,2:end-(options_.nk-1)))-o
mean(squeeze(oo_.FilteredVariablesKStepAhead(2,3,3:end-options_.nk)))>1e-1
error('FilteredVariablesKStepAhead is wrong')
end
if isoctave
tol_crit=7e-4;
else
tol_crit=5e-4;
end
if abs(oo_.PointForecast.Mean.Y_obs(end)- y_forecast_100_periods)>5e-4 || abs(oo_.PointForecast.Mean.P_obs(end)- p_forecast_100_periods)>5e-4
if abs(oo_.PointForecast.Mean.Y_obs(end)- y_forecast_100_periods)>tol_crit || abs(oo_.PointForecast.Mean.P_obs(end)- p_forecast_100_periods)>tol_crit
error('Mean Point Forecasts do not match')
end
if abs(oo_.PointForecast.Median.Y_obs(end)- y_forecast_100_periods)>5e-4 || abs(oo_.PointForecast.Median.P_obs(end)- p_forecast_100_periods)>5e-4
if abs(oo_.PointForecast.Median.Y_obs(end)- y_forecast_100_periods)>tol_crit || abs(oo_.PointForecast.Median.P_obs(end)- p_forecast_100_periods)>tol_crit
error('Median Point Forecasts do not match')
end
if abs(oo_.MeanForecast.Mean.Y_obs(end)- y_forecast_100_periods)>5e-4 || abs(oo_.MeanForecast.Mean.P_obs(end)- p_forecast_100_periods)>5e-4
if abs(oo_.MeanForecast.Mean.Y_obs(end)- y_forecast_100_periods)>tol_crit || abs(oo_.MeanForecast.Mean.P_obs(end)- p_forecast_100_periods)>tol_crit
error('Mean Mean Forecasts do not match')
end
if abs(oo_.MeanForecast.Median.Y_obs(end)- y_forecast_100_periods)>5e-4 || abs(oo_.MeanForecast.Median.P_obs(end)- p_forecast_100_periods)>5e-3
if abs(oo_.MeanForecast.Median.Y_obs(end)- y_forecast_100_periods)>tol_crit || abs(oo_.MeanForecast.Median.P_obs(end)- p_forecast_100_periods)>5e-3
error('Median Mean Forecasts do not match')
end