stanbkt.utils.posterior_summary#

stanbkt.utils.posterior_summary(draws, col_mapping=None, quantiles=[0.025, 0.975], data=None)#

Summarise posterior predictions into per-observation statistics.

Parameters:
  • draws (Union[dict[str, DataFrame], dict[str, CmdStanGQ]]) – Either draw-level DataFrames (as returned by predict_posterior_draws or predict_smoothed_posterior_draws), or raw CmdStanGQ objects (as returned by predict_posterior_stan or predict_smoothed_posterior_stan). When passing CmdStanGQ objects, data must also be supplied.

  • col_mapping (Union[Mapping[ColumnNames, str], Mapping[str, str], Mapping[ColumnNames | str, str], None]) – Column name mapping. If None, the standard ColumnNames defaults are used.

  • quantiles (list[float]) – Credible-interval quantiles to include in the summary. Each value must be in [0, 1].

  • data (Optional[DataFrame]) – Original student interaction data. Required when draws contains CmdStanGQ objects; ignored otherwise.

Returns:

Long-form summary with mean, std, median, and the requested quantiles for pKnow and pCorrectness.

Return type:

DataFrame