Multiple shock periods

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.

Multiple shock periods

Postby mhlinder » 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):

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
"Subscripted assignment dimension mismatch." I've identified that, when Dynare generates the M-file corresponding to my mod file, a call is made to
Code: Select all
set_shocks
, which includes the line

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.
mhlinder
 
Posts: 1
Joined: Fri Mar 01, 2013 8:12 pm

Re: Multiple shock periods

Postby jpfeifer » Fri Mar 01, 2013 9:07 pm

Hi, could you please post or send me the whole mod-file. I have trouble replicating the issue.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 5 guests