REBASE

<< Click to Display Table of Contents >>

Navigation:  Gekko User Manual > Gekko statements >

REBASE

Previous pageReturn to chapter overviewNext page

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).

 


 

Syntax

 

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 #= 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.

 

 


 

Example

 

reset;
mode data;
time 2010 2012;
= 2, 3, 4;
rebase <prefix=i1> y 2011;
rebase <prefix=i2> y 2011 2012;
prt <n> y, i1y, i2y;

 

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;
y1 = 2, 3, 4;
open <edit> temp; 
  y2 = 3, 4, 5; 
close temp; 
open temp;
open <edit> temp2; 
clear temp2;
rebase <frombank=temp tobank=temp2 prefix=re index=100> work:y1, y2 2011;
prt temp2:rey1, temp2:rey2;

 

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).

 


 

Note

 

The former BANK option is now called FROMBANK. The old option will still work for a while.

 

 


 

Related statements

 

SERIES, SPLICE