From e4af5023605157ab18ea786308fd78ec17e278f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Thu, 4 Feb 2021 13:45:19 +0100 Subject: [PATCH] Testsuite / pac: Octave compatibility fix Use a different random seed under Octave for several tests. Note that these tests seems fragile. Changing the seed under MATLAB often leads to a failure. --- tests/pac/trend-component-16/example1.mod | 7 ++++++- tests/pac/trend-component-21/example1.mod | 7 ++++++- tests/pac/trend-component-23/example1.mod | 7 ++++++- tests/pac/trend-component-24/example1.mod | 7 ++++++- tests/pac/trend-component-25/example1.mod | 5 +++++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/tests/pac/trend-component-16/example1.mod b/tests/pac/trend-component-16/example1.mod index 1afaf9589..42d0cadd7 100644 --- a/tests/pac/trend-component-16/example1.mod +++ b/tests/pac/trend-component-16/example1.mod @@ -85,6 +85,11 @@ pac.update.expectation('pacman'); initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names)); // Simulate the model for 500 periods +if isoctave + // Use a different seed under Octave, the OLS estimation fails with the default one + options_.bnlms.set_dynare_seed_to_default = false; + set_dynare_seed(4); +end TrueData = simul_backward_model(initialconditions, 5000); // Define a structure describing the parameters to be estimated (with initial conditions). @@ -148,4 +153,4 @@ end if abs(lambda_nls-lambda_iterative_ols)>.01 error('Iterative OLS and NLS do not provide consistent estimates (lambda)') -end \ No newline at end of file +end diff --git a/tests/pac/trend-component-21/example1.mod b/tests/pac/trend-component-21/example1.mod index d127a0db8..59473cc88 100644 --- a/tests/pac/trend-component-21/example1.mod +++ b/tests/pac/trend-component-21/example1.mod @@ -86,6 +86,11 @@ pac.update.expectation('pacman'); initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names)); // Simulate the model for 500 periods +if isoctave + // Use a different seed under Octave, the OLS estimation fails with the default one + options_.bnlms.set_dynare_seed_to_default = false; + set_dynare_seed(4); +end TrueData = simul_backward_model(initialconditions, 5000); // Define a structure describing the parameters to be estimated (with initial conditions). @@ -157,4 +162,4 @@ end if abs(lambda_nls-lambda_iterative_ols)>.01 error('Iterative OLS and NLS do not provide consistent estimates (lambda)') -end \ No newline at end of file +end diff --git a/tests/pac/trend-component-23/example1.mod b/tests/pac/trend-component-23/example1.mod index c299ab6ce..bc826b688 100644 --- a/tests/pac/trend-component-23/example1.mod +++ b/tests/pac/trend-component-23/example1.mod @@ -91,6 +91,11 @@ pac.update.expectation('pacman'); initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names)); // Simulate the model for 500 periods +if isoctave + // Use a different seed under Octave, the OLS estimation fails with the default one + options_.bnlms.set_dynare_seed_to_default = false; + set_dynare_seed(5); +end TrueData = simul_backward_model(initialconditions, 5000); // Define a structure describing the parameters to be estimated (with initial conditions). @@ -162,4 +167,4 @@ end if abs(lambda_nls-lambda_iterative_ols)>.01 error('Iterative OLS and NLS do not provide consistent estimates (lambda)') -end \ No newline at end of file +end diff --git a/tests/pac/trend-component-24/example1.mod b/tests/pac/trend-component-24/example1.mod index e3ff87b5f..39375fe33 100644 --- a/tests/pac/trend-component-24/example1.mod +++ b/tests/pac/trend-component-24/example1.mod @@ -91,6 +91,11 @@ pac.update.expectation('pacman'); initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names)); // Simulate the model for 500 periods +if isoctave + // Use a different seed under Octave, the OLS estimation fails with the default one + options_.bnlms.set_dynare_seed_to_default = false; + set_dynare_seed(5); +end TrueData = simul_backward_model(initialconditions, 5000); // Define a structure describing the parameters to be estimated (with initial conditions). @@ -152,4 +157,4 @@ end if abs(lambda_nls-lambda_iterative_ols)>.01 error('Iterative OLS and NLS do not provide consistent estimates (lambda)') -end \ No newline at end of file +end diff --git a/tests/pac/trend-component-25/example1.mod b/tests/pac/trend-component-25/example1.mod index f6d174e74..3cd6de674 100644 --- a/tests/pac/trend-component-25/example1.mod +++ b/tests/pac/trend-component-25/example1.mod @@ -101,6 +101,11 @@ pac.update.expectation('pacman'); initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names)); // Simulate the model for 500 periods +if isoctave + // Use a different seed under Octave, the OLS estimation fails with the default one + options_.bnlms.set_dynare_seed_to_default = false; + set_dynare_seed(4); +end TrueData = simul_backward_model(initialconditions, 5000); // Define a structure describing the parameters to be estimated (with initial conditions).