PosteriorPredictResult
Container returned by GAM.posterior_predict().
Usage
PosteriorPredictResult(samples)Holds the full (n, n_draws) posterior predictive sample matrix and provides convenience methods for computing quantile summaries, means, and intervals.
Attributes
samples: numpy.ndarray-
Posterior predictive draws, shape
(n, n_draws). Each column is one draw from the posterior predictive distribution (coefficient uncertainty plus observation noise).
Attributes
| Name | Description |
|---|---|
| n_draws | Number of posterior draws. |
| n_obs | Number of prediction points. |
n_draws
Number of posterior draws.
n_draws: int
n_obs
Number of prediction points.
n_obs: int
Methods
| Name | Description |
|---|---|
| interval() | Equal-tailed posterior predictive interval. |
| mean() |
Posterior predictive mean at each observation, shape (n,).
|
| quantile() | Compute quantile(s) of the posterior predictive distribution. |
| std() |
Posterior predictive standard deviation at each observation, shape (n,).
|
interval()
Equal-tailed posterior predictive interval.
Usage
interval(level=0.95)Parameters
level: float = 0.95- Coverage probability (default 0.95).
Returns
tuple[NDArray, NDArray]-
(lower, upper)arrays, each of shape(n,).
mean()
Posterior predictive mean at each observation, shape (n,).
Usage
mean()quantile()
Compute quantile(s) of the posterior predictive distribution.
Usage
quantile(q)Parameters
q: float | list[float]-
Quantile(s) in [0, 1]. A scalar returns shape
(n,); a list returns(len(q), n).
std()
Posterior predictive standard deviation at each observation, shape (n,).
Usage
std()