4 ms·
Did the post ever actually answer the question: > this is an awesome example. is there an easy way (as in non-brute force) to finding the beta parameters that'
by acidbaseextract 6y ago
Did the post ever actually answer the question:
> this is an awesome example. is there an easy way (as in non-brute force) to finding the beta parameters that'll match a probability?
- klipt 6y agoSomething like Newton's method would probably do the trick.
- acidbaseextract 6y agoThat makes sense in the analytic case, but you mean in the monte-carlo case? I presume just 4D Newton's method on the final integral over the pdf_X to get the value we're looking for? It makes sense, I'm just surprised the blog never comes out and says "you have to do a brute force search to get the parameters for the likelihoods A ~ Beta(2,13) and B ~ Beta(3,11) for P(B > A) to have about the right value".
- mlthoughts2018 6y agoYour comment sounds very confused, can you elaborate? What do you mean “in the analytics case, but you mean in the monte carlo case?” I can’t parse that sentence as a response to the parent comment. Further what do you mean by > “ the blog never comes out and says "you have to do a brute force search to get the parameters for the likelihoods A ~ Beta(2,13) and B ~ Beta(3,11) for P(B > A) to have about the right value".” What do you mean by “brute force search” here?
- mlthoughts2018 6y agoI think you mean Newton-Cotes quadrature, but be careful. “Newton’s method” will 100% of the time be taken to mean the Newton-Raphson root finding method instead, which is widely taught as “Newton’s method” (while in quadrature it’s always referred to as Newton-Cotes).
- sAbakumoff 6y agohttps://stats.stackexchange.com/questions/47916/bayesian-batting-average-prior/47921#47921 https://stats.stackexchange.com/questions/47916/bayesian-bat...
- proto-n 6y agoYes he did, in two parts: easy non-brute-force ways exist (as in the Monte-Carlo integration in R, he argues why it isn't brute force) and also a non-easy analytical solution exists (when at least one set of parameters are integer, in the linked cross validated post). He also explains that easy analytical solutions often don't exists to seemingly easy questions, such as this one. That's why Bayesian statistics needs Monte-Carlo.
- acidbaseextract 6y agoMaybe I'm an idiot, but I thought he showed how to evaluate "P(B > A)" given A ~ Beta(2,13) and B ~ Beta(3,11). What I'm asking is: how do you find parameters for A and B given "P(B > A) = 0.71"?
- proto-n 6y agoYou are right, I'm the idiot and didn't read the question carefully... About the actual question, I don't think that's very well specified in this form. You could have A~Beta0 where Beta0 is very concentrated around let's say 0.5, and then find a B~Beta1 where Beta1 has 71% of its weight above 0.5. That would be a pretty good approximation for it, in fact as close as you want if you increase sample size of A. I can't verify this, but I think finding Beta1 should be easy. Obv this is not what you are looking for though, because this would require A to have a much larger sample size than B. I guess we should add some restriction, like similar sample sizes.
- eutectic 6y agoQuite fast and accurate: from scipy.stats import beta import numpy as np def betamax(params0, params1, integration_points=5000): u0 = params0[0] / sum(params0) u1 = params1[0] / sum(params1) flip = u0 < u1 if flip: params0, params1 = params1, params0 q = beta(*params0).ppf(np.linspace(0, 1, integration_points + 2)[1:-1]) c = beta(*params1).cdf(q) p = c.mean() if flip: return 1 - p return p
- acidbaseextract 6y agoI appreciate the clarity in code — I'm asking for `betamaxinv` I think? >>> betamax((3, 14), (4, 12)) 0.29448379324802676 >>> betamaxinv(0.29, allowed_error=0.01) [((3, 14), (4, 12)), ...] I assume the results of `betamaxinv` are not unique, and so perhaps there need to be constraints, or return a family of results. I don't know. I'm trying to wrap my head around how OP got A ~ Beta(2,13) and B ~ Beta(3,11) without just brute forcing numbers into `betamax`.