A basic question for model comparison

Hello,

I have two mod files to compare using v_3.065 .
To compare them, what should I do?

I found the following command

model_comparison example1.mod, example2.mod;

  1. Should I have to estimate each mod file in the same directory in advance?
  2. Where should I include this command to implement?

Many thanks,

Jiho

Hi Jiho,

I never use this function (so I don’t know how to call it)… But you don’t really need it if you want to compare two (or more models). You just have to compare the marginal densities (eventually weighted by a discrete prior distribution over the models).

Say you have two models A and B to be compared. You write two mod files A.mod and B.mod where you define the models and write all is needed to estimate each model. After the estimation, you can execute the following command on the matlab prompt:

load A_results;
mdA = oo_.MarginalDensity.LaplaceApproximation;
load B_results;
mdB = oo_.MarginalDensity.LaplaceApproximation;

mdA and mdB are the (logged) marginal densities of models A et B. Say you have a prior for these models (pA for model A and pB for model B where pA+pB = 1, pA>0 and pB>0). Then the posterior probability of model A is given by

exp(log(pA)+mdA) / ( exp(log(pA)+mdA) + exp(log(pB)+mdB) )

and the posterior probability of model B is given by:

exp(log(pB)+mdB) / ( exp(log(pA)+mdA) + exp(log(pB)+mdB) )

You may experience overflow problems and have to adapt slightly these formulas to overcome this issue (see lines 62-63 in model_comparison.m). Obviously if you run a metropolis you can use the Modified Harmonic Mean estimator of the marginal density instead of the Laplace Approximation.

Best,
Stéphane.

Thank you very much, Stéphane.

Best regards,

Jiho