diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc
index 631dc4fa42b90696c4cdb01e5a611cc5ceb18fa2..1abb76ceebe0641c98b3148f6d0a15da4ec9d860 100644
--- a/preprocessor/ModFile.cc
+++ b/preprocessor/ModFile.cc
@@ -537,15 +537,20 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
 
   symbol_table.writeOutput(mOutputFile);
 
-  // Initialize M_.Sigma_e and M_.H
+  // Initialize M_.Sigma_e, M_.Correlation_matrix, M_.H, and M_.Correlation_matrix_ME
   mOutputFile << "M_.Sigma_e = zeros(" << symbol_table.exo_nbr() << ", "
+              << symbol_table.exo_nbr() << ");" << endl
+              << "M_.Correlation_matrix = eye(" << symbol_table.exo_nbr() << ", "
               << symbol_table.exo_nbr() << ");" << endl;
 
   if (mod_file_struct.calibrated_measurement_errors)
     mOutputFile << "M_.H = zeros(" << symbol_table.observedVariablesNbr() << ", "
+                << symbol_table.observedVariablesNbr() << ");" << endl
+                << "M_.Correlation_matrix_ME = eye(" << symbol_table.observedVariablesNbr() << ", "
                 << symbol_table.observedVariablesNbr() << ");" << endl;
   else
-    mOutputFile << "M_.H = 0;" << endl;
+    mOutputFile << "M_.H = 0;" << endl
+                << "M_.Correlation_matrix_ME = 1;" << endl;
 
   if (linear == 1)
     mOutputFile << "options_.linear = 1;" << endl;
diff --git a/preprocessor/Shocks.cc b/preprocessor/Shocks.cc
index ab5b36df464ba2577bb96e9602c57b27571793d8..1a943d2c697d7ff60a8d384aa99fc047dc0a53c6 100644
--- a/preprocessor/Shocks.cc
+++ b/preprocessor/Shocks.cc
@@ -155,17 +155,19 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
   SymbolType type2 = symbol_table.getType(it->first.second);
   assert((type1 == eExogenous && type2 == eExogenous)
          || (symbol_table.isObservedVariable(it->first.first) && symbol_table.isObservedVariable(it->first.second)));
-  string matrix;
+  string matrix, corr_matrix;
   int id1, id2;
   if (type1 == eExogenous)
     {
       matrix = "M_.Sigma_e";
+      corr_matrix = "M_.Correlation_matrix";
       id1 = symbol_table.getTypeSpecificID(it->first.first) + 1;
       id2 = symbol_table.getTypeSpecificID(it->first.second) + 1;
     }
   else
     {
       matrix = "M_.H";
+      corr_matrix = "M_.Correlation_matrix_ME";
       id1 = symbol_table.getObservedVariableIndex(it->first.first) + 1;
       id2 = symbol_table.getObservedVariableIndex(it->first.second) + 1;
     }
@@ -178,6 +180,15 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
   output << ";" << endl
          << matrix << "(" << id2 << ", " << id1 << ") = "
          << matrix << "(" << id1 << ", " << id2 << ");" << endl;
+
+  if (corr)
+    {
+      output << corr_matrix << "(" << id1 << ", " << id2 << ") = ";
+      it->second->writeOutput(output);
+      output << ";" << endl
+             << corr_matrix << "(" << id2 << ", " << id1 << ") = "
+             << corr_matrix << "(" << id1 << ", " << id2 << ");" << endl;
+    }
 }
 
 void