Lag

Lag

Lag

Description

Lag, also called the sliding window method, is a backshift operator function. The window width is the number of places the data points are shifted.

Why to use

Lag is used to create a new list of data points by shifting them by an integral number of places.

When to use

To create a shifted list of variables

When not to use

When the data does not contain trend or seasonal factor

Prerequisites

The dataset should contain at least one data point. 

Input

Any time-series data

Output

Dataset with values moved to successive positions

Statistical Methods Used

Limitations



In Lag, no aggregation is performed on the data. The data points are shifted by an integral number of places.
The lag function is also called the sliding window method. The window width indicates the number of places the data points are shifted.
For example, a width of one (1) indicates that in the Lagged column,

  • the first entry is NA
  • subsequent entries are the same as the original column with a shift of one place. Hence in the Lagged data column, the subsequent rows are filled with the values from the previous row in the original column.
    • Related Articles

    • Time-series Data Preparation

      Time-series Data Preparation organizes and formats transactional data into time-series data to predict trends and seasonality in the data. Transactional data is timestamped data recorded over a period at no specific frequency, while time-series data ...
    • Statistical Concepts

      Accuracy Accuracy (of classification) of a predictive model is the ratio of the total number of correct predictions made by the model to the total predictions made. Thus, Accuracy = (TP + TN) / (TP + TN + FP + FN) Where, TP, TN, FP, and FN indicate ...
    • Rubiscape Spring '22

      New Features Platform & Studio Rubiscape Persistent variables in workflow and workbook - The user can declare a variable to be remembered between function calls Separate Service for Visualization - Provide separate service for Visualization which ...