Triangular Moving Average - Analytics Database

Database Analytic Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-04-06
dita:mapPath
gjn1627595495337.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
jmh1512506877710
Product Category
Teradata Vantage™

The triangular moving average (TMA) differs from the simple moving average in that it is double-smoothed; that is, averaged twice. It takes an average over Simple Moving Averages. Double-smoothing keeps the triangular moving average from responding to new data points as fast as the simple moving average. If you want an average that responds quickly to new data points, use the simple moving average or exponential moving average.

With MAvgType ('T'), the MovingAverage function uses this procedure:
  1. Compute the window size, N:

    N=ceil(window_size +1)/2

  2. Compute the simple moving average of each target column, using this formula:

    SMAi = (V1 + V2 + … + VN)/N

    The function calculates SMAi on the ith window of the target column from the start of the row.

    Vi is the value of the target column at index i in the window.

  3. Compute the triangular moving average by computing the simple moving average with window size N on the values obtained in step 2, using this formula:

    TMA = (SMA1 + SMA2 + … + SMAN)/N

    The function writes the cumulative moving average values computed for the first n rows, where n is less than N, to the output table.