# Calculation of marginal density of ANY data

Hi!

Is there a command in Dynare for calculation of marginal density of ANY data?

For example, I estimated the model with data, that consist of 2 parts: Data=Data1+Data2. So Dynare provides me marginal data density p(Data|model) in oo_.MarginalDensity. I need p(Data1|model). Such thing is used for calculation “conditional marginal likelihood” (M. Brzoza-Brzezina, M.Kolasa “Bayesian Evaluation of DSGE Models with Financial Frictions”, https://ideas.repec.org/p/wse/wpaper/71.html).

If no, could anyone suggest an easiest way to calculate p(Data1|model)?
As I can understand, I need to calculate p(Data1 |model)=\int p(Data1| \theta, model) p( \theta) d\theta. For example, could I use Laplace approximation p(Data1|model) = \frac{(2\pi)^{N/2} p(Data1| \theta^{\star},model) p(\theta^{\star})}{g(\theta^{\star})^{1/2}}, where \theta^{\star} the mode value of estimated parameters?

Hi,

I am not sure I understand what you want here. Why don’t you simply estimate the model with the first part of the sample?

Best,
Stéphane.

PS Please use \LaTeX expressions (between dollars) for equations.

Good question, I didn’t explain that. I cant simply estimate the model with the first part of sample Data1, because i need to calculate p(Data1|model) under posterior destributions that where obtained from the model estimated with full data Data=Data1+Data2.

This approach suggests the calculation of the ratio p(Data1+Data2|model) /p(Data1|model). The idea is that there are 2 versions of the model. One, “simple”, can work only with only Data2, while “advanced” model can work with Data1+Data2.
So if we want to 1) compare marginal likelihoods or something like that of the models and 2) to use all possible data, we need to compare p(Data2| “simple”) with p(Data1+Data2|“advanced”)/p(Data1|“advanced”). Both p(Data1+Data2|“advanced”) and p(Data1|“advanced”) should be calculated with the same posteriors distributions. Dynare gives only p(Data1+Data2|“advanced”)