Shocks for Several Years at a Single Header


Prior to Version 3.12 (December 2004) of RunDynam, you were required to put the shocks for different years on different Shocks files (BSH or PSH files) shown on the Closure/Shocks page.

However, if you are using Release 9 or later of GEMPACK, you can now put shocks for several years on a single header in a Header Array file, and instruct RunDynam to read the shocks for the relevant year. We explain how to do this below.

Enhancement made in Version 3.49 (January 2010). You can now select a different slice from the year you are running by using <year+integer or <year-integer in place of <year. See here for details and examples. [Ditto for "<quarter+integer" and "<period-integer" etc as below.]

Enhancement made in Version 3.56 (September 2010) for quarterly or monthly models. With quarterly or monthly models you can use slice strings <quarter>, <quarter=string>, <month>, <month=string>, <period> or <period=string> in analogous ways.

<quarter>, <month> and <period> are abbreviations for <quarter=Q>, <month=M> and <period=P> respectively.

For example, <quarter> in the PSH file for quarter 2008q3 of the Policy run converts to slice "Q2008q3" in the Command file.

<year…> can only be used in an annual model, <quarter…> can only be used in a quarterly model, <month…> can only be used in a monthly model. However <period…> can be used in any of these 3 types of models.

Example. Suppose that you are preparing the BSH files for the Base Case which covers years 2002 to 2015 inclusive. Suppose that you model contains a variable X4(COM) which represents the percentage change in the quantity of exports in each commodity and suppose that you wish to give different size shocks to this variable for each year in the Base Case.

Prior to Version 3.12 of RunDynam, you had to prepare different shock files containing the shocks for the different years -- perhaps files X4-2002.SHK to X4-2015.SHK. You might make these files Header Array files, each containing the shocks for x4 at header X4. The data at header X4 would be a vector of size equal to the size of the set COM. Then you would need to include the line

shock x4 = file x4-2002.shk header x4 ;

in the BSH file for year 2002 and the line

shock x4 = file x4-2015.shk header x4 ;

in the BSH file for year 2015.

Now you can prepare a single header X4 with two dimensions, COM and YEARS, and put the shocks for all the different years in this. For example, you could define a set (perhaps called YEARS, though any other name is allowed) to have elements Y2002 to Y2015 (one for each year). Note that the first character in elements of GEMPACK sets must be a letter, which is why we have included Y at the start of these names). Then you will only need one x4.shk file (not different ones for each year) and you could include the same line

 

shock <year> x4 = file x4.shk header x4 ;

 

in each of the BSH files. The <year> in this statement is what alerts RunDynam to the fact that you want the appropriate shocks taken from the matrix at header X4 in each year. RunDynam rewrites this statement to include the year in each of the Command files it writes. For example, RunDynam puts

shock x4 = file x4.shk header x4 slice Y2002 ;

into the Command file for year 2002 and it puts

shock x4 = file x4.shk header x4 slice Y2007 ;

into the Command file for year 2007. The slice part is syntax that Release 9 of GEMPACK accepts and understands. The data at header X4 must be of size COM x YEARS (or could be YEARS x COM).

Alternatively if you wanted the elements of the set containing the year numbers to begin with the string ABC (that is, if you want the set to have elements ABC2002 to ABCR2015), you could include the statement

 

shock <year=ABC> x4 = file x4.shk header x4 ;

 

in each of the BSH files. For example, RunDynam would then put

shock x4 = file x4.shk header x4 slice ABC2013 ;

into the Command file for year 2013.

General Rules

These rules apply to shock statement and also to shock-like statements which are those beginning with the keywords ashock, tshock, final_level, change or percent_change -- see chapter 5 of GPD-3. Also keywords achange, tchange, apercent_change, tpercent_change and tfinal_level -- see section 7.7 of GPD-9.

If you want RunDynam to use the slice syntax (see the example above) in the GEMPACK Command file it prepares, you must make the second word in the shock statement one of the following two.

<year>

<year=string> (where string is any string of up to 8 characters, beginning with a letter)

The first case <year> is just an abbreviation for <year=Y>.

Consult the GEMPACK Release 9 documentation for details about the slice syntax in shock statements. Note that, in particular, all sets at the relevant header on the file must have known elements. If your model contains a scalar variable (that is, a variable with only one component) and you want to use this <year> feature, we suggest that you make the array at the relevant header a one-dimensional array (with the size of that dimension being the number of years). [If you make it a 2-dimensional array with dimensions 1*YEAR, you will have to label the element in the set of size 1, as well as the elements in the set YEAR.]

If you use this <year syntax in RunDynam BSH and PSH files you should be able to get away with fewer different BSH and PSH files and also fewer different actual shock files (as read by GEMPACK programs).



URL of this topic: www.copsmodels.com/webhelp/rundynam/hc_shockhed.htm

Link to full GEMPACK Manual

Link to GEMPACK homepage