Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot_ppc for discrete data #1103

Open
jeffpollock9 opened this issue Mar 3, 2020 · 4 comments
Open

plot_ppc for discrete data #1103

jeffpollock9 opened this issue Mar 3, 2020 · 4 comments

Comments

@jeffpollock9
Copy link
Contributor

Hi, firstly thanks for a great package!

I think arviz doesn't currently support posterior predictive checks for discrete data - is that correct? Assuming that is correct - is there any interest in it? I think something along the same lines as https://mc-stan.org/bayesplot/reference/PPC-discrete.html would be great.

Cheers!

@OriolAbril
Copy link
Member

I think there is limited support for ppc checks with discrete data, however, it would be great to extend its capabilities. cc @aloctavodia @agustinaarroyuelo

@aloctavodia
Copy link
Contributor

Hi @jeffpollock9, as Oriol said the support is limited.

We have a Google Summer of code project that will address this and other issues related to support for discrete variables.

@jeffpollock9
Copy link
Contributor Author

Thanks for getting back to me. @OriolAbril and @aloctavodia. Looking forward to seeing the results of the google summer of code project!

@canyon289
Copy link
Member

canyon289 commented Apr 19, 2020

@jeffpollock9 thanks for making an issue. It's possible to plot discrete data but looking at the bayesplot one ours could be nicer.

import pymc as pm
from scipy import stats

coin_flips_obs = stats.binom(12, .5).rvs(333)

with pm.Model() as coin_flips:
    p = pm.Beta("p", 10000,1)
    heads = pm.Binomial("heads", p=p, n=11, observed=coin_flips_obs)
    trace = pm.sample(chains=2, draws=1000)
    coin_flip_posterior_predictive = pm.sample_posterior_predictive(trace)
coin_data = az.from_pymc3(trace=trace, posterior_predictive=coin_flip_posterior_predictive)
az.plot_ppc(coin_data)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants