IT WOULD BE CLEARLY BENEFICIAL FOR YOU BY USING THE RMD FILES IN THE GITHUB DIRECTORY FOR FURTHER EXPLANATION OR UNDERSTANDING OF THE R CODE FOR THE RESULTS OBTAINED IN THE VIGNETTES.

Estimating the parameters using Moment Generating Function

In the eleven Binomial Mixture and Alternate Binomial Distributions only Beta-Binomial Distribution is related to this technique. Moment Generating function only exists to Beta-Binomial Distribution.

Let \(Y=[Y_1,Y_2,...,Y_N]^T\) be a random sample of size \(N\) from Beta-Binomial distribution with the probability mass function. \(n\) is fixed for all clusters. Therefore, shape parameters \(\alpha\)(a) and \(\beta\)(b) are estimated using the below equations as \(\hat{\alpha}\) and \(\hat{\beta}\).

\[\hat{\alpha}= \frac{(n*m_1 -m_2)m_1}{n(m_2-m_1-{m_1}^2)+{m_1}^2} \]

\[\hat{\beta}= \frac{(n*m_1-m_2)(n-m_1)}{n(m_2-m_1-{m_1}^2)+{m_1}^2} \]
where \(m_1=\sum_{i=1}^{N} \frac{y_i}{N}\) and \(m_2= \sum_{i=1}^{N} \frac{{Y_i}^2}{N}\) are the first two sample moments.

These equations produce unique values for \(\alpha\) (a) and \(\beta\) (b).

Below is the code for estimating shape parameters using this technique and function used for this is EstMGFBetaBin.

Using the Chromosome data provided in the package.

This EstMGFBetaBin function is of output of class mgf, where outputs include estimated a ,b parameters, minimized Negative Log Likelihood value min, Akaike Information Criterion (AIC) and function call with input arguments.

##   No.of.Asso fre
## 1          0  32
## 2          1 103
## 3          2 122
## 4          3  80
## Estimated alpha parameter for Chromosome data = 6.167982
## Estimated beta parameter for Chromosome data = 4.455237

Using the Male Children data provided in the package

##    No_of_Males freq
## 1            0    3
## 2            1   24
## 3            2  104
## 4            3  286
## 5            4  670
## 6            5 1033
## 7            6 1343
## 8            7 1112
## 9            8  829
## 10           9  478
## 11          10  181
## 12          11   45
## 13          12    7
## Estimated alpha parameter Male_children data= 34.13502
## Estimated beta parameter Male_children data= 31.60849

Further, we can use the above estimated parameters in the fitBetaBin function and check how good the Beta-Binomial Distribution is fitted for a given Binomial outcome data.