**6.1 Bayesian estimation for parameter p for binomial distribution**

Suppose we have a sample that follows the Binomial distribution shown in the Eq. (40) and the appropriate prior distribution is the Beta distribution according to the following formula [13]:

$$\mathbf{f}(\mathbf{p}/\mathbf{a}, \mathbf{b}) = \frac{1}{\beta(\mathbf{a}, \beta)} \mathbf{p}^{\alpha - 1} (\mathbf{1} - \mathbf{p})^{\beta - 1}; \mathbf{0} < p < \mathbf{1} \tag{43}$$

To obtain the posterior distribution according to the Bayes rule as follows:

$$\mathbf{f}(\mathbf{p}/\mathbf{x}) = \frac{\mathbf{f}(\mathbf{x}\_1, \mathbf{x}\_2, \dots, \mathbf{x}\_n/\mathbf{p}) \mathbf{f}(\mathbf{p}/\mathbf{a}, \emptyset)}{\int \mathbf{f}(\mathbf{x}\_1, \mathbf{x}\_2, \dots, \mathbf{x}\_n/\mathbf{p}) \mathbf{f}(\mathbf{p}/\mathbf{a}, \emptyset) \mathbf{d}\mathbf{p}}$$

$$= \frac{\begin{pmatrix} \sum\_{i=1}^n \mathbf{x} \\ \sum\_{i=1}^n \mathbf{x} \end{pmatrix} \mathbf{p} \sum\_{i=1}^n (\mathbf{1} - \mathbf{p})^{\mathbf{n} - \sum\_{i=1}^n \mathbf{x}} \frac{1}{\mathbb{B}(\mathbf{a}, \emptyset)} \mathbf{p}^{\mathbf{a} - 1} (\mathbf{1} - \mathbf{p})^{\emptyset - 1} \\\\ \frac{1}{\mathbb{D}\left(\sum\_{i=1}^n \mathbf{x}\right)} \mathbf{p} \sum\_{i=1}^n (\mathbf{1} - \mathbf{p})^{\mathbf{n} - \sum\_{i=1}^n \mathbf{x}} \frac{1}{\mathbb{B}(\mathbf{a}, \emptyset)} \mathbf{p}^{\mathbf{a} - 1} (\mathbf{1} - \mathbf{p})^{\emptyset - 1} \mathbf{d} \mathbf{p} \end{pmatrix}}{= \frac{\mathbf{p} \sum\_{i=1}^n \mathbf{x} + \alpha - 1}{\int\_0^1 \mathbf{p} \sum\_{i=1}^n \mathbf{x} + \alpha - 1} (\mathbf{1} - \mathbf{p})^{\mathbf{n} - \sum\_{i=1}^n \mathbf{x} + \emptyset - 1} \mathbf{d} \mathbf{p}}$$

Since:

$$\sum\_{i=1}^{n} \mathbf{x} = \mathbf{s}$$

$$\mathbf{x} = \frac{\mathbf{1}}{\beta(\mathbf{a} + \mathbf{s}, \mathbf{n} + \beta - \mathbf{s})} \mathbf{p}^{\mathbf{a} + \mathbf{s} - 1} (\mathbf{1} - \mathbf{p})^{\mathbf{n} + \beta - \mathbf{s} - 1} \tag{44}$$

From Eq. (44) and by using the squared loss function we get a Bayes estimator for parameter (p) as follows:

$$\mathbf{E(p/s)} = \hat{\mathbf{p}}$$

$$\hat{\mathbf{p}} = \frac{\mathbf{a} + \mathbf{s}}{\mathbf{n} + \mathbf{a} + \mathbf{b}}\tag{45}$$
