I’m having trouble using the output of stoch_simul with option simul_replic enabled.
When I run rbc.mod (attached below) it does generate a file RBC_simul, which according to the manual is meant to be in binary form (which in other places in the manual indicates a .mat file). But when I then try loading it via:
load -mat rbc_simul
I get the following error:
Error using load
Unable to read MAT-file C:\mydirectory\RBC_simul. Not a binary MAT-file. Try LOAD -ASCII to read as text.
Without using the -mat option I just get a zero, which doesn’t look right either…
I’ve also tried using the get_simul_replications(M,options_);_ to access the simulation results directly from the mod file, as done by Johannes in the Hansen1985.mod (attached) which he linked to in a related topic, but that no longer seems to be supported either (and, consequently, the .mod file crashes)…
I’m on dynare 4.5.4 and have tried using other .mod files but not earlier dynare versions. If it’s a binary file but not a .mat file, info on the structure would also be appreciated…
Many thanks and apologies in advance if I’m doing something silly…
Pawel
Not sure this is helpful, but for what it’s worth:
I thought it may be a Matlab issue, as I’m on 2015a which is getting a bit dated, but just checked on 2017b and I have exactly the same symptoms.
I went back in time (-ish), but was unable to find a version of dynare where this worked (as I would expect it to). Specifically, the log mentions simul_replic being broken in 4.3.0 (which I think is when it was introduced?), and sure enough it wasn’t generating the _simul file then, but when I tried 4.3.1 I was already getting a file, which I was unable to read?
All that said, what I’m really after is conditional forecasts from non-linear models, so if there’s some neat way of generating these, then any suggestions would be gratefully received (I know that running stoch_simul in a loop will give me what I’m after, but it’s probably not particularly efficient?).
To answer my own question in the thread title: simul_replic is NOT broken.
In fact, it generates a _simul file which is not a mat file but a ‘proper’ Matlab binary file. And the instructions in Johannes’s file tell you how you can access simulation results (simulated_series in the code snippet below):
The simulated_series variable has dimensions: nr_variables x simulation_length x nr_simulations . My understanding is that the variable ordering matches that in oo_.steady_state i.e. the variables are in order of declaration used in var command (which is also used in M_.endo_names).