/
BMDs_and_ABDs_NegLLxxxBin.Rmd
63 lines (52 loc) · 2.1 KB
/
BMDs_and_ABDs_NegLLxxxBin.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: "Negative Log Likelihood values of BMD and ABD"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Negative Log Likelihood values of BMD and ABD}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, comment = "|>")
library(fitODBOD)
library(ggplot2)
library(reshape2)
library(grid)
library(gridExtra)
library(bbmle)
```
>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.
## Calculating Negative Log Likelihood values
All Binomial Mixture distributions and Alternate Binomial distributions have Negative Log Likelihood functions.
Negative Log Likelihood value equations have been converted into functions. Using the Negative Log Likelihood values
we can find the AIC(Akaike Information criteria), which is useful to compare fitted distributions for the
same data-set.
It should be noted that the Negative Log Likelihood function for Uniform Binomial distribution is not
considered, because it provides less variety of shape for Binomial Outcome data.
The functions are given below
* Alternate Binomial Distribution
1. NegLLAddBin
2. NegLLBetaCorrBin
3. NegLLCOMPBin
4. NegLLCorrBin
5. NegLLMultiBin
6. NegLLLMBin
* Binomial Mixture Distribution
1. NegLLTriBin
2. NegLLBetaBin
3. NegLLKumBin
4. NegLLGHGBB
5. NegLLMcGBB
6. NegLLGammaBin
7. NegLLGrassiaIIBin
Below is an example of finding the Negative Log Likelihood value for Beta-Binomial distribution
of Male_children data. Before that, I am going to estimate the parameters which minimize the
Negative Log Likelihood value.
```{r Estimating parameters and printing Negative Log Likelihood value, echo=FALSE}
Est_para<-EstMLEBetaBin(x=Male_Children$No_of_Males,freq=Male_Children$freq,
a=10,b=10)
Negllvalue<-NegLLBetaBin(Male_Children$No_of_Males,Male_Children$freq,
coef(Est_para)[1],coef(Est_para)[2])
cat("Minimized Negative Log Likelihood value for Male_children data =",Negllvalue)
```