Page 1 of 1

A basic question for model comparison

PostPosted: Sat Sep 29, 2007 2:09 pm
by jiholee
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

Re: A basic question for model comparison

PostPosted: Sat Sep 29, 2007 3:23 pm
by StephaneAdjemian
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:

Code: Select all
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

Code: Select all
exp(log(pA)+mdA) / ( exp(log(pA)+mdA) + exp(log(pB)+mdB) )


and the posterior probability of model B is given by:

Code: Select all
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

PostPosted: Sat Sep 29, 2007 4:25 pm
by jiholee
Thank you very much, Stéphane.

Best regards,

Jiho