knitr::opts_chunk$set(echo = TRUE) 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.
All of the Binomial Mixture and Alternate Binomial distributions in this package use this technique. This is very simple, by using the probability mass function we can develop the Likelihood function and then maximize it or develop the Negative Log Likelihood function and minimize it. Maximizing or minimizing means finding appropriate values for the parameters in question which will provide a most maximum Likelihood value or least minimum Negative Log Likelihood value.
If we have one parameter to estimate it is possible to use brute force technique. When the number of parameters need to be estimated increases this is very time consuming. Similarly, if the parameter in estimation has a very broad domain also it would be difficult.
In situations with difficulty of such we can use functions such as optim
,mle
, mle2
, nlm
, nlminb
.
fitODBOD
is using the mle2
function of the bbmle
package. There are situations where user defined functions without the help of mle2
.
bbmle
packageThese situations occurring are very less in comparing to the number of distributions we have in fitODBOD
.
They genuinely occur when the parameter in need of estimation has a closed domain and that domain is very small.
Here by small it is indicating a scenario of such as in-between zero and one or greater than zero.
# estimating parameter for p and alpha using Additive Binomial Distribution of Chromosome data
Chromosome_data
The distributions in relation are
There are two parameters to estimate, which are p and alpha. These parameters are unique values, therefore
estimating them once is enough. Time related to estimation is dependent on the data. The outputs are of class mlAB
and ml
, where the outputs can be extracted by the methods print
, summary
, coef
and AIC
.
# estimating parameter for p and alpha using Additive Binomial Distribution Est_para<-EstMLEAddBin(Chromosome_data$No.of.Asso,Chromosome_data$fre) cat("Estimated parameter p for Chromosome data=",Est_para$p, "\n") cat("Estimated parameter alpha for Chromosome data=",Est_para$alpha,"\n")
There is only one parameter that needs to be estimated, which is mode or c. This is in-between
zero and one. The outputs are of class mlTB
and ml
,
where the outputs can be extracted by the methods print
, summary
, coef
and AIC
.
# estimating parameter for mode using Triangular Binomial Distribution of Chromosome data Est_para<-EstMLETriBin(Chromosome_data$No.of.Asso,Chromosome_data$fre) cat("Estimated parameter mode or c for Chromosome data=",Est_para$mode, "\n")
bbmle
packageBy Using the vignette file or
manual pdf file we can get to know how the bbmle
package works. Specifically looking into mle2
function is necessary and also class of mle2
.
Notable points related are in point form as
It is preferable to try them and understand the functions capability and process. You can achieve proper results by looking at how the inputs should mentioned, because there is a specific format to follow.
Below are instances of using the mle2
function.
The distributions in relation are
Here there are three parameters to be estimated which are cov, a and b. It should be mentioned that cov is a unique value but alpha and beta can take specific combinations.
#estimating parameters for Beta-Correlated Binomial Distribution of Chromosome data Est_para<-EstMLEBetaCorrBin(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, cov=0.05,a=10,b=10) cat("Estimated parameter covariance for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter a for Chromosome data=",coef(Est_para)[2], "\n") cat("Estimated parameter b for Chromosome data=",coef(Est_para)[3], "\n")
Two parameters that needs to be estimated which are cov and p. They are unique values for the distribution.
#estimating parameters for Correlated Binomial Distribution of Chromosome data Est_para<-EstMLECorrBin(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, cov=0.0005,p=0.51) cat("Estimated parameter p for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter covariance for Chromosome data=",coef(Est_para)[2], "\n")
Two parameters that needs to be estimated which are p and cov. They are unique values for the distribution.
#estimating parameters for COM Poisson Binomial Distribution of Chromosome data Est_para<-EstMLECOMPBin(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, v=0.0005,p=0.51) cat("Estimated parameter p for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter covariance for Chromosome data=",coef(Est_para)[2], "\n")
Two parameters that needs to be estimated which are p and theta. Only p value is unique.
#estimating parameters for Multiplicative Binomial Distribution of Chromosome data Est_para<-EstMLEMultiBin(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, theta=15,p=0.51) cat("Estimated parameter p for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter theta for Chromosome data=",coef(Est_para)[2], "\n")
Two parameters that needs to be estimated which are p and phi. Only p value is unique.
#estimating parameters for Lovinson Multiplicative Binomial Distribution of Chromosome data Est_para<-EstMLELMBin(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, phi=15,p=0.51) cat("Estimated parameter p for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter phi for Chromosome data=",coef(Est_para)[2], "\n")
Two parameters to be estimated which are a and b. Together they have to represent a unique combination.
#estimating parameters for Beta-Binomial Distribution of Chromosome data Est_para<-EstMLEBetaBin(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, a=15,b=0.51) cat("Estimated parameter a for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter b for Chromosome data=",coef(Est_para)[2], "\n")
Two parameters to be estimated which are a and b. Together they have to represent a unique combination.
Here the number of iterations has to be estimated as well, which is time consuming. therefore I haven't estimated it.
#estimating parameters for Kumaraswamy Binomial Distribution of Chromosome data Est_para<-EstMLEKumBin(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, a=15,b=10,it=7500) cat("Estimated parameter a for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter b for Chromosome data=",coef(Est_para)[2], "\n") cat("Estimated parameter iteration for Chromosome data=",coef(Est_para)[3], "\n")
Three parameters to be estimated which are a,b and c. They have to represent a unique combination as a whole.
#estimating parameters for GHGBB Distribution of Chromosome data Est_para<-EstMLEGHGBB(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, a=15,b=10,c=20) cat("Estimated parameter a for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter b for Chromosome data=",coef(Est_para)[2], "\n") cat("Estimated parameter c for Chromosome data=",coef(Est_para)[3], "\n")
Three parameters to be estimated which are a,b and c. They have to represent a unique combination as a whole.
#estimating parameters for McGBB Distribution of Chromosome data Est_para<-EstMLEMcGBB(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, a=12,b=10,c=20) cat("Estimated parameter a for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter b for Chromosome data=",coef(Est_para)[2], "\n") cat("Estimated parameter c for Chromosome data=",coef(Est_para)[3], "\n")
Two parameters to be estimated which are a and b. Together they have to represent a unique combination.
#estimating parameters for Gamma Binomial Distribution of Chromosome data Est_para<-EstMLEGammaBin(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, c=15,l=0.51) cat("Estimated parameter c for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter l for Chromosome data=",coef(Est_para)[2], "\n")
Two parameters to be estimated which are a and b. Together they have to represent a unique combination.
#estimating parameters for Grassia II Binomial Distribution of Chromosome data Est_para<-EstMLEGrassiaIIBin(x=Chromosome_data$No.of.Asso,freq=Chromosome_data$fre, a=15,b=0.51) cat("Estimated parameter a for Chromosome data=",coef(Est_para)[1],"\n") cat("Estimated parameter b for Chromosome data=",coef(Est_para)[2], "\n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.