Message Boards Message Boards

0
|
5965 Views
|
7 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Find percentile of beta distribution?

Posted 6 years ago

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?

POSTED BY: Alex Graham
7 Replies
Anonymous User
Anonymous User
Posted 6 years ago

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?

POSTED BY: Anonymous User

Hello Alex,

that's simple: just use the Quantile function

Quantile[BetaDistribution[a, b], 0.05]
POSTED BY: Claude Mante
Posted 6 years 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 BY: Alex Graham
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 site

With a good hint of user Claude Mante

Quantile[BetaDistribution[a, b], #] & /@ {0.05, 0.95}

(* {0.0976115, 0.751395}*)
POSTED BY: Mariusz Iwaniuk
Posted 6 years 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 BY: Alex Graham
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 BY: Mariusz Iwaniuk

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 BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract