KURTOSIS with Time Series Examples | Teradata Vantage - Examples: Using KURTOSIS with Time Series - Analytics Database - Teradata Vantage

Time Series Tables and Operations

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-10-30
dita:mapPath
tuc1628112453431.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
sfz1493079039055
lifecycle
latest
Product Category
Teradata Vantageā„¢

Example: Calculating the Kurtosis for PTI and non-PTI Tables

The following example shows how the Kurtosis function can be used with both Primary Time Index (PTI) and non-PTI tables.

The examples use the tables and data setup in Table and Data Definition for Time Series Aggregates Examples.

/*PTI Table*/
SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, KURTOSIS(TEMPERATURE)
FROM OCEAN_BUOYS
WHERE TD_TIMECODE BETWEEN TIMESTAMP '2014-01-06 08:00:00' AND TIMESTAMP '2014-01-06 10:30:00'
GROUP BY TIME (MINUTES(10) AND BUOYID)
ORDER BY 3,2,1;  

/*Non-PTI Table*/
SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, KURTOSIS(TEMPERATURE)
FROM OCEAN_BUOYS_NONPTI
WHERE TIMECODE BETWEEN TIMESTAMP '2014-01-06 08:00:00' AND TIMESTAMP '2014-01-06 10:30:00'
GROUP BY TIME (MINUTES(10) AND BUOYID)
USING TIMECODE(TIMECODE)
ORDER BY 3,2,1;

Result:

The results of both queries are identical so only one result set is shown.
TIMECODE_RANGE GROUP BY TIME (MINUTES(10)) BUOYID Kurtosis (TEMPERATURE)
('2014-01-06 08:00:00.000000+00:00', '2014-01-06 08:10:00.000000+00:00') 1 0 ?
('2014-01-06 08:10:00.000000+00:00', '2014-01-06 08:20:00.000000+00:00') 2 0 ?
('2014-01-06 09:00:00.000000+00:00', '2014-01-06 09:10:00.000000+00:00' 7 1 -2.75837669094693E 000
('2014-01-06 10:00:00.000000+00:00', '2014-01-06 10:10:00.000000+00:00') 13 44 -2.17645648488608E 000
('2014-01-06 10:10:00.000000+00:00', '2014-01-06 10:20:00.000000+00:00') 14 44 ?

Example: Using the HAVING Clause to Filter Out NULL Results for the Kurtosis Function

The following example shows how the Kurtosis function can be used with the HAVING clause to filter the results.

The examples use the tables and data setup in Table and Data Definition for Time Series Aggregates Examples.

/*PTI Table*/
SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, KURTOSIS(TEMPERATURE)
FROM OCEAN_BUOYS
WHERE TD_TIMECODE BETWEEN TIMESTAMP '2014-01-06 08:00:00' AND TIMESTAMP '2014-01-06 10:30:00'
GROUP BY TIME (MINUTES(10) AND BUOYID)
HAVING KURTOSIS(TEMPERATURE) IS NOT NULL
ORDER BY 3,2,1;

/*Non-PTI Table*/
SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, KURTOSIS(TEMPERATURE)
FROM OCEAN_BUOYS_NONPTI
WHERE TIMECODE BETWEEN TIMESTAMP '2014-01-06 08:00:00' AND TIMESTAMP '2014-01-06 10:30:00'
GROUP BY TIME (MINUTES(10) AND BUOYID)
USING TIMECODE(TIMECODE)
HAVING KURTOSIS(TEMPERATURE) IS NOT NULL
ORDER BY 3,2,1;

Result:

The results of both queries are identical so only one result set is shown.
TIMECODE_RANGE GROUP BY TIME (MINUTES(10)) BUOYID Kurtosis (TEMPERATURE)
('2014-01-06 09:00:00.000000+00:00', '2014-01-06 09:10:00.000000+00:00' 7 1 -2.75837669094693E 000
('2014-01-06 10:00:00.000000+00:00', '2014-01-06 10:10:00.000000+00:00') 13 44 -2.17645648488608E 000