# 5-7. Beta Distribution (\*)

{% embed url="<https://www.statisticshowto.datasciencecentral.com/beta-distribution/>" %}

{% embed url="<http://norman3.github.io/prml/docs/chapter02/1.html>" %}

## 1. What is a Beta Distribution?

A **Beta distribution** is a type of [probability distribution](https://www.statisticshowto.datasciencecentral.com/probability-distribution/). This distribution represents a family of probabilities and is a versatile way to represent *outcomes for percentages or proportions*.&#x20;

For example, how likely is it that Kanye West will win the next Presidential election? You might think the probability is 0.2. Your friend might think it’s 0.15. The beta distribution gives you a way to describe this.

One reason that this [function ](https://tinyurl.com/y29gm866)is confusing is there are three “Betas” to contend with, and they all have different meanings:

* $$Beta(α, β)$$ : the *name* of the probability distribution.
* $$B(α, β )$$ : the **name of a function** in the denominator of the pdf. This acts as a “normalizing constant” to ensure that the area under the curve of the pdf equals 1.
* $$β$$ : the name of the second [shape parameter](https://www.statisticshowto.datasciencecentral.com/shape-parameter/) in the pdf.

The **basic beta distribution** is also called the beta distribution of the first kind. Beta distribution of the second kind is another name for the **beta prime distribution**.

베타분포는 두 개의 모수 $$α$$ 와 $$β$$ 에 따라 $$\[0, 1]$$ 구간에서 다양한 분포형태를 갖는 분포로서, 베이지안 분석에서 어떤 사상의 발생확률 $$p$$ 의 사전분포로 많이 사용된다.&#x20;

**베타분포**의 확률밀도함수는 다음과 같은 형태를 갖는다.&#x20;

&#x20;                         $$f(x) = c x^{\alpha-1}(1-x)^{\beta-1},$$    $$0 \le x \le 1;$$ $$\alpha, \beta >0.$$&#x20;

위의 식이 확률분포를 만족하려면 0과 1 사이의 적분 값이 1이 되어야 하는데,  즉,

&#x20;                          $$\int *{0}^{1} f(x) dx = \int*{0}^{1} c x^{\alpha-1}(1-x)^{\beta-1} dx = 1$$ ,&#x20;

다음과 같이 정의된 베타함수를 사용하면 계수 $$c$$는 **베타함수**의 역수가 된다.&#x20;

&#x20;                           $$B(\alpha ,\beta ) \equiv \int\_{0}^{1}x^{\alpha -1}(1-x)^{\beta-1 }dx = \frac {\Gamma (\alpha )\Gamma (\beta )}{\Gamma (\alpha + \beta )}$$&#x20;

> 베타분포는 다음과 같은 **확률밀도함수**를 갖는 확률분포이다.
>
> &#x20;        $$f(x) = \frac{1}{B(\alpha ,\beta )} x^{\alpha-1}(1-x)^{\beta-1},$$    $$0 \le x \le 1;$$ $$\alpha, \beta >0.$$&#x20;

> 베타분포의 **기대값과 분산**은 다음과 같이 계산된다.
>
> &#x20;         $$E(X) = \frac {\alpha}{\alpha + \beta},$$        $$Var(X) = \frac { \alpha \beta } {(\alpha + \beta)^2 (\alpha + \beta+1) }$$ .

만약 $$\alpha = \beta =1$$ 이면,  $$f(x) =1$$ 이므로 uniform distribution이 된다. 그리고, $$E(X) = 1/2,$$ $$Var(X) = 1/12$$ 이 되는 것을 확인할 수 있다.

**EXAMPLE 35.**  $$(\alpha, \beta) = (0.5, 0.5), (5, 5), (2, 5), (5,2)$$ 인 베타분포의 확률밀도함수와 누적분포함수 그래프를 작성하시오.

{% tabs %}
{% tab title="R Source" %}

```
library(Rstat)

# Parameter
alp <- c(0.5, 5, 2, 5)
bet <- c(0.5, 5, 5, 2)

# location of parameter on the plot
x1 <- (alp - 1)/(alp + bet - 2)
x2 <- c(0.3, 0.7, 0.5, 0.5)

# cont.mpdf()
cont.mpdf("beta", 0, 1, para=alp, para2=bet, ymax=3, xp1=x1, xp2=x2)
```

{% endtab %}

{% tab title="Plot" %}
![](/files/-LtMfNJ2dPIHFju3ksfw)

* &#x20;shape parameter에 따라 다양한 분포형태가 나타남.
* $$\alpha = \beta$$ 이면 분포가 대칭형태, $$\alpha > \beta$$ 이면 분포가 우측으로 몰리고,  $$\alpha < \beta$$ 이면 분포가  좌측으로 몰림.
* $$\alpha, \beta >1$$ 이면 봉우리가 하나인 형태,  $$\alpha < 1$$이면 무한대에서 급격히 감소, $$\beta < 1$$ 이면 무한대로 증가.
* 누적분포함수는 형상모수 $$\alpha < \beta$$이면 가파르게 증가하고, $$\alpha > \beta$$이면 천천히 증가하다가 마지막에 가파르게 증가함.
* $$\alpha = \beta$$이면, $$F(0.5) = 0.5$$ 가 된다.
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kmis.gitbook.io/statistics/chapter-5.-continuous-random-variables/5-7.-beta-distribution.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
