Related:

Timeseries

A timeseries is a time-sequence of data in some frequency, for instance annual, quarterly or monthly. Gekko is timeseries-oriented, so timeseries and time periods are an integral part of the software. See the list of all features, or read more about timeseries below.

Short-list of all main Gekko features
  • Timeseries-oriented software, with flexible databanks.
  • Annual, quarters, months and undated frequencies supported, more to come. Conversions between these are in-built.
  • Lists, values, dates, strings, etc., including many functions dealing with these.
  • Matrix calculations, including construction, addition, multiplication, inversion, etc. etc.
  • Seasonal correction via X12A.
  • Graphics by means of embedded gnuplot.
  • User-defined functions.
  • Dynamically loaded and compiled models, including failsafe mode.
  • Gauss and Newton solvers, with ordering and feedback logic. Fair-Taylor or Newton-Fair-Taylor solver for forward-looking models. Any number of simultaneous goals/means possible.
  • In-built equation browser, with integrated labels/explanations.
  • Decomposition/tracking of changes in model equations.
  • Tabelling and menu system, outputting in text, html or Excel.
  • Read/write from Excel or other spreadsheets. Formats like tsd, prn, csv supported.
  • Interface to the free open-souce R package for econometrics, data mining etc.
  • Strict language syntax (via in-built ANTLR parser), with loops, conditionals etc.
  • Free, open source. Easy installation, and used by many Danish organizations.

Handling timeseries in Gekko is very easy. Consider this example:

SERIES <2020 2030> y = x1 + x2[-1] + x3[2015] + bank2:x4;

In this statement, the timeseries y is defined as x1 + x2 lagged one period + the value of x3 in 2015 + x4 from the databank ‘bank2’. All this is performed over the period 2020-2030. This is just a simple example, but illustrates the power of a timeseries-oriented syntax.

Combined with lists, loops, etc., the Gekko command language is very well suited for timeseries-oriented data management systems. You might for instance receive data from different sources, in different frequencies, and try to balance or manipulate these timeseries in different ways, in order to construct a databank suitable for modeling purposes.

Gekko also operates with a concept of sequences of open databanks, that is, the possibility of opening up several databanks and have Gekko look for timeseries names in these databanks. This can be very practical, and Gekko also makes it easy to use naming schemes in such databanks. For instance, you may use names like xa, xb, xc, etc., and have Gekko loop over these names:

TIME 2015q1 2020q4;
LIST sectors = a, b, c;
FOR i = #sectors; 
  SERIES x{i} = x{i}[2014q4]; 
END;

This will set xa, xb and xc to their values in the fourth quarter of 2014, over the global time period 2015q1-2020q4. The code also makes use of a list (LIST) and a loop (FOR … END). Note that this naming scheme does not involve arrays or other complicated structures, so you may for instance store the timeseries in a simple spreadsheet with these names as row labels, and the time periods as column labels.

These examples are just illustrations, and yield a small taste of the syntax and possibilities. Data management systems tend to become large in volume, so the easy timeseries syntax makes the handling of many lines of such code a breeze.

Using timeseries

Gekko timeseries are typically kept in databanks for easy storage and retrieval. Gekko databanks are open-format (using so-called protobuffers). Gekko offers a particular data mode, where a number of Gekko options are set up in a way to facilitate databank management as much as possible.

Further reading regarding Gekko databanks: