While working on my GSoC prior vs posterior prototype (which accepts draws objects for both prior and posterior inputs), I noticed that mcmc_* functions handle posterior::draws objects fine — prepare_mcmc_array() checks posterior::is_draws(x) and coerces to array — but the PPC/PPD side doesn't.
validate_predictions() in helpers-ppc.R does:
stopifnot(is.matrix(predictions), is.numeric(predictions))
So passing a draws_matrix or draws_array as yrep to any ppc_* function fails immediately, even though these are standard outputs from cmdstanr and brms workflows. Users have to manually call as.matrix() first.
Seems like adding a draws check at the top of validate_predictions() (similar to what prepare_mcmc_array() already does) would fix this for all PPC/PPD functions at once. Happy to put up a PR if that sounds reasonable.
While working on my GSoC prior vs posterior prototype (which accepts draws objects for both prior and posterior inputs), I noticed that
mcmc_*functions handleposterior::drawsobjects fine —prepare_mcmc_array()checksposterior::is_draws(x)and coerces to array — but the PPC/PPD side doesn't.validate_predictions()inhelpers-ppc.Rdoes:So passing a
draws_matrixordraws_arrayasyrepto anyppc_*function fails immediately, even though these are standard outputs from cmdstanr and brms workflows. Users have to manually callas.matrix()first.Seems like adding a draws check at the top of
validate_predictions()(similar to whatprepare_mcmc_array()already does) would fix this for all PPC/PPD functions at once. Happy to put up a PR if that sounds reasonable.