root / trunk / src / linad99 / vbeta.cpp @ 1610
History  View  Annotate  Download (499 Bytes)
1 
/*


2 
* $Id: vbeta.cpp 1610 20140205 06:00:52Z stevenmartell $

3 
*

4 
* Author: David Fournier

5 
* Copyright (c) 20082012 Regents of the University of California

6 
*/

7 
/**

8 
* \file

9 
* Description not yet available.

10 
*/

11 
#include <fvar.hpp> 
12  
13 
/**

14 
* Beta density function

15 
* \param a shape parameter

16 
* \param b shape parameter

17 
*

18 
* Note that the mean of the distribution is given by

19 
* mu = a/(a+b), and the variance is ab/((a+b)^2 (a+b+1))

20 
*/

21 
dvariable beta(const prevariable& a,const prevariable& b ) 
22 
{ 
23 
return exp(gammln(a)+gammln(b)gammln(a+b));

24 
} 