For each requested probability, finds the x value where the CDF (and its credible bounds) crosses that probability.
Usage
extract_quantiles(cdf_summary, probs = c(0.5, 0.95), cdf_mat = NULL)Arguments
- cdf_summary
A data frame produced by
compute_predictive_cdf(), with columnsx,median,low, andhigh.- probs
Numeric vector of probabilities to extract (default:
c(0.5, 0.95)).- cdf_mat
Numeric matrix of posterior CDF draws as returned by
compute_predictive_cdf()(rows = posterior draws, columns =x_seqgrid points). When supplied, the 95% prediction interval bounds (x_low,x_high) are computed by interpolating each draw's CDF to find the x at which it crossesp, then taking the 2.5% and 97.5% quantiles across draws. This is fully consistent with the ribbon in the CDF plot (both derive from the samecdf_mat). IfNULL, falls back to inverting the summary credible bands, which can fail near the tails.