Percentiles from prior, posteriors and predictive posterior

Are there examples, functions in Pymc3 to calculate
I have data–> i fit it to a gumbel, → i update my model

I want to know 5 percentile of prior of X, posterior distribution of X and posterior predictive distribution of X
Very similar to the concept of PPF in scipy stats/frequentistic apporach
ppf(q, s, loc=0, scale=1)** Percent point function (inverse of cdf — percentiles).

Something like this (where i can find the (X,0.05 given Data)

feel free to ask questions

pm.sample gives you a big array of samples; so pass it to np.percentile on it to grab the appropriate percentiles. As this is a random sample, this won’t be exact. You can sample 10 chains, and obtain percentiles for each chain, to establish the sampling uncertainty of the percentile (or you can use lots of samples).

1 Like

You can also use xarray.DataArray.quantile — xarray 0.17.1.dev0+g835a53e6.d20210226 documentation on InferenceData groups.

Also, the error can be estimated with arviz.mcse using the quantile method: arviz.mcse — ArviZ dev documentation

1 Like