tslumen.profile.stat_tests module¶
Statistical tests.
-
class
tslumen.profile.stat_tests.
TestResult
(test: str, p_value: float, confidence_level: float, null_hypothesis: str, reject_null_hypothesis: bool, details: Optional[Dict[str, Any]])[source]¶ Bases:
tslumen.profile.base._DCDict
-
confidence_level
: float¶
-
details
: Optional[Dict[str, Any]]¶
-
null_hypothesis
: str¶
-
p_value
: float¶
-
reject_null_hypothesis
: bool¶
-
test
: str¶
-
-
tslumen.profile.stat_tests.
adfuller_stationarity
(data: pandas.core.series.Series, confidence_level: float = 0.05) → tslumen.profile.stat_tests.TestResult[source]¶ Augmented Dickey-Fuller unit root test, can be used to test for a unit root in a univariate process in the presence of serial correlation.
- Parameters
data (pd.Series) – Time series.
confidence_level (float) – Confidence level for rejecting the null hypothesis.
- Returns
test name, p-value, null hypothesis, reject?, confidence level and details.
- Return type
-
tslumen.profile.stat_tests.
jarque_bera_normality
(data: pandas.core.series.Series, confidence_level: float = 0.05) → tslumen.profile.stat_tests.TestResult[source]¶ The Jarque-Bera test statistic tests the null hypothesis that the data is normally distributed against an alternative that the data follow some other distribution.
- Parameters
data (pd.Series) – Time series.
confidence_level (float) – Confidence level for rejecting the null hypothesis.
- Returns
test name, p-value, null hypothesis, reject?, confidence level and details.
- Return type
-
tslumen.profile.stat_tests.
kpss_stationarity
(data: pandas.core.series.Series, confidence_level: float = 0.05) → tslumen.profile.stat_tests.TestResult[source]¶ Kwiatkowski-Phillips-Schmidt-Shin test for the null hypothesis that the data is level or trend stationary.
- Parameters
data (pd.Series) – Time series.
confidence_level (float) – Confidence level for rejecting the null hypothesis.
- Returns
test name, p-value, null hypothesis, reject?, confidence level and details.
- Return type
-
tslumen.profile.stat_tests.
levene_constant_variance
(data: pandas.core.series.Series, confidence_level: float = 0.05) → tslumen.profile.stat_tests.TestResult[source]¶ Levene test for constant variances, tests the null hypothesis that all input samples are from populations with equal variances.
- Parameters
data (pd.Series) – Time series.
confidence_level (float) – Confidence level for rejecting the null hypothesis.
- Returns
test name, p-value, null hypothesis, reject?, confidence level and details.
- Return type
-
tslumen.profile.stat_tests.
ljungbox_autocorrelation
(data: pandas.core.series.Series, n_lags: Optional[int] = None, confidence_level: float = 0.05) → tslumen.profile.stat_tests.TestResult[source]¶ Null hypothesis - no auto correlation amounts specified lags.
- Parameters
data (pd.Series) – Time series.
n_lags (int) – Number of lags, if not supplied calculated as
10*log(data.length)
.confidence_level (float) – Confidence level for rejecting the null hypothesis.
- Returns
test name, p-value, null hypothesis, reject?, confidence level and details.
- Return type
-
tslumen.profile.stat_tests.
omnibus_normality
(data: pandas.core.series.Series, confidence_level: float = 0.05) → tslumen.profile.stat_tests.TestResult[source]¶ Omnibus test for normality, null hypothesis: data is normally distributed.
- Parameters
data (pd.Series) – Time series.
confidence_level (float) – Confidence level for rejecting the null hypothesis.
- Returns
test name, p-value, null hypothesis, reject?, confidence level and details.
- Return type