Page 1 of 1

dynare_simul in version 4.2 not working anymore

PostPosted: Wed Oct 20, 2010 3:23 pm
by lombard
Hi,

I've compiled dynare 4.2-unstable few weeks ago. The function dynare_simul has been changed (since previous 4.2 download)

Now it is not working as it seems to need 12 (!) inputs rather than the usual (min) 2.

The comment on the code still refers to
Code: Select all
% SYNOPSIS
%
% [err, r] = dynare_simul(name, shocks)
% [err, r] = dynare_simul(name, prefix, shocks)
% [err, r] = dynare_simul(name, shocks, start)
% [err, r] = dynare_simul(name, prefix, shocks, start)

while later on you find
Code: Select all
if nargout ~= 2 || nargin < 12
    error('dynare_simul_ must have at least 12 input parameters and exactly 2 output arguments.');
end


Also, why does dynare_simul (old and new) give a seed to the simulation function?

Best

Gianni

Re: dynare_simul in version 4.2 not working anymore

PostPosted: Wed Oct 20, 2010 3:56 pm
by lombard
I think I see the problem,

The output of the new code has been changed. Now (strangely) the first output is a zero (assigned at bottom of file) while the second is the simulated series.

This is not the true problem though. The call to the mex function is wrong.
It is
Code: Select all
command = ['r=dynare_simul_(' num2str(order-1) ',nstat,npred,nboth,nforw,' ...
           'nexog,ystart,shocks,vcov_exo,seed,ss' derstr ');'];

and should be
Code: Select all
command = ['[err,r]=dynare_simul_(' num2str(order-1) ',nstat,npred,nboth,nforw,' ...
           'nexog,ystart,shocks,vcov_exo,seed,ss' derstr ');'];


So the initial input/output check is misplaced (at that stage no need for 12 inputs)
I suspect that there is no need to force two outputs either (the first being always zero).

The only needed change in dynare_simul is the two-output version of the call to the mex function

Best

Gianni