I am having trouble using a variable to store shock values for use in a mod file. Specifically, I am trying to recreate the following code example (found here: dynare.org/manual/index_18.html):
xx = [1.2; 1.3; 1];
When I run this, I receive an error in
set_shocks “Subscripted assignment dimension mismatch.” I’ve identified that, when Dynare generates the M-file corresponding to my mod file, a call is made to
set_shocks, which includes the line
The problem with this line is that, given the way set_shocks works, it is trying to set a 3x1 vector equal to a 9x1 vector. That is, because the range 1:3 has length 3, the vector xx is duplicated using repmat() 3 times, even though xx already contains 3 values.
One solution would be to write,
[code]xx = [1.2; 1.3; 1];
periods 1 2 3;
values (xx(1)) (xx(2)) (xx(3));
which works, but is a hassle for a large number of shock periods, and according to the Dynare manual, should be unnecessary.
Can anyone provide some guidance? Thanks so much.