summary

summary(posteriors: dict, alpha: float = 0.05, quantiles: list | None = None, print_summary: bool = True) dict

Prints a statistical summary for each posterior.

Parameters

posteriorsdict

Posterior samples. Posteriors and relative samples are key-value pairs. Each sample is a numpy.ndarray with a number of rows equal to the number of iterations and a number of columns equal to the number of Markov chains.

alphafloat

Significance level. It is used to compute the Highest Posterior Density (HPD) interval. It must be between 0 and 1.

quantileslist, optional

List of the quantiles to compute, for each posterior. It cannot be empty. It must contain only float between 0 and 1. Default is [0.025, 0.25, 0.5, 0.75, 0.975].

print_summarybool, optional

If True prints the statistical posterior summary report. Default is True.

Returns

dict
Dictionary with statistical summary of posteriors. It contains:
  • key n_chain, the number of Markov chains,

  • key n_iterations, the number of regression iterations,

  • key summary, the statistical summary of the posteriors, as a pandas.DataFrame,

  • key quantiles, quantiles summary of the posteriors, as a pandas.DataFrame.

Raises

TypeError
  • If posteriors is not a dict,

  • if a posterior sample is not a numpy.ndarray,

  • if alpha is not a float,

  • if quantiles is not a list,

  • if a quantiles value is not a float,

  • if print_summary is not a bool.

KeyError

If posteriors does not contain intercept key.

ValueError
  • If a posterior sample is an empty numpy.ndarray,

  • if alpha is not between 0 and 1,

  • if quantiles is an empty list,

  • if a quantiles value is not between 0 and 1.

See Also

baypy.regression.linear_regression.LinearRegression