Statistics
| Revision:

root / trunk / src / linad99 / vbeta.cpp @ 1610

History | View | Annotate | Download (499 Bytes)

1 417 arnima
/*
2
 * $Id$
3
 *
4
 * Author: David Fournier
5 1112 johnoel
 * Copyright (c) 2008-2012 Regents of the University of California
6 417 arnima
 */
7
/**
8
 * \file
9
 * Description not yet available.
10
 */
11
#include <fvar.hpp>
12
13
/**
14 1610 stevenmartell
 * 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 417 arnima
 */
21
dvariable beta(const prevariable& a,const prevariable& b )
22
{
23
  return exp(gammln(a)+gammln(b)-gammln(a+b));
24
}