Why is value of beta distribution outside of [0, 1]?

Question:

This doesn’t quite make sense to me. What I think the following code is doing is finding me the value of the beta distribution evaluated when p = 0.5 with alpha and beta equal to 10 each. Why is this value greater than 1?

I’ve implemented the function myself, seperate to this, using the relationship between the beta and gamma functions and I end up with roughly the same value.

>>> from scipy.stats import beta

>>> beta.pdf (0.5, 10, 10)

3.5239410400390625

Any advice would be appreciated.

There is obviously something lacking in my understanding – is this not actually the PDF?

Cheers.

Asked By: Owen

||

Answers:

see http://en.wikipedia.org/wiki/Beta_distribution

You are mistaking the PDF (Probability density function) and CDF (Cumulative distribution function)

CDF will be less than one at any point

Answered By: Joop

For aesthetic reasons you can do something like this:

fig, ax = plt.subplots(1, 1)
a, b = 1000,2
x = np.linspace(stats.beta.ppf(0.01, a, b),
        stats.beta.ppf(0.99, a, b),
        100
)
            
probs = [stats.beta.pdf(xi, a, b) for xi in x]               
ax.plot(x, probs/max(probs),
    '-', lw=1, alpha=0.6, label='beta pdf'
);

This plots the following:

Beta PDF

Answered By: Maximilian