pastas.plots.diagnostics#

diagnostics(series, sim=None, alpha=0.05, bins=50, acf_options=None, figsize=(10, 5), fig=None, heteroscedasicity=True, **kwargs)[source]#

Plot that helps in diagnosing basic model assumptions.

Parameters
  • series (pandas.Series) – Pandas Series with the residual time series to diagnose.

  • sim (pandas.Series, optional) – Pandas series with the simulated time series. Used to diagnose on heteroscedasticity. Ignored if heteroscedasticity is set to False.

  • alpha (float, optional) – Significance level to calculate the (1-alpha)-confidence intervals.

  • bins (int optional) – Number of bins used for the histogram. 50 is default.

  • acf_options (dict, optional) – Dictionary with keyword arguments passed on to pastas.stats.acf.

  • figsize (tuple, optional) – Tuple with the height and width of the figure in inches.

  • fig (Matplotib.Figure instance, optional) – Optionally provide a Matplotib.Figure instance to plot onto.

  • heteroscedasicity (bool, optional) – Create two additional subplots to check for heteroscedasticity. If true, a simulated time series has to be provided with the sim argument.

  • **kwargs (dict, optional) – Optional keyword arguments, passed on to plt.figure.

Returns

axes

Return type

matplotlib.axes.Axes

Examples

>>> res = pd.Series(index=pd.date_range(start=0, periods=1000, freq="D"),
>>>                 data=np.random.normal(0, 1, 1000))
>>> ps.stats.plot_diagnostics(res)

Notes

The two right-hand side plots assume that the noise or residuals follow a Normal distribution.

See also

pastas.stats.acf

Method that computes the autocorrelation.

scipy.stats.probplot

Method use to plot the probability plot.