Weighted 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™

Weighted moving average is a type of moving average that assigns different weights to each data point in the time series. This means that the most recent data points have a greater impact on the moving average calculation than older data points. Weighted moving averages are commonly used in finance and economics to smooth out fluctuations in a time series data and identify trends over time.

In an n-point weighted moving average, the most recent data point has weight n, the second most recent data point has weight (n - 1), and so on, until the weight is zero.

With MAvgType ('W'), the MovingAverage function uses this formula:

WMAM = (nVM + (n-1)VM-1 + … + 2V(M-n+2)) + V(M-n+1)) / (n + (n-1) + … + 2 + 1 )

VM is the target column value at index M in the window under consideration.

The value n, the number of old values to use when calculating the new weighted moving average, is specified by the WindowSize syntax element.