From 166c9bfa1c0b1add78f22c17bae79bf0d9622ba4 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan.bastani@ens.fr>
Date: Fri, 8 Jul 2011 11:12:13 +0200
Subject: [PATCH] dynare_sensitivity: added new options

---
 doc/dynare.texi             | 8 ++++++++
 preprocessor/DynareBison.yy | 6 +++++-
 preprocessor/DynareFlex.ll  | 2 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/doc/dynare.texi b/doc/dynare.texi
index 13c00278c..e804a69d1 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -4965,6 +4965,14 @@ Default: @code{0.3}
 Critical value for Smirnov statistics @math{d}: plot parameters with
 @math{d>} @code{ksstat}. Default: @code{0.1}
 
+@item pvalue_ks = @var{DOUBLE}
+The threshold @math{pvalue} for significant Kolmogorov-Smirnov test (@i{i.e.} plot parameters with
+@math{pvalue<} @code{pvalue_ks}). Default: @code{0.001}
+
+@item pvalue_corr = @var{DOUBLE}
+The threshold @math{pvalue} for significant correlation in filtered samples
+(@i{i.e.} plot bivariate samples when @math{pvalue<} @code{pvalue_corr}). Default: @code{0.001}
+
 @end table
 @customhead{Reduced Form Mapping Options}
 @table @code
diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy
index 9a89f7d61..0c6733842 100644
--- a/preprocessor/DynareBison.yy
+++ b/preprocessor/DynareBison.yy
@@ -160,7 +160,7 @@ class ParsingDriver;
 %token EXTERNAL_FUNCTION EXT_FUNC_NAME EXT_FUNC_NARGS FIRST_DERIV_PROVIDED SECOND_DERIV_PROVIDED
 %token SELECTED_VARIABLES_ONLY COVA_COMPUTE ESTIMATION_FILE_TAG SIMULATION_FILE_TAG
 %token ERROR_BANDS ERROR_BAND_PERCENTILES SHOCKS_PER_PARAMETER
-%token SHOCK_DRAWS FREE_PARAMETERS MEDIAN DATA_OBS_NBR NEIGHBORHOOD_WIDTH
+%token SHOCK_DRAWS FREE_PARAMETERS MEDIAN DATA_OBS_NBR NEIGHBORHOOD_WIDTH PVALUE_KS PVALUE_CORR
 %token FILTERED_PROBABILITIES FILTERED REAL_TIME_SMOOTHED
 %token PROPOSAL_TYPE MDD_PROPOSAL_DRAWS MDD_USE_MEAN_CENTER
 %token ADAPTIVE_MH_DRAWS THINNING_FACTOR COEFFICIENTS_PRIOR_HYPERPARAMETERS
@@ -1693,6 +1693,8 @@ dynare_sensitivity_option : o_gsa_identification
                           | o_gsa_namlagendo
                           | o_gsa_var_rmse
                           | o_gsa_neighborhood_width
+                          | o_gsa_pvalue_ks
+                          | o_gsa_pvalue_corr
                           | o_datafile
                           | o_nobs
                           | o_first_obs
@@ -1944,6 +1946,8 @@ o_gsa_sample_file : GSA_SAMPLE_FILE EQUAL INT_NUMBER
                     { driver.option_str("gsa_sample_file", $3); }
                   ;
 o_gsa_neighborhood_width : NEIGHBORHOOD_WIDTH EQUAL non_negative_number { driver.option_num("neighborhood_width", $3); };
+o_gsa_pvalue_ks : PVALUE_KS EQUAL  non_negative_number { driver.option_num("pvalue_ks", $3); };
+o_gsa_pvalue_corr : PVALUE_CORR EQUAL  non_negative_number { driver.option_num("pvalue_corr", $3); };
 o_load_ident_files : LOAD_IDENT_FILES EQUAL INT_NUMBER { driver.option_num("load_ident_files", $3); }
 o_useautocorr : USEAUTOCORR EQUAL INT_NUMBER { driver.option_num("useautocorr", $3); }
 o_prior_mc : PRIOR_MC EQUAL INT_NUMBER { driver.option_num("prior_mc", $3); }
diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll
index e0821f286..37ea06de2 100644
--- a/preprocessor/DynareFlex.ll
+++ b/preprocessor/DynareFlex.ll
@@ -552,6 +552,8 @@ string eofbuff;
 <DYNARE_STATEMENT>load_ident_files {return token::LOAD_IDENT_FILES;}
 <DYNARE_STATEMENT>useautocorr {return token::USEAUTOCORR;}
 <DYNARE_STATEMENT>neighborhood_width {return token::NEIGHBORHOOD_WIDTH;}
+<DYNARE_STATEMENT>pvalue_ks {return token::PVALUE_KS;}
+<DYNARE_STATEMENT>pvalue_corr {return token::PVALUE_CORR;}
  /* end of GSA options */
 
  /* For identification() statement */
-- 
GitLab