TD_SIMPLEEXP Function Examples | Teradata Vantage - TD_SIMPLEEXP Examples - Teradata Vantage

Database Unbounded Array Framework Time Series Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
ncd1634149624743.ditamap
dita:ditavalPath
ruu1634160136230.ditaval
dita:id
ncd1634149624743

TD_SIMPLEEXP Input Table CountryID

COUNTRYID YEAR_RECORDED SeqNo INFLATION_RATE
1 2020-12-31 1 2.00
1 2020-12-31 1 -0.70
1 2020-12-31 2 1.52
1 ... ...
1 2022-12-31 9 2.11
1 202-12-31 10 -0.63
... 2022-12-31 10 2.90

TD_SIMPLEEXP Call

EXECUTE FUNCTION INTO VOLATILE ART(INFLATION_RES)
TD_SIMPLEEXP(
   SERIES_SPEC(TABLE_NAME(INFLATION),
      SERIES_ID (CountryID), 
      ROW_AXIS(TIMECODE(YEAR_RECORDED)),
      PAYLOAD( FIELDS(INFLATION_RATE), CONTENT(REAL))),
   FUNC_PARAMS(FORECAST_PERIODS(4),
      FORECAST_STARTING_VALUE('MEAN'),
      PREDICTION_INTERVALS('80'), ALPHA(0.1),  
      FIT_METRICS(1), RESIDUALS(1) )
);

TD_SIMPLEEXP Primary Output

SELECT * FROM INFLATION_RES;
COUNTRYID ROW_I OBSERVED_VALUE FORECAST_VALUE LO_80 HI_80 LO_95 HI_95
----------- -------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ----------------------
1 0 2.00000000000000E 000 3.98000000000000E-001 ? ? ? ?
1 1 1.52000000000000E 000 5.58200000000000E-001 ? ? ? ?
1 2 -1.09000000000000E 000 6.54380000000000E-001 ? ? ? ?
1 3 -6.00000000000000E-001 4.79942000000000E-001 ? ? ? ?
1 4 1.60000000000000E-001 3.71947800000000E-001 ? ? ? ?
1 5 -1.50000000000000E 000 3.50753020000000E-001 ? ? ? ?
1 6 1.14000000000000E 000 1.65677718000000E-001 ? ? ? ?
1 7 8.70000000000000E-001 2.63109946200000E-001 ? ? ? ?
1 8 3.10000000000000E-001 3.23798951580000E-001 ? ? ? ?
1 9 -6.30000000000000E-001 3.22419056422000E-001 ? ? ? ?
1 10 ? 2.27177150779800E-001 -1.44034265312004E 000 1.87634265312004E 000 ? ?
1 11 ? 2.27177150779800E-001 -1.44034265312004E 000 1.87634265312004E 000 ? ?
1 12 ? 2.27177150779800E-001 -1.44034265312004E 000 1.87634265312004E 000 ? ?
1 13 ? 2.27177150779800E-001 -1.44034265312004E 000 1.87634265312004E 000 ? ?
299 0 -7.00000000000000E-001 2.52200000000000E 000 ? ? ? ?
299 1 3.30000000000000E 000 2.19980000000000E 000 ? ? ? ?
299 2 5.40000000000000E 000 2.30982000000000E 000 ? ? ? ?
299 3 2.62000000000000E 000 2.61883800000000E 000 ? ? ? ?
299 4 1.99000000000000E 000 2.61895420000000E 000 ? ? ? ?
299 5 1.44000000000000E 000 2.55605878000000E 000 ? ? ? ?
299 6 2.00000000000000E 000 2.44445290200000E 000 ? ? ? ?
299 7 1.56000000000000E 000 2.40000761180000E 000 ? ? ? ?
299 8 2.11000000000000E 000 2.31600685062000E 000 ? ? ? ?
299 9 2.90000000000000E 000 2.29540616555800E 000 ? ? ? ?
299 10 ? 2.35586554900220E 000 3.79795746754308E-002 4.48602042532457E 000 ? ?
299 11 ? 2.35586554900220E 000 3.79795746754308E-002 4.48602042532457E 000 ? ?
299 12 ? 2.35586554900220E 000 3.79795746754308E-002 4.48602042532457E 000 ? ?
299 13 ? 2.35586554900220E 000 3.79795746754308E-002 4.48602042532457E 000 ? ?

TD_SIMPLEEXP Secondary Call

CREATE TABLE SIMPLEXP_RESIDUALS AS (
EXECUTE FUNCTION
TD_EXTRACT_RESULTS( 
   ART_SPEC(TABLE_NAME(INFLATION_RES),
      LAYER(ARTFITRESIDUALS)))) WITH DATA
;

TD_SIMPLEEXP Secondary Output

SELECT * FROM SIMPLEXP_RESIDUALS ORDER BY CountryID, ROW_I;
COUNTRYID ROW_I ACTUAL_VALUE CALC_VALUE RESIDUAL
----------- -------------------- ---------------------- ---------------------- ----------------------
1 0 2.00000000000000E 000 3.98000000000000E-001 1.60200000000000E 000
1 1 1.52000000000000E 000 5.58200000000000E-001 9.61800000000000E-001
1 2 -1.09000000000000E 000 6.54380000000000E-001 -1.74438000000000E 000
1 3 -6.00000000000000E-001 4.79942000000000E-001 -1.07994200000000E 000
1 4 1.60000000000000E-001 3.71947800000000E-001 -2.11947800000000E-001
1 5 -1.50000000000000E 000 3.50753020000000E-001 -1.85075302000000E 000
1 6 1.14000000000000E 000 1.65677718000000E-001 9.74322282000000E-001
1 7 8.70000000000000E-001 2.63109946200000E-001 6.06890053800000E-001
1 8 3.10000000000000E-001 3.23798951580000E-001 -1.37989515800001E-002
1 9 -6.30000000000000E-001 3.22419056422000E-001 -9.52419056422000E-001
299 0 -7.00000000000000E-001 2.52200000000000E 000 -3.22200000000000E 000
299 1 3.30000000000000E 000 2.19980000000000E 000 1.10020000000000E 000
299 2 5.40000000000000E 000 2.30982000000000E 000 3.09018000000000E 000
299 3 2.62000000000000E 000 2.61883800000000E 000 1.16199999999944E-003
299 4 1.99000000000000E 000 2.61895420000000E 000 -6.28954200000001E-001
299 5 1.44000000000000E 000 2.55605878000000E 000 -1.11605878000000E 000
299 6 2.00000000000000E 000 2.44445290200000E 000 -4.44452902000001E-001
299 7 1.56000000000000E 000 2.40000761180000E 000 -8.40007611800001E-001
299 8 2.11000000000000E 000 2.31600685062000E 000 -2.06006850620001E-001
299 9 2.90000000000000E 000 2.29540616555800E 000 6.04593834441999E-001

TD_SIMPLEEXP Tertiary Call

EXECUTE FUNCTION
TD_EXTRACT_RESULTS( 
   ART_SPEC(TABLE_NAME(INFLATION_RES), 
   LAYER(ARTFITMETADATA))) WITH DATA
;

TD_SIMPLEEXP Tertiary Output

SELECT * FROM SIMPLEXP_FITMETRICS;
COUNTRYID 1
ROW_I 0
NUM_SAMPLES 10
VAR_COUNT 2
R_SQUARE 3.42705395016507E-002
R_ADJ_SQUARE -8.64456430606428E-002
STD_ERROR 1.67446500942894E 000
STD_ERROR_DF 8
ME -1.70822849220200E-001
MAE 9.99825316380200E-001
MSE 1.33957200754315E 000
MPE 7.76268368765442E 001
MAPE 1.05010566817189E 002
FSTAT_CALC 2.83893499398607E-001
P_VALUE 6.08638398218590E-001
NUM_DF 1
DENOM_DF 8
SIGNIFICANCE_LEVEL 5.00000000000000E-002
F_CRITICAL 5.31765507157872E 000
F_CRITICAL_P 5.00000000000000E-002
NULL_HYPOTH ACCEPT
COUNTRYID 299
ROW_I 0
NUM_SAMPLES 10
VAR_COUNT 2
R_SQUARE 1.91879434716365E-002
R_ADJ_SQUARE -1.03413563594409E-001
STD_ERROR 3.01165401323532E 000
STD_ERROR_DF 8
ME -1.66134450997801E-001
MAE 1.12536161788620E 000
MSE 2.40932321058825E 000
MPE 3.76800612813070E 001
MAPE 7.66685543551575E 001
FSTAT_CALC 1.56506587323596E-001
P_VALUE 7.02733869435549E-001
NUM_DF 1
DENOM_DF 8
SIGNIFICANCE_LEVEL 5.00000000000000E-002
F_CRITICAL 5.31765507157872E 000
F_CRITICAL_P 5.00000000000000E-002
NULL_HYPOTH ACCEPT