ExponentialMovAvg Example - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantage™

This example computes an exponential moving average for the price of stock.

Input

The input table is company1_stock, as in the CumulativeMovAvg Example.

SQL Call

SELECT * FROM ExponentialMovAvg (
  ON company1_stock PARTITION BY name ORDER BY period
  USING
  TargetColumns ('stockprice')
  StartRows (10)
  IncludeFirst ('true')
) AS dt ORDER BY period;

Output

id name period stockprice stockprice_mavg
1 Company1 1961-05-17 00:00:00 460  
2 Company1 1961-05-18 00:00:00 457  
3 Company1 1961-05-19 00:00:00 452  
4 Company1 1961-05-22 00:00:00 459  
5 Company1 1961-05-23 00:00:00 462  
6 Company1 1961-05-24 00:00:00 459  
7 Company1 1961-05-25 00:00:00 463  
8 Company1 1961-05-26 00:00:00 479  
9 Company1 1961-05-29 00:00:00 493  
10 Company1 1961-05-31 00:00:00 490 467.4
11 Company1 1961-06-01 00:00:00 492 469.85999999999996
12 Company1 1961-06-02 00:00:00 498 472.674
13 Company1 1961-06-05 00:00:00 499 475.3066
14 Company1 1961-06-06 00:00:00 497 477.47594
15 Company1 1961-06-07 00:00:00 496 479.328346
16 Company1 1961-06-08 00:00:00 490 480.39551140000003
17 Company1 1961-06-09 00:00:00 489 481.25596026000005
18 Company1 1961-06-12 00:00:00 478 480.9303642340001
19 Company1 1961-06-13 00:00:00 487 481.53732781060006
20 Company1 1961-06-14 00:00:00 491 482.4835950295401
... ... ... ... ...