pastas.stats.tests.diagnostics#
- diagnostics(series, alpha=0.05, nparam=0, lags=15, stats=(), float_fmt='{0:.2f}')[source]#
Methods to compute various diagnostics checks for a time series.
- Parameters
series (pandas.Series) – Time series to compute the diagnostics for.
alpha (float, optional) – significance level to use for the hypothesis testing.
nparam (int, optional) – Number of parameters of the noisemodel.
lags (int, optional) – Maximum number of lags (in days) to compute the autocorrelation tests for.
stats (tuple, optional) – Tuple with the diagnostic checks to perform. Not implemented yet.
float_fmt (str) – String to use for formatting the floats in the returned DataFrame.
- Returns
df – DataFrame with the information for the diagnostics checks. The final column in this DataFrame report if the Null-Hypothesis is rejected. If H0 is not rejected (=False) the data is in agreement with one of the properties of white noise (e.g., normally distributed).
- Return type
Pandas.DataFrame
Notes
Different tests are computed depending on the regularity of the time step of the provided time series. pd.infer_freq is used to determined if the time steps are regular.
Examples
>>> data = pd.Series(index=pd.date_range(start=0, periods=1000, freq="D"), >>> data=np.random.rand(1000)) >>> ps.stats.diagnostics(data) Out[0]: Checks Statistic P-value Reject H0 Shapiroo Normality 1.00 0.86 False D'Agostino Normality 1.18 0.56 False Runs test Autocorr. -0.76 0.45 False Durbin-Watson Autocorr. 2.02 nan False Ljung-Box Autocorr. 5.67 1.00 False
In this example, the Null-hypothesis is not rejected and the data may be assumed to be white noise.