# How to proper evaluate the PDF of a Beta Distribution?

On page 40 of "Think Bayes - Bayesian Statistics Made Simple", Allen evaluates the PDF of the Beta distribution as

def EvalPdf(self, x):
return x**(self.alpha-1) * (1-x)**(self.beta-1)


I understand the formula used but I'm trying to better understand the 1 subtracted from the alpha and beta parameters.

Allen defined the prior as B(1,1) so I'm assuming the -1 refers to the definition of the prior, but why is it necessary to exclude that? Since we're evaluating the PDF, shouldn't we use the posterior as it is (with the 1's from the prior included)?

• Does this part of the wikipedia page help you? It does not shine a light on why there's a $-1$ in the exponent, but the basic idea is that the pdf is given by the function you post, up to a normalization constant (so that $\int f = 1$). My interpretation is that the $-1$s are not related to the prior in any way. – Roland May 25 '16 at 5:41

The -1 is a result of the usual parameterization of the beta distribution, which in turn is because of the presence of of -1 in the powers of the beta function:

$$B(x,y) = \int_0^1t^{x-1}(1-t)^{y-1}\,\mathrm{d}t\;,\: x,y>0$$

Note that there's also a power -1 in the definition of the (related) gamma function:

$$\Gamma(t) = \int_0^\infty x^{t-1} e^{-x}\,dx\;$$

The -1 there is a matter of convention but I presume it was chosen for convenience in some problem for which this would be a natural way to do it. The section on integration problems on the Wikipedia page for the gamma function suggests that this might indeed be why; note that at that link we have:

$\int_0^\infty t^b e^{-at} \,dt = \frac{\Gamma(b+1)}{a^{b+1}}$

and the presence of $b+1$ in the denominator may have been the reason to define the power in the integral in the gamma function one smaller, leaving both terms on the right without +1s.

It may well be that the use of -1 in these definitions dates right back to Euler (whose work on the functions predates the names we give them now); certainly the -1s were clearly in place not long after.

If I locate which of Euler's works they were in I'll try to pin down whether he did use the -1.

Edit: Well documents like the one linked here - suggest that he was using powers -1 routinely and looking across which cases the -1s tended to crop up in (such as including it in numerator terms but not in denominator terms), it may well have been for the kind of convenience suggested above. There's some discussion of the history of Euler's work with the Gamma function by Ed Sandifer here but it doesn't seem to enlighten the discussion further.

• There is no mystery about the parameterization when you write the Gamma function using the natural measure, as I explained at stats.stackexchange.com/a/185709/919. The set $\mathbb{R}^{+}$ of positive reals is a group under multiplication with invariant measure $d\mu(x)=dx/x$ and $$\Gamma(t)=\int_{\mathbb{R}^{+}}x^t e^{-x} d\mu(x).$$ Regardless, notice that the standard parameterization of the Beta distribution makes the lower bounds of its parameters $0$ rather than $-1$. That helps us remember that the PDF has finite integral even when its value becomes infinite (at $0$ or $1$). – whuber May 25 '16 at 13:39
• @whuber thanks; indeed, I had intended to mention the second issue - the lower bounds on the parameters in the beta and gamma - but then left it out. – Glen_b May 25 '16 at 16:19