| tulpa_pit | R Documentation |
The generic, family-agnostic half of a PIT residual check: the model package
supplies the posterior-predictive CDF evaluated at each observation (a
[n_draws x n_obs] matrix, or a draw-averaged [n_obs] vector), and this
returns the PIT value per observation. For a discrete or mixed response
(a hurdle has a point mass at zero) supply the left limit cdf_lower
(P(Y < y)); the randomized PIT then draws one uniform per observation and
interpolates F(y^-) + U (F(y) - F(y^-)), which is uniform under a correct
model. With cdf_lower = NULL the response is treated as continuous and the
PIT is the draw-averaged CDF.
tulpa_pit(
cdf,
cdf_lower = NULL,
jitter = TRUE,
log_lik = NULL,
tail_points = NULL,
n_threads = 1L
)
cdf |
Posterior-predictive CDF at the observed value, |
cdf_lower |
Optional left-limit CDF |
jitter |
If |
log_lik |
Optional |
tail_points |
Optional override for the PSIS tail size used by the
leave-one-out weighting (see |
n_threads |
Number of threads for the leave-one-out weighting (one
observation per thread). Ignored unless |
Supplying log_lik switches to the leave-one-out PIT (as in INLA's
cpo$pit or loo::psis_loo()'s LOO-PIT): each observation's CDF limits are
averaged over draws with PSIS leave-one-out weights (from that
observation's own pointwise log-likelihood) instead of equal weights, so
the PIT does not use the observation to predict itself. A column whose
importance ratio is not all finite falls back to the equal-weight average
for that observation.
Numeric vector of length n_obs of PIT values in [0, 1].
tulpa_criteria(), tulpa_psis()
set.seed(1)
Fl <- matrix(runif(200 * 10, 0, 0.4), 200, 10) # per-draw CDF limits
Fu <- Fl + 0.3
tulpa_pit(Fu, cdf_lower = Fl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.