Comparing models

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Comparing models

Postby tanya » Tue Sep 12, 2006 7:07 pm

Dear All

Does anyone have a simple example that compares models. I use matlab and see that the dynare folder contains PosteriorOddsTable function. I guess this is what I need, but I have no idea how to call it from dynare. Presumably, I have standard output saved from two mod-files, each of which does Bayesian "estimate" of a DGSE model. The difference between the two models is only in coefficients.

Many thanks
Tanya
tanya
 
Posts: 37
Joined: Tue Sep 12, 2006 6:41 pm

Postby MichelJuillard » Fri Sep 22, 2006 12:29 pm

Here is an example around a model by Rabanal and Rubio (2003).

The keyword model_comparison must be followed by the name of two *.mod files. By default, the comparison is done on the basis of the Laplace approximation of log data density and therefor this can be used after just posterior mode finding.

The is an option model_comparison_approximation that can take the value of either laplace or modifiedharmonicmean (the latter requires metropolis iterations)

Best

Michel
Attachments
rabanal2.mod
(1.8 KiB) Downloaded 450 times
rabanal1.mod
(1.64 KiB) Downloaded 390 times
datarabanal.m
(5.33 KiB) Downloaded 370 times
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

Postby tanya » Fri Sep 22, 2006 7:06 pm

Dear Michel

Many thanks for this. Do you know how to set this option?
For example, in the *.mod file, is it in the same line , or in a separate line? I could not find help on this and several variants with brackets did not work

model_comparison file1, file2;

Separate question: is there anything available that does posterior predictive check? And if so, then again how to call it?

Many thanks again
Tanya
tanya
 
Posts: 37
Joined: Tue Sep 12, 2006 6:41 pm

Postby MichelJuillard » Fri Sep 22, 2006 7:41 pm

You are right there is a problem with the option. I corrected it in SVN and it will be available in tomorrow's snapshot for Dynare version 3.

The correct syntax for the option is, for example:

model_comparison(model_comparison_approximation=laplace) rabanal1, rabanal2;

Best

Michel
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

Postby wingfly » Sun Jul 22, 2007 2:18 pm

Please excuse me, but I simply followed the above:

>> model_comparison(model_comparison_approximation=laplace) rabanal1.mod, rabanal2.mod

But the system returns:

??? model_comparison(model_comparison_approximation=laplace) rabanal1.mod, rabanal2.mod
|
Error: The expression to the left of the equals sign is not a valid target for an assignment.

Then I tried:

>> model_comparison rabanal1.mod, rabanal2.mod

And the system returns:

??? Input argument "ModelPriors" is undefined.

Error in ==> model_comparison at 24
if isempty(ModelPriors)

Finally I even modified CompareModels.m by assigning the value for "ModelPriors" , but it still doesn't work.
Could someone offer the correct syntax for this simple problem?
:?
wingfly
 

Re: Comparing models

Postby tanya » Sat Feb 07, 2009 2:06 pm

If anybody is still interested in this: the following worked in my case. In Matlab code you write (for two models for example)

nomodels=2;
file_names = cell(nomodels,1);
file_names{1}='name1';
file_names{2}='name2';

model_priors = [1;1];
options_.model_comparison_approximation='Laplace';
PosteriorOddsTable = model_comparison(file_names,model_priors);

In this case it does what it should do. However, the field in Options is now changed into 'Laplace'. I guess you will nneed to have a line like
options_.model_comparison_approximation=' '; or delete this field if you later want to use different approximation.
tanya
 
Posts: 37
Joined: Tue Sep 12, 2006 6:41 pm


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 11 guests