MMMPlotSuite.residuals_over_time#

MMMPlotSuite.residuals_over_time(hdi_prob=None)[source]#

Plot residuals over time by taking the difference between true values and predicted.

Computes residuals = true values - predicted using target data from constant_data and predictions from posterior_predictive. Works with any model dimensionality.

Parameters:
hdi_problist of float, optional

List of HDI probability masses to display. Default is [0.94]. Each probability must be between 0 and 1. Multiple HDI bands will be plotted with decreasing transparency for wider bands.

Returns:
figmatplotlib.figure.Figure

The Figure object containing the subplots.

axesnp.ndarray of matplotlib.axes.Axes

Array of Axes objects corresponding to each subplot row.

Raises:
ValueError

If y_original_scale is not in posterior_predictive, instructing the user that this plot requires the original scale predictions. If target_data is not in constant_data. If any HDI probability is not between 0 and 1.

Examples

Plot residuals over time with default 94% HDI:

mmm.plot.residuals_over_time()

Plot residuals with multiple HDI bands:

mmm.plot.residuals_over_time(hdi_prob=[0.94, 0.50])