ts.kurtosis() | Teradata Package for R - ts.kurtosis() - Teradata Package for R

Teradata® Package for R User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Release Number
17.20
Published
March 2024
Language
English (United States)
Last Update
2024-04-09
dita:mapPath
efv1707506846369.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
nqx1518630623256
Product Category

The aggregate function ts.kurtosis() measures the tailedness of the probability distribution of a column in each group.

Kurtosis is the fourth moment of the distribution of the standardized (z) values. It is a measure of the outlier (rare, extreme observation) character of the distribution as compared to the normal (Gaussian) distribution.
• The normal distribution has a kurtosis of 0.
• Positive kurtosis indicates that the distribution is more outlier-prone (deviation from the mean) than the normal distribution.
• Negative kurtosis indicates that the distribution is less outlier-prone (deviation from the mean) than the normal distribution.
• This function is valid only on columns with numeric types.
• Nulls are not included in the result computation.
• Following conditions produce NULL result:
• Fewer than three non-NULL data points in the data used for the computation.
• Standard deviation for a column is equal to 0.
Arguments:
• value.expression: Specify the column for which kurtosis is to be computed.

Use ts.kurtosis(distinct(column_name)) to exclude duplicate rows while calculating kurtosis values.

Example 1: Calculate the Kurtosis of the 'temperature' column of sequenced PTI table

• Calculate the kurtosis.
`> df_seq_kurtosis <- df_seq_grp %>% summarise(kurtosis_temp = ts.kurtosis(temperature))`
• Print the results.
```> df_seq_kurtosis %>% arrange(TIMECODE_RANGE, buoyid, kurtosis_temp)
# Source:     lazy query [?? x 4]
#   [TDAPUSER@<hostname>/TDAPUSERDB]
# Ordered by: TIMECODE_RANGE, buoyid, kurtosis_temp
TIMECODE_RANGE                                 `GROUP BY TIME(MINUTES~ buoyid kurtosis_temp
<chr>                                          <int64>                  <int>         <dbl>
1 2014-01-06 08:00:00.000000+00:00,2014-01-06 0~ 35345                        0         -6.00
2 2014-01-06 09:00:00.000000+00:00,2014-01-06 0~ 35347                        1         -2.76
3 2014-01-06 10:00:00.000000+00:00,2014-01-06 1~ 35349                       44         -2.31
4 2014-01-06 10:30:00.000000+00:00,2014-01-06 1~ 35350                       22         NA
5 2014-01-06 10:30:00.000000+00:00,2014-01-06 1~ 35350                       44         NA
6 2014-01-06 21:00:00.000000+00:00,2014-01-06 2~ 35371                        2         NA  ```

Example 2: Calculate the Kurtosis of the 'temperature' column of non-PTI table

• Calculate the kurtosis.
`> df_nonpti_kurtosis <- df_nonpti %>% group_by_time(timebucket.duration = "10m", timecode.column = "TIMECODE") %>% summarise(kurtosis_temp = ts.kurtosis(temperature))`
• Print the results.
```> df_nonpti_kurtosis %>% arrange(TIMECODE_RANGE, kurtosis_temp)
# Source:     lazy query [?? x 3]