How to change number of samples drawn by sample_posterior_predictive

It’s not entirely clear to me what you are trying to do here, so I apologize if my answer isn’t what you are looking for. In general, it’s ideal to pull an arbitrary number of samples from your trace and generate a credible set of observations for each sample. So if you want to see what your data could have looked like (conditional on your model, priors, and the data you used to sample in the first place), you can generate N credible data sets:

N = 100
with model:
    posterior_checks = pm.sample_posterior_predictive(trace, samples=N)
print(posterior_checks['Obs'].shape)
# (100, 5)

Unless I have strong reason to do otherwise, I typically generate as many credible data sets as I have samples because I don’t have to use all of them if I don’t want to (e.g., I can always use a random subset of these data sets). Plus posterior predictive sampling is fast:

# N is now implied by the number of chains/samples in trace
with model:
    posterior_checks = pm.sample_posterior_predictive(trace)

print(posterior_checks['Obs'].shape)
# (2000, 5)

If you need/want more credible data sets than you have samples in your trace, my suggestion is to sample for longer so that you have at least as many samples in your trace as you need credible data sets. If sampling is very expensive (i.e., your model and/or your data set is huge), it is possible to get additional credible data sets by using the size argument, but it’s not recommended.