# PPCResult


Result of a posterior predictive check on a fitted GAM.


Usage

``` python
PPCResult(
    y_rep,
    observed,
    _stats=dict(),
)
```


## Attributes


`y_rep: NDArray`  
Posterior predictive draws on the response scale, shape `(n, n_sim)`. Each column is one draw from the posterior predictive distribution (a plausible dataset the model could have generated).

`observed: NDArray`  
Observed response values used to fit the model, shape `(n,)`.


## Attributes

| Name | Description |
|----|----|
| [stat_names](#stat_names) | Names of the computed test statistics. |

------------------------------------------------------------------------


### stat_names


Names of the computed test statistics.


`stat_names: list[str]`


## Methods

| Name | Description |
|----|----|
| [p_value()](#p_value) | Bayesian p-value for a named test statistic. |
| [stat()](#stat) | Return `(observed_value, rep_values)` for a named statistic. |

------------------------------------------------------------------------


### p_value()


Bayesian p-value for a named test statistic.


Usage

``` python
p_value(name)
```


The Bayesian p-value is the proportion of replicated datasets for which the test statistic equals or exceeds the observed value: p = P(T(y^\text{rep}) \ge T(y^\text{obs})).

Values near 0.5 indicate good calibration. Values near 0 or 1 indicate systematic discrepancy between the model and the data.


#### Parameters


`name: str`  
One of `"mean"`, `"sd"`, `"min"`, `"max"`, `"prop_zero"`.


------------------------------------------------------------------------


### stat()


Return `(observed_value, rep_values)` for a named statistic.


Usage

``` python
stat(name)
```
