Compute posterior predictive CDF from a fitted Stan model
Source:R/utils.R
compute_predictive_cdf.RdIntegrates over posterior draws and between-study random effects to produce a predictive CDF with pointwise credible bands.
Usage
compute_predictive_cdf(
fit,
dist_name,
x_seq = seq(0, 30, length.out = 500),
n_draws = 500,
L = 2000
)Arguments
- fit
A
stanfitobject returned byrstan::sampling().- dist_name
Character string:
"lognormal","gamma","weibull","burr12"(Burr Type XII), or"gengamma"(Generalised Gamma, Prentice parameterisation).- x_seq
Numeric vector of evaluation points (default: 500 points on
[0, 30]).- n_draws
Number of posterior draws to use (default: 500).
- L
Number of study-level locations to integrate over per draw (default: 2000). When
n_datasets < 5,mean(loc_d)is used directly for allLlocations (i.e. no between-study sampling) for consistency with the Stan generated quantities block — seeprepare_stan_data_from_datasets()for details.