diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index a8b1c222cd65047be13453b20a77d6b3dae41064..eee52067486289111ee79f4d4b2f175f89c959d2 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -208,9 +208,11 @@ RamseyPolicyStatement::writeOutput(ostream &output, const string &basename) cons
 }
 
 EstimationStatement::EstimationStatement(const SymbolList &symbol_list_arg,
-                                         const OptionsList &options_list_arg) :
+                                         const OptionsList &options_list_arg,
+                                         const SymbolTable &symbol_table_arg) :
   symbol_list(symbol_list_arg),
-  options_list(options_list_arg)
+  options_list(options_list_arg),
+  symbol_table(symbol_table_arg)
 {
 }
 
@@ -228,6 +230,38 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct)
   it = options_list.num_options.find("partial_information");
   if (it != options_list.num_options.end() && it->second == "1")
     mod_file_struct.partial_information = true;
+
+  // Fill in mod_file_struct.dsge_var_calibrated
+  it = options_list.num_options.find("dsge_var");
+  if (it != options_list.num_options.end())
+    mod_file_struct.dsge_var_calibrated = it->second;
+
+  // Fill in mod_file_struct.dsge_var_estimated
+  OptionsList::string_options_type::const_iterator it_str = options_list.string_options.find("dsge_var");
+  if (it_str != options_list.string_options.end())
+    mod_file_struct.dsge_var_estimated = true;
+
+  // Fill in mod_file_struct.bayesian_irf_present
+  it = options_list.num_options.find("bayesian_irf");
+  if (it != options_list.num_options.end() && it->second == "1")
+    mod_file_struct.bayesian_irf_present = true;
+
+  it = options_list.num_options.find("dsge_varlag");
+  if (it != options_list.num_options.end())
+    if (mod_file_struct.dsge_var_calibrated.empty() &&
+        !mod_file_struct.dsge_var_estimated)
+      {
+        cerr << "ERROR: The estimation statement requires a dsge_var option to be passed "
+             << "if the dsge_varlag option is passed." << endl;
+        exit(EXIT_FAILURE);
+      }
+
+  if (!mod_file_struct.dsge_var_calibrated.empty() &&
+      mod_file_struct.dsge_var_estimated)
+    {
+      cerr << "ERROR: An estimation statement cannot take more than one dsge_var option." << endl;
+      exit(EXIT_FAILURE);
+    }
 }
 
 void
@@ -328,6 +362,15 @@ EstimatedParamsStatement::EstimatedParamsStatement(const vector<EstimationParams
         }
 }
 
+void
+EstimatedParamsStatement::checkPass(ModFileStructure &mod_file_struct)
+{
+  for (vector<EstimationParams>::const_iterator it = estim_params_list.begin();
+       it != estim_params_list.end(); it++)
+    if (it->name == "dsge_prior_weight")
+      mod_file_struct.dsge_prior_weight_in_estimated_params = true;
+}
+
 void
 EstimatedParamsStatement::writeOutput(ostream &output, const string &basename) const
 {
diff --git a/ComputingTasks.hh b/ComputingTasks.hh
index 7650c807951808a2acb2ebd6a5b3005906291688..df08dce9583ebc9feee0445d5905c90e44954620 100644
--- a/ComputingTasks.hh
+++ b/ComputingTasks.hh
@@ -147,9 +147,11 @@ class EstimationStatement : public Statement
 private:
   const SymbolList symbol_list;
   const OptionsList options_list;
+  const SymbolTable &symbol_table;
 public:
   EstimationStatement(const SymbolList &symbol_list_arg,
-                      const OptionsList &options_list_arg);
+                      const OptionsList &options_list_arg,
+                      const SymbolTable &symbol_table);
   virtual void checkPass(ModFileStructure &mod_file_struct);
   virtual void writeOutput(ostream &output, const string &basename) const;
 };
@@ -267,6 +269,7 @@ private:
 public:
   EstimatedParamsStatement(const vector<EstimationParams> &estim_params_list_arg,
                            const SymbolTable &symbol_table_arg);
+  virtual void checkPass(ModFileStructure &mod_file_struct);
   virtual void writeOutput(ostream &output, const string &basename) const;
 };
 
diff --git a/DynareBison.yy b/DynareBison.yy
index daf43412098a02ae5b0d6beae6f67c5306e6addd..2967d612dd38be70c713f9d479f558d993206c75 100644
--- a/DynareBison.yy
+++ b/DynareBison.yy
@@ -117,7 +117,7 @@ class ParsingDriver;
 %token PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
 %token PRINT PRIOR_MC PRIOR_TRUNC PRIOR_MODE PRIOR_MEAN POSTERIOR_MODE POSTERIOR_MEAN POSTERIOR_MEDIAN PRUNING
 %token <string_val> QUOTED_STRING
-%token QZ_CRITERIUM FULL
+%token QZ_CRITERIUM FULL DSGE_VAR DSGE_VARLAG DSGE_PRIOR_WEIGHT
 %token RELATIVE_IRF REPLIC RPLOT SAVE_PARAMS_AND_STEADY_STATE
 %token SHOCKS SHOCK_DECOMPOSITION SIGMA_E SIMUL SIMUL_ALGO SIMUL_SEED SMOOTHER STACK_SOLVE_ALGO STEADY_STATE_MODEL SOLVE_ALGO
 %token STDERR STEADY STOCH_SIMUL
@@ -927,6 +927,12 @@ estimated_elem1 : STDERR symbol
                     delete $2;
                     delete $4;
                   }
+                | DSGE_PRIOR_WEIGHT
+                  {
+                    driver.declare_dsge_prior_weight();
+                    driver.estim_params.type = 2;
+                    driver.estim_params.name = "dsge_prior_weight";
+                  }
                 ;
 
 estimated_elem2 : prior COMMA estimated_elem3
@@ -1126,6 +1132,8 @@ estimation_options : o_datafile
                    | o_loglinear
                    | o_nodiagnostic
                    | o_bayesian_irf
+                   | o_dsge_var
+                   | o_dsge_varlag
                    | o_irf
                    | o_tex
                    | o_forecast
@@ -1734,6 +1742,14 @@ o_load_mh_file : LOAD_MH_FILE { driver.option_num("load_mh_file", "1"); };
 o_loglinear : LOGLINEAR { driver.option_num("loglinear", "1"); };
 o_nodiagnostic : NODIAGNOSTIC { driver.option_num("nodiagnostic", "1"); };
 o_bayesian_irf : BAYESIAN_IRF { driver.option_num("bayesian_irf", "1"); };
+o_dsge_var : DSGE_VAR EQUAL number
+             { driver.option_num("dsge_var", $3); }
+           | DSGE_VAR EQUAL INF_CONSTANT
+             { driver.option_num("dsge_var", "Inf"); }
+           | DSGE_VAR
+             { driver.option_str("dsge_var", "NaN"); }
+           ;
+o_dsge_varlag : DSGE_VARLAG EQUAL INT_NUMBER { driver.option_num("dsge_varlag", $3); };
 o_tex : TEX { driver.option_num("TeX", "1"); };
 o_forecast : FORECAST EQUAL INT_NUMBER { driver.option_num("forecast", $3); };
 o_smoother : SMOOTHER { driver.option_num("smoother", "1"); };
diff --git a/DynareFlex.ll b/DynareFlex.ll
index d4e896238fd76a1bcc651cd1232a371427ff8ac3..b00a7ace92f9571c05c7851cae75c22391c04816 100644
--- a/DynareFlex.ll
+++ b/DynareFlex.ll
@@ -208,6 +208,8 @@ string eofbuff;
 <DYNARE_STATEMENT>forecast 	{return token::FORECAST;}
 <DYNARE_STATEMENT>smoother 	{return token::SMOOTHER;}
 <DYNARE_STATEMENT>bayesian_irf 	{return token::BAYESIAN_IRF;}
+<DYNARE_STATEMENT>dsge_var 	{return token::DSGE_VAR;}
+<DYNARE_STATEMENT>dsge_varlag 	{return token::DSGE_VARLAG;}
 <DYNARE_STATEMENT>moments_varendo {return token::MOMENTS_VARENDO;}
 <DYNARE_STATEMENT>filtered_vars	{return token::FILTERED_VARS;}
 <DYNARE_STATEMENT>filter_step_ahead	{return token::FILTER_STEP_AHEAD;}
@@ -377,6 +379,7 @@ string eofbuff;
 <DYNARE_BLOCK>inv_gamma1_pdf {return token::INV_GAMMA1_PDF;}
 <DYNARE_BLOCK>inv_gamma2_pdf {return token::INV_GAMMA2_PDF;}
 <DYNARE_BLOCK>uniform_pdf {return token::UNIFORM_PDF;}
+<DYNARE_BLOCK>dsge_prior_weight {return token::DSGE_PRIOR_WEIGHT;}
 
 <DYNARE_BLOCK>; {return Dynare::parser::token_type (yytext[0]);}
 <DYNARE_BLOCK># {return Dynare::parser::token_type (yytext[0]);}
diff --git a/ModFile.cc b/ModFile.cc
index 716ca90a01c9e1434bcea1f36a46a061e839c1ce..249c0b07b013a5e0238c3479af669b0c03651d6b 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -144,6 +144,22 @@ ModFile::checkPass()
       cerr << "ERROR: In 'model' block, use of external functions is not compatible with 'use_dll' or 'bytecode'" << endl;
       exit(EXIT_FAILURE);
     }
+
+  if (mod_file_struct.dsge_var_estimated)
+    if (!mod_file_struct.dsge_prior_weight_in_estimated_params)
+      {
+        cerr << "ERROR: When estimating a DSGE-VAR model and estimating the weight of the prior, dsge_prior_weight must "
+             << "be referenced in the estimated_params block." << endl;
+        exit(EXIT_FAILURE);
+      }
+
+  if (mod_file_struct.dsge_prior_weight_in_estimated_params)
+    if (!mod_file_struct.dsge_var_estimated)
+      {
+        cerr << "ERROR: If dsge_prior_weight is in the estimated_params_block, the prior weight cannot be calibrated "
+             << "via the dsge_var option in the estimation statement." << endl;
+        exit(EXIT_FAILURE);
+      }
 }
 
 void
@@ -167,6 +183,20 @@ ModFile::transformPass()
       dynamic_model.substituteExoLag();
     }
 
+  if (!mod_file_struct.dsge_var_calibrated.empty())
+    try
+      {
+        addStatement(new InitParamStatement(symbol_table.addSymbol("dsge_prior_weight", eParameter),
+                                            expressions_tree.AddNumConstant(mod_file_struct.dsge_var_calibrated),
+                                            symbol_table));
+      }
+    catch (SymbolTable::AlreadyDeclaredException &e)
+      {
+        cerr << "ERROR: dsge_prior_weight should not be declared as a model variable / parameter "
+             << "when the dsge_var option is passed to the estimation statement." << endl;
+        exit(EXIT_FAILURE);
+      }
+
   // Freeze the symbol table
   symbol_table.freeze();
 
@@ -184,6 +214,24 @@ ModFile::transformPass()
     }
 
   cout << "Found " << dynamic_model.equation_number() << " equation(s)." << endl;
+
+  if (!mod_file_struct.dsge_var_calibrated.empty() || mod_file_struct.dsge_var_estimated)
+    if (mod_file_struct.bayesian_irf_present)
+      {
+        if (symbol_table.exo_nbr() != symbol_table.observedVariablesNbr())
+          {
+            cerr << "ERROR: If bayesian_irf and dsge_var are passed to the estimation statement, "
+                 << "the number of shocks must equal the number of observed variables." << endl;
+            exit(EXIT_FAILURE);
+          }
+      }
+    else
+      if (symbol_table.exo_nbr() < symbol_table.observedVariablesNbr())
+        {
+          cerr << "ERROR: If dsge_var is passed to the estimation statement, the number of shocks "
+               << "must be greater than or equal to the number of observed variables." << endl;
+          exit(EXIT_FAILURE);
+        }
 }
 
 void
diff --git a/ParsingDriver.cc b/ParsingDriver.cc
index 13fdc3318439cbdfa11760a04b620a2b9e61180c..96549c33eb409a73b7c751df0d90f18a2d228114 100644
--- a/ParsingDriver.cc
+++ b/ParsingDriver.cc
@@ -164,6 +164,16 @@ ParsingDriver::declare_parameter(string *name, string *tex_name)
     delete tex_name;
 }
 
+void
+ParsingDriver::declare_dsge_prior_weight()
+{
+  if (mod_file->symbol_table.exists("dsge_prior_weight"))
+    error("If dsge_prior_weight appears in the estimated_params block, it cannot have been previosly declared.");
+
+  string *dsge_prior_weight = new string("dsge_prior_weight");
+  declare_parameter(dsge_prior_weight);
+}
+
 void
 ParsingDriver::add_predetermined_variable(string *name)
 {
@@ -922,7 +932,7 @@ ParsingDriver::set_unit_root_vars()
 void
 ParsingDriver::run_estimation()
 {
-  mod_file->addStatement(new EstimationStatement(symbol_list, options_list));
+  mod_file->addStatement(new EstimationStatement(symbol_list, options_list, mod_file->symbol_table));
   symbol_list.clear();
   options_list.clear();
 }
diff --git a/ParsingDriver.hh b/ParsingDriver.hh
index 3acb8460c7c275ee0dab37df26c3b258a7437b69..91ef47433313320258ec691270a19c0d75962f1c 100644
--- a/ParsingDriver.hh
+++ b/ParsingDriver.hh
@@ -212,6 +212,8 @@ public:
   void declare_exogenous_det(string *name, string *tex_name = NULL);
   //! Declares a parameter
   void declare_parameter(string *name, string *tex_name = NULL);
+  //! Declares dsge_prior_weight
+  void declare_dsge_prior_weight();
   //! Adds a predetermined_variable
   void add_predetermined_variable(string *name);
   //! Declares and initializes a local parameter
diff --git a/Statement.cc b/Statement.cc
index 1c28ad596d97eeea24cadc82a6daa6997b9d3d35..380789ad58a46f387363074146442b9b072729cd 100644
--- a/Statement.cc
+++ b/Statement.cc
@@ -34,7 +34,11 @@ ModFileStructure::ModFileStructure() :
   partial_information(false),
   shocks_present(false),
   k_order_solver(false),
-  calibrated_measurement_errors(false)
+  calibrated_measurement_errors(false),
+  dsge_prior_weight_in_estimated_params(false),
+  dsge_var_calibrated(""),
+  dsge_var_estimated(false),
+  bayesian_irf_present(false)
 {
 }
 
diff --git a/Statement.hh b/Statement.hh
index e9f5fcec31443b9c3619e822bd4d9c4cda6acfa6..3e17a5de70f585923dcbc0c4f7130a0b4be46e82 100644
--- a/Statement.hh
+++ b/Statement.hh
@@ -65,6 +65,14 @@ public:
   bool k_order_solver;
   //! Whether there is a calibrated measurement error
   bool calibrated_measurement_errors;
+  //! Whether dsge_prior_weight is in the estimated_params block
+  bool dsge_prior_weight_in_estimated_params;
+  //! Whether there is a dsge_var, with calibrated prior weight
+  string dsge_var_calibrated;
+  //! Whether there is a dsge_var, with prior weight that must be estimated
+  bool dsge_var_estimated;
+  //! Whether there is a bayesian_irf option passed to the estimation statement
+  bool bayesian_irf_present;
 };
 
 class Statement