3 Week 3: Bayesian statistics: Prediction

3.3 Using the predictive for model checking and evaluation

Example: Faults in lengths of cloth

Figure 3.6: Link, Caption: The line shows the posterior mean. The black lines show 95% intervals for the mean

Example: Faults in lengths of cloth

Figure 3.7: Link, Caption: These line show the median for the posterior predictive and 95% CIs for the posterior predictive

3.3.1 The posterior p-value

The posterior p-value

Bayesians use the predictive for model checking.  In this case there are four points would be highly unlikely from the model we ave suggested.

The posterior p-value

The posterior p-value of a point is the probability of a future observation being at least as extreme as that observed in the data.

In our case the Poisson likelihood did not have enough variability to describe four of the points.

Faults in lengths of cloth

Calculation of Bayesian p values in R

> pnbinom(y[30], size=G, prob=H/(H+x[30]), lower.tail =FALSE )
[1] 0.0002309319

> 1-pnbinom(y[4], size=G, prob=H/(H+x[4]), lower.tail = FALSE)
[1] 0.0007879166

> 1-pnbinom(y[31], size=G, prob=H/(H+x[31]), lower.tail = FALSE)
[1] 0.008019882

> pnbinom(y[23], size=G, prob=H/(H+x[23]), lower.tail = TRUE)
[1] 0.006570922