Page 1 of 1

interaction with matlab programs

PostPosted: Thu Mar 30, 2006 5:42 pm
by pburriel
Dear all,

I have a possibly very silly question.

I am having trouble with the interaction between dynare and other matlab programs.

I have written a standard dynare program to solve a DSGE model and it works fine.

However, I wanted to start playing around with the calibration and to do this I use a matlab program that solves for part of the steady state of the model. The problem is that when I try to set some of the calibrated parameters equal to the result of that program dynare gives me the following error message:

??? Error using ==> dynare
syntax error at line 717

which is the line in which I call the matlab file that defines the vector of coefficients. I think dynare is trying to tell me that it cannot communicate with that matlab program.

What is the problem with this? Is it not possible to define the calibration of the parameters for the dynare program by calling the results from another matlab program?

Thanks,

Pablo

PostPosted: Thu Mar 30, 2006 6:55 pm
by MichelJuillard
Hello Pablo,

it looks like Dynare thinks that line 717 is Dynare syntax, but wrong Dynare syntax. Most likely it starts like a Dynare command. What is this line?

Best

Michel

interaction with matlab programs

PostPosted: Fri Mar 31, 2006 8:10 am
by pburriel
Michel,

What I do is something like this. In a dynare program, when I get to defining the parameters:

"
// 1.3 Parameters of the model

parameters

beta // discount rate
gamma // habits
;

//----------------------------------------------------------------
// 2. Calibration of parameters
//----------------------------------------------------------------

parm_calibration= zeros(2,1);
calibrationsymmetric;
parm_calibration=parm_calibrationsymm;

beta = parm_calibration(1);
gamma = parm_calibration(2);
"

where the file calibrationsymmetric.m goes as follows:

"
parm_calibrationsymm= zeros(2,1);
parm_calibrationsymm(1)=(1.03)^(-0.25);//beta
parm_calibrationsymm(2)=0.7500;//gamma
"

That is, all I am doing is define a vector that I fill in another file and then call it from the dynare program to set the calibration.

Is this right?

Pablo

PostPosted: Fri Mar 31, 2006 10:01 am
by MichelJuillard
Hi Pablo,

I believe that the problem is with the file name
calibrationsymmetric

because it starts as an undocumented Dynare command 'calib'
try instead
eval('calibrationsymmetric');

If it doesn't work send me the *.mod file and calibrationsymmetric.m

Best

Michel

interaction with matlab programs

PostPosted: Sun Apr 02, 2006 4:08 pm
by pburriel
Michel,

Find attached the file "prueba.mod" with the model. The problem is in line 575. The other file is the matlab file where I define the parameters.

Thanks,

Pablo

PostPosted: Mon Apr 03, 2006 11:39 am
by MichelJuillard
I fixed two things

1) the right Matlab function is eval() not evalin()
2) calibrationsymmetric.m is a Matlab file, not a Dynare one. So, you must use Matlab comment sign % and not Dynare //

I'm attaching the corrected files

Best

Michel