# Find percentile of beta distribution?

Posted 6 months ago
995 Views
|
7 Replies
|
3 Total Likes
|
 Hello. I want to find percentile of beta distribution and I should get the answer like that 0.0023. Clear["Global*"] a = 0.848; b = 117.46; NSolve[PDF[BetaDistribution[a, b], p] == 0.05 && 1 >= p >= 0, p] But it takes infinite time to be solved, so what should I correct in the code?
7 Replies
Sort By:
Posted 6 months ago
 Alex,You should use FindRoot because NSolve first tries to analytically solve it and that is what is taking so long. In[4]:= FindRoot[PDF[BetaDistribution[a, b], p] == 0.05, {p, .1}] Out[4]= {p -> 0.0611872} Regards,Neil
Posted 6 months ago
 Clear["Global*"] a = 0.848; b = 117.46; NSolve[Simplify[PDF[BetaDistribution[a, b], p] == 0.05, 0 < p < 1], p, Reals] (* {{p -> 0.0611872}} *) 
Posted 6 months ago
 Thank you for your replies. Could you please take a look at the link, It seems I need to find something different to get 0.0027 https://www.dropbox.com/s/1jxeslir8bbq3lb/1988.jpg?dl=0 With p=0.95 I get {{p -> 0.0377553}} What is more interesting this online thing with corresponding a and b gives the answer 0.0226 instaed of 0.0022... https://keisan.casio.com/exec/system/1180573227 Thanks in advance
Posted 6 months ago
 According to the second link the it must have an integral inside. But I have some problem with integrate fucntion. Clear["Global*"] a = 2.7817; b = 129.8309; NSolve[Simplify[ Integrate[PDF[BetaDistribution[a, b], t], {t, p, 1}] == 0.05 && 1 > p > 0], p] 
Posted 6 months ago
 funcL = Integrate[ Simplify[PDF[BetaDistribution[a, b], t], 1 > t > 0], {t, 0, p}, Assumptions -> {0 < p < 1, b > 0, a > 0}]; funcU = Integrate[ Simplify[PDF[BetaDistribution[a, b], t], 1 > t > 0], {t, p, 1}, Assumptions -> {0 < p < 1, b > 0, a > 0}]; a = 2;(*I assume*) b = 3;(*I assume*) LowerP = FindRoot[funcL == 0.05, {p, 1/2}] (* {p -> 0.0976115} *) UpperQ = FindRoot[funcU == 0.05, {p, 1/2}] (* {p -> 0.751395} *) The results agree with the siteWith a good hint of user Claude Mante Quantile[BetaDistribution[a, b], #] & /@ {0.05, 0.95} (* {0.0976115, 0.751395}*) 
 Hello Alex,that's simple: just use the Quantile function Quantile[BetaDistribution[a, b], 0.05] 
 Input: PDF[BetaDistribution[a, b], p]Output:  116 51 (1 - p) ------------- 0.15 p `this doesn't look like a differential equation to me. using dsolve and even moreso integrating before using dsolve? perhaps there are some assumptions to make not mentioned above?