trend_test
- hana_ml.algorithms.pal.tsa.trend_test.trend_test(data, key=None, endog=None, method=None, alpha=None)
Trend test is a statistical method used in time series analysis to determine whether there is a consistent upward or downward movement over time, and calculate the de-trended time series.
- Parameters:
- dataDataFrame
The input data should comprise at least two columns. One is ID column, while the other is raw data.
- keystr, optional
The ID column.
Defaults to the first column of data if the index column of data is not provided. Otherwise, defaults to the index column of data.
- endogstr, optional
The column of series to be tested.
Defaults to the first non-ID column.
- method{'mk', 'difference-sign'}, optional
Specifies the method used to identify the trend:
-'mk': Mann-Kendall test. -'difference-sign': Difference-sign test.
Defaults to 'mk'.
- alphafloat, optional
The significance value.
Its typical value ranges between 0 and 0.5, asserting confidence in the observed trend within the series.
Defaults to 0.05.
- Returns:
- DataFrames
DataFrame 1 : statistics, structured as follows:
STAT_NAME: includes
TREND: -1 for downward trend, 0 for no trend, and 1 for upward trend
S: the number of positive pairs minus the negative pairs
P-VALUE: The p-value of the observed S
STAT_VALUE: value of stats above.
DataFrame 2 : a detrended table, structured as follows:
ID : Time stamp that is monotonically increasing sorted.
DETRENDED_SERIES: The corresponding de-trended time series. The first value absents if trend presents.
Examples
>>> stats, detrended = trend_test(data=df, key='ID', endog='SERIES', method='mk', alpha=0.05) >>> stats.collect() >>> detrended.collect()