<< Click to Display Table of Contents >> REBASE |
REBASE calculates an index series by dividing every observation of an existing series by a single observation or an average of several observations of the same timeseries. A bank name and/or prefix can be indicated, and the index value can be stated (default: 100). The statement ignores the global time period, and a local time period cannot be set.
Instead of the REBASE statement, you may alternatively use the similar rebase() function, for instance PLOT x.rebase(2020); (see under functions).
rebase < FROMBANK=... TOBANK=... PREFIX=... INDEX=... > variables date1 date2 ;
variables |
A list of variable names (may include bank names) |
date1
|
Rebase date (where the timeseries value attains 100, or the value stated with <index = ...>. |
date2
|
(Optional). Rebase ending date. If this is active, instead of using only date1, the average of values over the period date1-date2 is adjusted so that it (the average) attains the specified value. |
BANK |
Deprecated, use FROMBANK. |
FROMBANK= |
(Optional). A databank name where input timeseries are to be found, if databank names are not provided in the list of variables. |
TOBANK= |
(Optional). A databank name where all resulting timeseries end up. This databank has to be editable. [New in 3.1.9] |
PREFIX= |
(Optional). A prefix name regarding the resulting timeseries. |
INDEX= |
(Optional). The value of the index in the index period(s). Default = 100. |
•If a databank name is not provided, the variable is not searched for in other databanks than the first-position databank.
•Looping: with a list like for instance #m = a, b;, you may use rebase <prefix=i> x{#m} 2020; to rebase xa into ixa, and xb into ixb.
Note: If the timeseries is quarterly or monthly, date1 is annual (a year), and date2 is not stated, Gekko will use the first period of the year as start date, and the last period of the year as end date. If the timeseries y is quarterly, rebase y 2010; is the same as rebase y 2010q1 2010q4;.
If you are using TOBANK or PREFIX (or both), new timeseries objects are created. Otherwise, it is the existing timeseries objects that are altered.
reset; |
The result is the following:
y i1y i2y 2010 2.0000 66.6667 57.1429 2011 3.0000 100.0000 85.7143 2012 4.0000 133.3333 114.2857 |
In the first one (i1y), the index series has the value 100 in 2011. In the second one (i2y), the index series has an average of 100 in 2011 and 2012 (the average of 85.7143 and 114.2857 = 100).
The following example illustrates the use of FROMBANK, TOBANK, PREFIX and INDEX.
reset; time 2010 2012; |
When the REBASE statement is issued, the databank temp2 is in first position, Work is in second position, and temp is in third position. Of these, only temp2 and Work are editable. The first series, work:y1 has a databank indicated, and therefore y1 is taken from Work. The second series has no databank indicated and is therefore taken from temp (because of the FROMBANK option). Both the rebased series are put into the temp2 databank (because of the TOBANK option), and both are prefixed with re (because of the PREFIX option).
The former BANK option is now called FROMBANK. The old option will still work for a while.