Skip to content

New posterior_pit and loo_pit functions #1855

Description

@avehtari

Posterior-PIT and LOO-PIT values can currently be computed using functions brms::posterior_predict() and posterior::pit() (the latter accepts weights) and rank based computation. As the observation family is known in brms, it would be be possible to improve PIT computation by computing $\mathrm{PIT}_s$ using the parametric distribution conditional on $s$'th posterior draw $(s=1,...,S)$. For continuous distributions this is CDF. Discrete distributions pick random point uniformly between two CDF (Czado et al., 2009). Posterior-PIT is then computed as average of $\mathrm{PIT}_s$ and LOO-PIT is computed as weighted average. Using CDF for each posterior draw, improves accuracy of PIT values especially in tails which helps detecting outliers. CDFs are already available for all (or almost all?) univariate observation families as they are used in case of censoring and truncation.

Alternative to adding both posterior_pit and loo_pit, and making them to compute the posterior/LOO averaged PITs, even just having a simpler function like posterior_predcdf(), which would compute CDF's for all posterior draws and observations (returning S x N matrix). Usual arguments would be ndraws and drawids.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions