Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
Sampling from a Beta(a,b) distribution (Read 2018 times)
SamW
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 18
Sampling from a Beta(a,b) distribution
Nov 26th, 2010 at 12:41pm
 
Can anyone help with how to draw random numbers from a Beta(a,b) distribution? 

I'm programming a Dirichlet Process Prior for rate categories but do not know of a built-in HyPhy function that draws from this distribution.

Does one already exist?  If so, can someone point me to source code or instructions on how to implement?

Any help will be much appreciated.  Thank you!
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Sampling from a Beta(a,b) distribution
Reply #1 - Dec 10th, 2010 at 3:12pm
 
Hi Sam,

Sorry took me a while to answer. Look inside TemplateBatchFiles/Utility/ProbabilityDistributions.bf
It has a sampleFromBeta (p,q) function.

Use example:

Code:
LoadFunctionLibrary ("ProbabilityDistributions");

for (k = 0; k < 10; k += 1)
{
     fprintf (stdout, sampleFromBeta (5,5), "\n");
}

 



Sergei
Back to top
 

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged
 
SamW
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 18
Re: Sampling from a Beta(a,b) distribution
Reply #2 - Dec 10th, 2010 at 4:28pm
 
Thanks a bunch!  I was wondering where those distros are at. 

Sam
Back to top
 
 
IP Logged