superstats.diagnostics.plots.time_varying_verification#

Time-varying posterior recovery diagnostics.

Functions

plot_time_varying_verification(estimates, ...)

Plot recovery diagnostics over steps for time-varying parameters.

superstats.diagnostics.plots.time_varying_verification.plot_time_varying_verification(estimates, targets, variable_keys=None, variable_names=None, aggregation=<function median>, colors=['#356673', '#AE534C', '#6B4A6E', '#566B54'], title_fontsize=22, label_fontsize=18, tick_fontsize=16, figsize=None)[source]#

Plot recovery diagnostics over steps for time-varying parameters.

Parameters:
estimatesMapping[str, np.ndarray] or np.ndarray

Posterior samples. If a dict, values of shape (num_sim, num_samples, num_steps), keyed by variable. If an array, shape (num_sim, num_samples, num_steps, num_params) directly.

targetsMapping[str, np.ndarray] or np.ndarray

Ground-truth parameter trajectories, matching the input type of estimates. If a dict, values of shape (num_sim, num_steps). If an array, shape (num_sim, num_steps, num_params) directly.

variable_keyssequence of str or None, optional, default: None

Which variables to select and plot, and in what order, when estimates/targets are dicts. By default, all keys, in dict insertion order. Ignored for array input.

variable_namessequence of str or None, optional, default: None

Display names for the plotted columns, in the same order as variable_keys (or the array’s last axis). Defaults to variable_keys for dict input, or param_0, param_1, … for array input.

aggregationcallable(), optional, default: np.median

Aggregation function passed through to each metric (nrmse, contraction, calibration) when collapsing across simulations. Typically np.mean or np.median.

colorsstr or sequence of str, optional, default: METRIC_COLORS

Row colors, one per metric in the fixed order: correlation, nrmse, contraction, calibration. A single str is applied to all four rows.

title_fontsizeint, optional, default: 22

The font size of the column titles (parameter names).

label_fontsizeint, optional, default: 18

The font size of the axis label texts and row labels.

tick_fontsizeint, optional, default: 16

The font size of the axis tick labels.

figsizetuple of two floats or None, optional, default: None

Explicit figure size in inches. If None, the default layout size is used.

Returns:
figplt.Figure - the figure instance for optional saving
Raises:
ValueError

If estimates/targets are inconsistent (see _prepare_plot_data), or if colors is a sequence whose length doesn’t match the number of metrics (4).

Parameters: