## Maximum likelihood estimate for general discrete and continuous distributions

### Description

calculate the Maximum likelihood estimate and the corresponding negative log likelihood value for general Poisson, geometric, negative binomial, negative binomial1, beta binomial, beta binomial1, beta negative binomial, beta negative binomial1, normal, half normal, log normal, and exponential distributions.

### Usage

new.mle(x,r,p,alpha1,alpha2,n,lambda,mean,sigma,dist,lowerbound=0.01,upperbound=10000)


### Arguments

 x A vector of count data which should non-negative integers for discrete cases. Real valued random generation for continuous cases. r An initial value for the number of success before which m failures are observed, where m is the element of x. Must be a positive number, but not required to be an integer. p An initial value for the probability of success, should be a positive value within (0,1). alpha1 An initial value for the first shape parameter of beta distribution. Should be a positive number. alpha2 An initial value for the second shape parameter of beta distribution. Should be a positive number. n An initial value for the number of trials. Must be a positive number, but not required to be an integer. lambda An initial value for the rate. Must be a positive real number. mean An initial value of the mean or expectation. A real number sigma An initial value of the standard deviation. Must be a positive real number. dist The distribution used to calculate the maximum likelihood estimate. Can be one of 'poisson', 'geometric', 'nb', 'nb1', 'bb', 'bb1', 'bnb', 'bnb1', 'normal', 'halfnormal', 'lognormal', 'exponential', which corresponds to Poisson geometric, negative binomial, negative binomial1, beta binomial, beta binomial1, beta negative binomial, beta negative binomial1, normal, half normal, log normal, and exponential distributions. lowerbound A lower searching bound used in the optimization of likelihood function. Should be a small positive number. The default is 1e-2. upperbound An upper searching bound used in the optimization of likelihood function. Should be a large positive number. The default is 1e4.

### Details

new.mle calculate Maximum likelihood estimate and corresponding negative log likelihood of general Poisson, geometric, negative binomial, negative binomial1, beta binomial, beta binomial1, beta negative binomial, beta negative binomial1, normal, half normal, log normal, and exponential distributions.

### Value

A row vector containing the maximum likelihood estimate of the unknown parameters and the corresponding value of negative log likelihood.

If dist = poisson, the following values are returned:

• lambda: the maximum likelihood estimate of \lambda.

• loglik: the value of negative log likelihood with maximum likelihood estimate plugged-in.

If dist = geometric, the following values are returned:

• p: the maximum likelihood estimate of p.

• loglik: the value of negative log likelihood with maximum likelihood estimate plugged-in.

If dist = nb, the following values are returned:

• r: the maximum likelihood estimate of r.

• p: the maximum likelihood estimate of p.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

If dist = nb1, the following values are returned:

• r: the maximum likelihood estimate of rounded r (returns integer estimate).

• p: the maximum likelihood estimate of p.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

If dist = bb, the following values are returned:

• n: the maximum likelihood estimate of n.

• alpha1: the maximum likelihood estimate of \alpha_1.

• alpha2: the maximum likelihood estimate of \alpha_2.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

If dist = bb1, the following values are returned:

• n: the maximum likelihood estimate of rounded n (returns integer estimate).

• alpha1: the maximum likelihood estimate of \alpha_1.

• alpha2: the maximum likelihood estimate of \alpha_2.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

If dist = bnb, the following values are returned:

• r: the maximum likelihood estimate of r.

• a lpha1: the maximum likelihood estimate of \alpha_1.

• alpha2: the maximum likelihood estimate of \alpha_2.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

If dist = bnb1, the following values are returned:

• r: the maximum likelihood estimate of rounded r (returns integer estimate).

• alpha1: the maximum likelihood estimate of \alpha_1.

• alpha2: the maximum likelihood estimate of \alpha_2.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

If dist = normal, the following values are returned:

• mean: the maximum likelihood estimate of \mu.

• sigma: the maximum likelihood estimate of \sigma.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

If dist = lognormal, the following values are returned:

• mean: the maximum likelihood estimate of \mu.

• sigma: the maximum likelihood estimate of \sigma.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

If dist = halfnormal, the following values are returned:

• sigma: the maximum likelihood estimate of \sigma.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

If dist = exponential, the following values are returned:

• lambda: the maximum likelihood estimate of \lambda.

• loglik: the value of negative log likelihood with maximum likelihood estimates plugged-in.

### References

• H. Aldirawi, J. Yang, A. A. Metwally (2019). Identifying Appropriate Probabilistic Models for Sparse Discrete Omics Data, accepted for publication in 2019 IEEE EMBS International Conference on Biomedical & Health Informatics (BHI).

### Examples

set.seed(001)
x1=stats::rpois(1000,lambda=10)
new.mle(x1,lambda=3,dist="poisson")                         #9.776 -2611.242
x2=stats::rgeom(1000,prob=0.2)
new.mle(x2,p=0.5,dist="geometric")                          #0.1963865 -2522.333
x3=stats::rnbinom(1000,size=5,prob=0.3)
new.mle(x3,r=2,p=0.6,dist="nb")                             #5.113298 0.3004412 -3186.163
new.mle(x3,r=2,p=0.6,dist="nb1")                            #5 0.299904 -3202.223
new.mle(x4,n=10,alpha1=3,alpha2=4,dist="bb")                #3.99 1.78774 2.680009 -1533.982
new.mle(x4,n=10,alpha1=3,alpha2=4,dist="bb1")               #4 1.800849 2.711264 -1534.314