How to estimate the parameters of Beta distribution from an empirical graph?

Suppose I have some empirical data which I plot and I believe it be a Beta distribution, how can I make sure that I have a Beta distribution, and how can I estimate the alpha and beta parameters of that distribution? I know there's a function in Scipy that can do that scipy.beta.fit() but I'm looking for a bit more than that, can we for example do gradient descent?

• Do you have the observations, or only some graph? Which? Commented Sep 11, 2022 at 0:53
• I have the data, from which I can plot a graph Commented Sep 11, 2022 at 1:37
• Perhaps first consider whether you can more readily do it from the data. Commented Sep 11, 2022 at 12:47

You have a sample and want to determine if it belongs to a parametric family of distributions and estimate its parameters if it does.

Let’s first suppose that it does and deal with estimating parameters:

Bad news: we can not use exact maximum likelihood estimation here: dependence of the Beta distribution PDF on parameters is not nice and therefore MLE can not be expressed in closed form and can only be approximated numerically.

However, there is another classical approach that works well with this distribution family: the method of moments.

Let’s note, that if $$X \sim B(\alpha, \beta)$$ then $$E[X] = \frac{\alpha}{\alpha + \beta}$$

and

$$Var[X] = \frac{\alpha \beta}{(\alpha + \beta)(\alpha + \beta + 1)}$$

That means

$$\begin{cases}\beta = \frac{\alpha (1 - E[X])}{E[X]} \\ Var[X] = \frac{(1 - E[X]) E[X]^2}{\alpha + E[X]}\end{cases}$$

$$\begin{cases}\alpha = E[X](\frac{E[X](1 - E[X])}{Var[X]} - 1) \\ \beta =(1 - E[X])(\frac{E[X](1 - E[X])}{Var[X]} - 1) \end{cases}$$

If you replace theoretical moments with empirical ones here you will get method of moments estimators for your parameters. And because the parameters are expressed as a continuous function of moments, this estimator will be consistent.

Now, you can check whether the distribution is Beta in the following way:

1)Find consistent estimators of parameters (for example, using the aforementioned method of moments), supposing that the distribution is Beta. 2)Perform a one-sample goodness of fit test (for example, Kolmogorov-Smirnov, Cramer-von Mieses or Anderson-Darling) of your sample against the Beta distribution with parameters found on the previous step