models.BayesGlmFit

A sampled Bayesian GLM, from BayesGlm.fit.

Usage

models.BayesGlmFit()

Attributes

Name Description
chains Number of chains.
coefficient_draws Coefficient draws, one row per draw (chain by chain).
dispersion_draws Dispersion draws, one per draw (constant when fixed).
divergences Divergent transitions among the kept draws.
names Coefficient names.
posterior_mean Posterior means of the coefficients.

chains

Number of chains.

chains: int


coefficient_draws

Coefficient draws, one row per draw (chain by chain).

coefficient_draws: list[list[float]]


dispersion_draws

Dispersion draws, one per draw (constant when fixed).

dispersion_draws: list[float]


divergences

Divergent transitions among the kept draws.

divergences: int


names

Coefficient names.

names: list[str]


posterior_mean

Posterior means of the coefficients.

posterior_mean: list[float]

Methods

Name Description
log_likelihood() Pointwise log-likelihood of y given design: one row per draw,
loo() PSIS-LOO of y given design, with each observation’s relative
predict() Posterior mean of each row’s mean.
predict_distribution() Posterior predictive draws across the rows, keyed row = 0, 1, ....
summary() Posterior summary: one dict per parameter with name, mean,

log_likelihood()

Pointwise log-likelihood of y given design: one row per draw,

Usage

log_likelihood(design, y)

one column per observation, for elpd_loo or elpd_waic.

Returns
list of list of float

loo()

PSIS-LOO of y given design, with each observation’s relative

Usage

loo(design, y)

efficiency estimated from the chains.

Returns
Elpd

predict()

Posterior mean of each row’s mean.

Usage

predict(design)
Returns
list of float

predict_distribution()

Posterior predictive draws across the rows, keyed row = 0, 1, ....

Usage

predict_distribution(design, n_sims, seed)
Returns
PredictiveDistribution

summary()

Posterior summary: one dict per parameter with name, mean,

Usage

summary()

sd, q05, q50, q95, rhat, ess_bulk and ess_tail; the dispersion last when it was sampled.

Returns
list of dict