dynare_simul in version 4.2 not working anymore

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.

dynare_simul in version 4.2 not working anymore

Postby lombard » Wed Oct 20, 2010 3:23 pm

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
lombard
 
Posts: 132
Joined: Wed Feb 02, 2005 12:36 pm
Location: Basel

Re: dynare_simul in version 4.2 not working anymore

Postby lombard » Wed Oct 20, 2010 3:56 pm

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
lombard
 
Posts: 132
Joined: Wed Feb 02, 2005 12:36 pm
Location: Basel


Return to Dynare contributions and examples

Who is online

Users browsing this forum: No registered users and 2 guests