Created
May 7, 2023 18:44
-
-
Save mitzen/98e50c92fe869942962117a7b0a4b8db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| A stationary test is used in time series analysis to determine whether a given time series is stationary or not. Stationarity is a key assumption in many time series models, and if a time series is found to be non-stationary, it may need to be transformed or differenced before it can be effectively modeled. | |
| The purpose of conducting a stationary test on a time series is to assess whether the statistical properties of the series remain constant over time, such as the mean, variance, and autocorrelation. A stationary time series is one in which these properties do not change over time, meaning that the distribution of values remains the same across different time periods. | |
| There are several methods for conducting stationary tests, including visual inspection, statistical tests such as the Augmented Dickey-Fuller (ADF) test or the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test, and time series decomposition methods such as seasonal decomposition of time series (STL). | |
| By conducting a stationary test, analysts can determine whether a time series is suitable for modeling with time series models such as ARIMA, VAR, or exponential smoothing. If a time series is found to be non-stationary, it may need to be transformed or differenced before it can be effectively modeled. Furthermore, if a time series is found to be stationary, it suggests that its statistical properties are consistent over time, which can help to make more accurate predictions and forecast future trends. | |
| """ | |
| def Fuller(TimeSeries): | |
| """Provides Fuller test results for TimeSeries""" | |
| stationary_test = adfuller(TimeSeries) | |
| print('ADF Statistic: %f' % stationary_test[0]) | |
| print('p-value: %f' % stationary_test[1]) | |
| print('Critical Values:') | |
| for key, value in stationary_test[4].items(): | |
| print('\t%s: %.3f' % (key, value)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment