Page 1 of 1
Need help to check Matlab compatibility
Posted:
Sat May 25, 2013 9:15 am
by MichaelCreel
The attached code implements an econometric estimator for a simple DSGE model, as described in the Dynare working paper "Indirect Likelihood Inference" by Dennis Kristensen and myself
http://www.dynare.org/wp-repo/dynarewp008.pdf. We are finishing a revision of the paper, and I'd like to make easy to use example code available. The attached code, for a slightly more interesting model than that of the first version of the paper, runs fine with
Octave, but I'm not sure if it runs on Matlab. If anyone with Dynare/Matlab could run it and let me know how it goes, I'd be very grateful. Thanks.
michael.creel@uab.es
Re: Need help to check Matlab compatibility
Posted:
Sat May 25, 2013 12:29 pm
by jpfeifer
It won't run because
1. Matlab uses ~ instead of ! for the not command
2. There is no endif in Matlab, just end
3. You use the use_dll without providing the compiler name to Dynare (msvc or cygwin)
4. There is no Matlab lags function
Re: Need help to check Matlab compatibility
Posted:
Sat May 25, 2013 3:18 pm
by MichaelCreel
Thanks! I thought I had gotten rid of the endif and endfors, etc., but I'll look again. I wasn't aware of the ~ vs. ! difference, but I'll adapt that, too. I'm not sure what to do about the compiler problem, I guess that most people running Windows won't have a compiler installed - do you have any advice on how to present code that would work with minimal requirements other than Matlab and Dynare? Thanks again.
Re: Need help to check Matlab compatibility
Posted:
Sat May 25, 2013 4:25 pm
by jpfeifer
I am not sure why you need the use_dll option at all. Why don't you just drop it?
Re: Need help to check Matlab compatibility
Posted:
Sat May 25, 2013 4:37 pm
by MichaelCreel
You're right, it's not needed, and in fact it's faster without it. Some time in the past I got the idea that a 3rd order solution was faster with this option, perhaps for a different model, and I've been using it since. I have made the changes, would you mind trying the code one more time? Many thanks.
Re: Need help to check Matlab compatibility
Posted:
Sat May 25, 2013 10:35 pm
by jpfeifer
rlabels must be
- Code: Select all
rlabels = char(...
'alpha',...
'beta',...
'delta',...
'gam',...
'rho1',...
'sig1',...
'rho2',...
'sig2',...
'nss',...
'psi'...
);
Moreover, there still is no lag() (only a lagmatrix if you have the econometrics toolbox). Also, vech is not a Matlab function. Seems like you are using LeSage's econometrics toolbox.
P.S.: use_dll was required a few versions ago to compute the third order solution. Now, it is only advised for really big models.
Re: Need help to check Matlab compatibility
Posted:
Sun May 26, 2013 4:56 am
by MichaelCreel
OK, I think this next try will work, if your patience has not run out. I added my lag() function, and have included the vech() function from Octave. I'm surprised that's not in Matlab. About use_dll, I think that was required when I started with this project, and I guess I never noticed that it no longer is. Removing it makes a significant speed difference for this simple model, which is important for this estimator, which uses many solutions at parameter vectors drawn from a prior.
Re: Need help to check Matlab compatibility
Posted:
Sun May 26, 2013 7:22 am
by jpfeifer
Your vech function does not run in Matlab. It has the wrong quote signs and uses cellslices, which is unknown. Apart from that
aux_stat has
- Code: Select all
temp = (data - m)./s;
temp2 = (lagdata - m)./s;
but data is a matrix, while m and s are vectors. In Matlab this crashes because of non-conformable dimensions.
Re: Need help to check Matlab compatibility
Posted:
Sun May 26, 2013 8:23 am
by MichaelCreel
Here's another try, with these issues fixed. Many thanks for your help!
Re: Need help to check Matlab compatibility
Posted:
Sun May 26, 2013 10:18 am
by jpfeifer
Almost. Now shift.m used in
- Code: Select all
temp = shift(temp,i,2);
is missing.
Re: Need help to check Matlab compatibility
Posted:
Sun May 26, 2013 4:36 pm
by MichaelCreel
Perhaps this will be the last iteration? Thanks again!
Re: Need help to check Matlab compatibility
Posted:
Mon May 27, 2013 12:28 pm
by MichaelCreel
I want to thank Johannes for his help with this. Here's a last version that runs on both Octave and Matlab.