Posterior predict with sample larger than population (with replacement?)

I have run a brms model and would like to take a large number of posterior draws for prediction. The model was trained with 5000 total post-warmup draws, and that appears to be the limit of draws I get with posterior_predict. But the error message it gives suggests that I could take more draws if I allows for replacement. Any guidance on this method or what else would be best to do? Thanks!

pp <- posterior_predict(model1, newdata = dataset, seed = 7, ndraws = 30000)
Error in sample.int(length(x), size, replace, prob) :
  cannot take a sample larger than the population when 'replace = FALSE'

The key thing to keep in mind here is what the posterior_predict function does. For each iteration (draw), it calculates the posterior-implied outcome value (i.e., the value of the outcome implied by the parameter values at the current iteration). For this reason, you cannot request more samples than draws - because there are only a fixed number of iterations with parameter values to use for generating predictions.

The error there is not brms indicating that you can get more draws if you use replacement, that’s an error from one of the internal functions - because brms is assuming that the ndraws value will always be smaller than the number of sampled iterations. I’ll open an issue on the brms github so there should be a more informative error in the future

brms has just updated the error for this case, if you install the github version:

if (!requireNamespace("remotes")) {
  install.packages("remotes")
}
remotes::install_github("paul-buerkner/brms")

It should error more informatively

Thank you for the quick follow-up!