Stochastic extended path algorithm

when I try the stochastic extended path algorithm, by setting the option “order=INTEGER” (whatever integer I set… of course it works with “0”)
I get this error message

??? Error: File: solve_stochastic_perfect_foresight_model.m
Line: 193 Column: 17
The variable nzA in a parfor cannot be classified.
See Parallel for Loops in MATLAB, “Overview”.

Error in ==> extended_path at 180
[flag,tmp] = …

Error in ==> RD_new_ep at 425
extended_path(], 100);

Error in ==> dynare at 162
evalin(‘base’,fname) ;

Any help is more than welcome!!!

Are you using 4.4. If not, try it and please report back by posting the mod-file

Hi, thanks for your reply.
Yes, I am using Dynare 4.4.
I obtain the same error message running the very simple model “example1” of the documentation (here attached).
example1.mod (1.56 KB)

I ran the file with order=2 without any problems. Are you trying to run EP in a parallel context? The error message you posted refers to the parallel computing toolbox.

I am not running Dynare invoking any parallel option. Futher, I do not have the Matlab parallel computing toolbox installed. Might it this be the problem?

Hi everyone,

I’m having exactly the same problem as Barbara (I have dynare 4.1 and I encounter the problem even with the example file posted in this discussion) and I’m really struggling to get a solution. I tried to substitute the parfor loop in solve_stochastic_perfect_foresight_model with a for loop. Then I did not receive the same error message as before, but the following:

??? Maximum variable size allowed by the program is exceeded.

Error in ==> repmat at 86
B = A(:, ones(siz(2), 1));

Error in ==> solve_stochastic_perfect_foresight_model at 77
Y = repmat(endo_simul(:),1,world_nbr);

Error in ==> extended_path at 180
[flag,tmp] = …

Error in ==> example1 at 153
extended_path(], 100);

Error in ==> dynare at 174
evalin(‘base’,fname) ;

is there any solution/suggestion?


Concerning the problem of the original poster, I don’t know where it comes from. I have MATLAB without the parallel toolbox, and I cannot reproduce it. Maybe something is wrong with your MATLAB installation (like you have the parallel toolbox installed, but not the license for it).

Concerning the second problem (“Maximum variable size allowed by the program is exceeded.”), it comes from the fact that you request order 10. The complexity of the stochastic extended path is an exponential function of the order, so 10 is huge. If you decrease it to a smaller value (like 2 or 3), the problem disappears.

Thanks, I’ll try asap with a brand new installation being sure to not have the parallel toolbox around and see what happens.
As far as I understood Claudio had initially the same problem. :frowning:

I ran example1.mod. It works with a lower order like 2. But I am confused with the size of the shocks given in the oo_exo_simul. I cannot see how oo_exo_simul is derived from the shock block.

Another thing to confirm. According to a past post, there are no irfs after extended_path is because the algorithm assumes expected future shocks are zero. But are oo_endo_simul still the mean of stochastic simulations of numerous non-zero realized shocks? So if I use simul to plot a deterministic shock, I should get a different result from plotting oo_endo_simul after extended_path, or not?

btw, I actually didn’t see where discontinuity, like ZLB, kicks in example1.mod. I am not sure if this is a good example to illustrate how the command extended_path works for a discontinuous model. But I guess I can compare extended_path and stoch_simul for a nonlinear model here.

We are currently working on a better interface for extended_path and additional documentation.


I tried to simulate the IRF to a shock using the stochastic extended path in Dynare 4.3.3, using a standard simple RBC model with a minimum wage constraint imposed. To do this, I supplanted the series of shocks in extended_path.m function with a series that has a shock (0.01) in the second place and zeros elsewhere. It all seems OK and works fine with orders 0,1,2. But I noticed that at the end of the simulation, variables do not converge to (deterministic) steady state, except for order=0. Why does this happen? I initially thought it was due to uncertainty, but the weird thing is that capital goes to smaller value when order = 1 or 2, than when order = 1.

The file is attached. Thank you!
RBC_EP.mod (1.16 KB)