From c156a5907c57206583ee64683a313e2c4f48cec4 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Mon, 1 Aug 2016 10:41:04 +0200
Subject: [PATCH] BVAR: Save prior and posterior information in oo_

---
 doc/bvar-a-la-sims.tex | 2 +-
 matlab/bvar_density.m  | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/bvar-a-la-sims.tex b/doc/bvar-a-la-sims.tex
index 593e17759c..2a3af7ea91 100644
--- a/doc/bvar-a-la-sims.tex
+++ b/doc/bvar-a-la-sims.tex
@@ -499,7 +499,7 @@ The syntax for computing the marginal density is:
 
 The options are those described above.
 
-The command will actually compute the marginal density for several models: first for the model with one lag, then with two lags, and so on up to \textit{max\_number\_of\_lags} lags. Results will be stored in a \textit{max\_number\_of\_lags} by 1 vector \texttt{oo\_.bvar.log\_marginal\_data\_density}.
+The command will actually compute the marginal density for several models: first for the model with one lag, then with two lags, and so on up to \textit{max\_number\_of\_lags} lags. Results will be stored in a \textit{max\_number\_of\_lags} by 1 vector \texttt{oo\_.bvar.log\_marginal\_data\_density}. The command will also store the prior and posterior information into \textit{max\_number\_of\_lags} by 1 cell arrays \texttt{oo\_.bvar.prior} and \texttt{oo\_.bvar.posterior}.
 
 \subsection{Forecasting}
 
diff --git a/matlab/bvar_density.m b/matlab/bvar_density.m
index ecde347c6b..b147834ed6 100644
--- a/matlab/bvar_density.m
+++ b/matlab/bvar_density.m
@@ -35,6 +35,8 @@ oo_.bvar.log_marginal_data_density=NaN(maxnlags,1);
 
 for nlags = 1:maxnlags
     [ny, nx, posterior, prior] = bvar_toolbox(nlags);
+    oo_.bvar.posterior{nlags}=posterior;
+    oo_.bvar.prior{nlags}=prior;
     
     posterior_int = matrictint(posterior.S, posterior.df, posterior.XXi);
     prior_int = matrictint(prior.S, prior.df, prior.XXi);
-- 
GitLab