Main Content

lagts

Lag time series object

lagts is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Description

example

newfts = lagts(oldfts) delays the data series in oldfts by one time series date entry and returns the result in the object newfts. The end is padded with zeros, by default.

example

newfts = lagts(oldfts,lagperiod) shifts time series values to the right on an increasing time scale. lagts delays the data series to happen later. lagperiod is the number of lag periods expressed in the frequency of the time series object oldfts. For example, if oldfts is a daily time series, lagperiod is specified in days. lagts pads the data with zeros (default).

example

newfts = lagts(oldfts,lagperiod,padmode) lets you pad the data with an arbitrary value, NaN, or Inf rather than zeros by setting padmode to the desired value.

Examples

collapse all

  1. Create a fints object.

    dates_and_times = (now:now+5)'
    dates_and_times =
    
       1.0e+05 *
    
        7.3840
        7.3840
        7.3840
        7.3841
        7.3841
        7.3841
    
     tsobj = fints(dates_and_times, randn(6,1))
    Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. 
    > In fints (line 169) 
    tsobj = 
     
        desc:  (none)
        freq:  Unknown (0)
    
        {'dates:  (6)'}    {'times:  (6)'}    {'series1:  (6)'}
        {'07-Sep-2021'}    {'12:30'      }    {[       0.5377]}
        {'08-Sep-2021'}    {'12:30'      }    {[       1.8339]}
        {'09-Sep-2021'}    {'12:30'      }    {[      -2.2588]}
        {'10-Sep-2021'}    {'12:30'      }    {[       0.8622]}
        {'11-Sep-2021'}    {'12:30'      }    {[       0.3188]}
        {'12-Sep-2021'}    {'12:30'      }    {[      -1.3077]}
  2. Delay a financial time series object by a specified time step using lagts.

    newfts = lagts(tsobj,2)
    Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. 
    > In fints/lagts (line 33) 
     
    newfts = 
     
        desc:  LAGTS on 
        freq:  Unknown (0)
    
        {'dates:  (6)'}    {'times:  (6)'}    {'series1:  (6)'}
        {'07-Sep-2021'}    {'12:30'      }    {[            0]}
        {'08-Sep-2021'}    {'12:30'      }    {[            0]}
        {'09-Sep-2021'}    {'12:30'      }    {[       0.5377]}
        {'10-Sep-2021'}    {'12:30'      }    {[       1.8339]}
        {'11-Sep-2021'}    {'12:30'      }    {[      -2.2588]}
        {'12-Sep-2021'}    {'12:30'      }    {[       0.8622]}

Input Arguments

collapse all

Financial time series object, specified as a fints object.

Data Types: object

Number of lag periods expressed in the frequency of the time series object, specified as an integer.

Data Types: double

Data padding value, specified as a character vector with a value of 'NaN' or 'Inf'.

Data Types: char

Output Arguments

collapse all

Financial time series object, returned as a fints object.

Version History

Introduced before R2006a