Time Shifting Time Series Data

In many cases, you will want to use historic data to populate a Time Series.  Having done so, you then want to apply that historic data to your simulation (which likely looks forward in time). In order to do this, therefore, you need to time shift the data so that the historic data is applied in an appropriate and consistent manner.

To support this, GoldSim provides an option to time shift a data series in an appropriate manner.  This feature is provided in the “Advanced” section of the Time Series dialog, accessed via the More button:

If you check Enable Time Shifting of Time Series Data, the Settings… button becomes available, providing access to this dialog (in fact, when you first check the Time Shifting box, this dialog opens automatically):

   Note: Time shifting is not available if the input represents a “Change over the next time interval”, a “Change over the previous time interval” or a “Discrete Change”.

GoldSim provides two different ways that Time Series can be shifted.

The first option is to Use random starting point. This option randomly samples a starting point in the data set for each realization.  This is useful, for example, if you have 50 years of rainfall data, you want to carry out a 1 year simulation, and you want GoldSim to randomly sample a different historic year for each realization.

The manner in which GoldSim randomly samples the starting point in a data set is controlled by two things:

   The Data periodicity, which is either “none”, “annual”, or “diurnal”; and

   Whether or not the time series data is specified in terms of Dates (Calendar Time) or Elapsed Time.

The behavior is summarized below:

   If the Data periodicity is “none”, for each realization GoldSim randomly picks a point from within the total span of the time series data, and assumes that this time point corresponds to an elapsed time of  zero. Note that this means that if data is entered as Calendar Time, the date-time is not respected; GoldSim randomly selects a point in time (and corresponding data value) from the time series data set, and “shifts” this point in time so that in the simulation it becomes an elapsed time of zero (i.e., the Simulation Start Date).

   If the Data periodicity is “annual”, GoldSim ensures that the random starting point for each realization is sampled such that all starting points are a multiple of 1 (average) year apart.  In particular, random starting points for successive realizations are always multiples of 365.25 days apart (rounded to the nearest day). Hence,

o If data is entered as elapsed time, the random starting point is either 0d, 365d, 731d, 1096d, etc.).

o If data is entered as dates (Calendar Time), the random starting points for successive realizations would be generated by first finding a data point in the data set that respected the month, day and time of the Simulation Start time, and then randomly shifting from that point by a multiple of 365.25 days (rounded to the nearest day). (Note that this implies that the shifted calendar day could be off by one day from the actual date).

   Note: When specifying time shifting using annual periodicity, your time series should contain at least 366 days of data.

   If the Data periodicity is “diurnal”, GoldSim ensures that the random starting point for each realization is sampled such that all starting points are a multiple of 1 day apart.  In particular,

o If data is entered as elapsed time, random starting points for successive realizations are always multiples of 1 day apart. That is, the random starting point is either 0d, 1d, 2d, 3d, etc.).

o If data is entered as dates (Calendar Time), random starting points for successive realizations respect the hour, minute and second of the Simulation Start time.

   Note: The random sampling also takes into account the amount of data.  For example, if you had 1000 days of data and selected  “annual” Data periodicity, the probability of picking the first two years for the starting point would be (365/1000), while the probability of picking the last year would be only (270/1000).  In this example, in order to have equal probability of picking any year as a starting point, you would require three full years of data.

The second option for time shifting Time Series is to Shift data years to align with simulation dates.  This option is only available if the Time Series data is specified using Calendar Time.

This option shifts the time series data forward (or backward) by a multiple of a year such that the simulation begins by using data from the specified Data year to start in.  For example, if the actual data set started on 31 July1989 and ended on 31 December 2011, the Simulation Start Date was 1 January 2013, and the Data year to start in was entered as 1990, GoldSim would treat the data set such that the data point corresponding to 1 January 1990 would be used for 1 January 2013 (and, assuming daily data was entered, the data point for 2 January 1990 would be used for 2 January 2013, etc.).

This is useful, for example, if you wish to apply historic data to a forward-looking simulation, assuming no uncertainty or randomness.  That is, this option assumes that with regard to the Time Series, the future will be exactly the same as the past (as represented by the historic data).  

   Note: If you wanted to account for uncertainty and randomness while still directly using historic data, you could do so by entering multiple years of data, and then using the Use random starting point option with “annual periodicity”.

In order to better understand how this works, the table below summarizes how the data would be shifted under various conditions. For this table, it is assumed that the actual time series data range is from 31 July 1989 to 31 December 2011, and the Simulation Start Date is 1 January 2013:

 

Specified “Data year to start in”

Data point used to represent 1 January 2013

Comment

1990

1 January 1990

 

1995

1 January 1995

 

1989

Fatal error

There is no data point for 1 January 1989 (since the data set starts on 1 July 1989).

2012

Fatal error

There is no data point for 1 January 2012 (since the data set ends on 31 December 2011).

Several points should be noted regarding the use of this option:

   The Data year to start in must be specified such that the data set contains data (directly or via interpolation) in the specified year for the month and day defined by the Simulation Start Date.  Otherwise, as shown in the table above, GoldSim will display a fatal error.

   The value entered for Data year to start in is always rounded to the nearest integer.

   Data year to start in can be specified as a function. One way this can be used is to specify a different year for every realization.  For example, if Data year to start in was defined as “1990 + Realization -1”, data would be used starting from 1990 for the first realization, 1991 for the second realization, and so on.

   When you use this option, you are implicitly stating that the data has annual periodicity.  This has implications for how GoldSim wraps data (as pointed out in the second bullet below).

When you choose to Enable Time Shifting of Time Series Data, GoldSim automatically wraps around to the start of the data set if the end of the data set is reached during a simulation.  The manner in which this is done depends on the periodicity of the data:

   If using a random starting point with no periodicity, when the end of the data set is reached, the data set is effectively replicated and shifted foward by a period of time equal to the span of the data set.  For example, if the last data point was at 1000 days, and the simulation extended beyond 1000 days, the data set would be shifted forward by 1000 days, so that the initial starting value (e.g., elapsed time = 0) would correspond to 1000 days.

   If using a random starting point with annual periodicity or if aligning data years with simulation dates, when the end of the data set is reached, the data set is effectively replicated and shifted foward by N years, where N is the number of whole years in the data set.  For example, if there were 3.5 years of data in the data set, the last data point was on December 31, and the simulation extended beyond 3.5 years, the data set would be shifted forward by 3 years, so that the first occurrence of January 1 in the data set would follow the last point in the data set.

   If using a random starting point with diurnal periodicity, when the end of the data set is reached, the data set is effectively replicated and shifted forward by N days, where N is the number of whole days in the data set.  For example, if there were 21.5 days of data in the data set, the last data point was on day 21.5 days, and the simulation extended beyond 21.5 days,  the data set would be shifted forward by 21 days, so that the data point at 0.5 days would follow the last point in the data set.

The example file (TimeShifting.gsm) in the TimeSeries subfolder of the General Examples folder of your GoldSim directory (accessed by selecting File | Open Example... from the main menu) includes examples on the use of time shifting Time Series elements.

Related Topics…

Learn more about: