posteriordb icon indicating copy to clipboard operation
posteriordb copied to clipboard

PyMC3 eight school example

Open xidulu opened this issue 1 year ago • 4 comments

tau, the scale parameter should lie on the positive real value space therefore it should be HalfCauchy or be transformed through exponential function?

https://github.com/stan-dev/posteriordb/blob/master/posterior_database/models/pymc3/eight_schools_noncentered.py#L14

xidulu avatar Jul 18 '22 00:07 xidulu

Yes. You are right. Im not very good with pymc3. If you can add a PR that would be great.

I think you should use exp since that is what stan is doing and then we can check that we get the same log density for models both in pymc3 and stan.

MansMeg avatar Jul 18 '22 06:07 MansMeg

@MansMeg Happy to open a PR to fix it, but I am not sure how to check the equivalence of log_density, could you provide some instruction on it?

Thanks

xidulu avatar Jul 18 '22 16:07 xidulu

Are you running PyStan? Then you could just input some random parameter values for both the stan and the pymc3 model. They should return exactly the same value of the log density. See here on the log_prob in rstan. https://mc-stan.org/rstan/reference/stanfit-method-logprob.html

MansMeg avatar Jul 18 '22 16:07 MansMeg

@MansMeg Thanks! I will have a look

xidulu avatar Jul 18 '22 18:07 xidulu

Hi!

I close this issue for now. Just reopen it if you have further questions.

MansMeg avatar Nov 02 '22 08:11 MansMeg