Multiple shock periods
Posted: Fri Mar 01, 2013 8:21 pm
Hi,
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: http://www.dynare.org/manual/index_18.html):
When I run this, I receive an error in
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,
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.
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: http://www.dynare.org/manual/index_18.html):
- Code: Select all
xx = [1.2; 1.3; 1];
shocks;
var e;
periods 1:3;
values (xx);
end;
When I run this, I receive an error in
- Code: Select all
set_shocks
- Code: Select all
set_shocks
- Code: Select all
set_shocks(0,1:3, 1, xx);
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: Select all
xx = [1.2; 1.3; 1];
shocks;
var e;
periods 1 2 3;
values (xx(1)) (xx(2)) (xx(3));
end;
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.