Description Usage Arguments Details Value Reference Examples
Calculate maximum likelihood estimate and the corresponding log likelihood value for zero-inflated or hurdle beta binomial, beta negative binomial, negative binomial and Poisson distributions.
1 2 3 4 5 6 7 8 9 10 11 | bb.zihmle(x, n, alpha1, alpha2, type = c("zi", "h"), lowerbound = 0.01,
upperbound = 10000)
bnb.zihmle(x, r, alpha1, alpha2, type = c("zi", "h"),
lowerbound = 0.01, upperbound = 10000)
nb.zihmle(x, r, p, type = c("zi", "h"), lowerbound = 0.01,
upperbound = 10000)
poisson.zihmle(x, type = c("zi", "h"), lowerbound = 0.01,
upperbound = 10000)
|
x |
A vector of count data. Should be non-negative integers. |
n |
An initial value of the number of trials. Must be a positive number, but not required to be an integer. |
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. |
type |
The type of distribution used to calculate the sample estimate, where 'zi' and 'h' stand for zero-inflated and hurdle distributions respectively. |
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. |
r |
An initial value of 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 of the probability of success, should be a positive value within (0,1). |
By setting type='zi'
, bb.zihmle
, bnb.zihmle
, nb.zihmle
and poisson.zihmle
calculate the
maximum likelihood estimate of zero-inflated beta binomial, beta negative binomial, negative binomial and Poisson
distributions, respectively.
By setting type='h'
, bb.zihmle
, bnb.zihmle
, nb.zihmle
and poisson.zihmle
calculate the
maximum likelihood estimate of hurdle beta binomial, beta negative binomial, negative binomial and Poisson
distributions, respectively.
Please NOTE that the arguments in the four functions are NOT CHECKED AT ALL! The user must be aware of their inputs to avoid getting suspicious results.
For zero-inflated models, zeros occurred by either sampling process or specific structure of data with the structural parameter 0<φ<1. The density function for a zero-inflated model is
P_{zi}(X=k)=φ 1_{k=0}+(1-φ)P(X=k),
where P(X=k) is the probability under standard distributions.
Aldirawi et al. (2019) proposed an estimating procedure for zero-inflated models by optimizing over a reparametrization of the likelihood function where φ and the rest unknown parameters are separable. When X comes from a zero-inflated distribution, the maximum likelihood estimate of parameters except for φ are obtained by minimizing the truncated version of negative log likelihood function. However, in the zero-deflated case, φ=0 and the sample estimate of other parameters are identical to those for its corresponding standard distributions. Meanwhile, an warning message is shown on the screen such that 'cannot obtain mle with the current model type, the output estimate is derived from general ... distribution'.
For hurdle models, all zeros occurred purely by the structure of data with the structural parameter 0<φ<1. The density function for a hurdle model is
P_{h}(X=k)=φ 1_{k=0}+(1-φ)P_{tr}(X=k),
where P_{tr}(X=k) is the truncated probability under standard distributions, where P_{tr}(X=0)=0 and P_{tr}(X=k)=P(X=k)/(1-P(X=0)). Since φ and other unknown parameters are separable in the joint likelihood function, φ can be estimated by a value with respect to the number of positive samples. The sample estimate of other parameters can be obtained by the same procedure for zero-inflated model.
A warning message may also occur when the algorithm of optim
does not converge and the resulting estimates are not
valid. In this case, the results from the corresponding general distribution are output instead.
A row vector containing the maximum likelihood estimate of unknown parameters and the corresponding value of log likelihood.
With bb.zihmle
, the following values are returned:
n: the maximum likelihood estimate of n.
alpha1: the maximum likelihood estimate of alpha1.
alpha2: the maximum likelihood estimate of alpha2.
phi: the maximum likelihood estimate of φ.
loglik: the value of log likelihood with maximum likelihood estimates plugged-in.
With bnb.zihmle
, the following values are returned:
r: the maximum likelihood estimate of r.
alpha1: the maximum likelihood estimate of alpha1.
alpha2: the maximum likelihood estimate of alpha2.
phi: the maximum likelihood estimate of φ.
loglik: the value of log likelihood with maximum likelihood estimates plugged-in.
With nb.zihmle
, the following values are returned:
r: the maximum likelihood estimate of r.
p: the maximum likelihood estimate of p.
phi: the maximum likelihood estimate of φ.
loglik: the value of log likelihood with maximum likelihood estimates plugged-in.
With poisson.zihmle
, the following values are returned:
lambda: the maximum likelihood estimate of lambda.
phi: the maximum likelihood estimate of φ.
loglik: the value of log likelihood with maximum likelihood estimate plugged-in.
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).
H. Aldirawi, J. Yang (2019). Model Selection and Regression Analysis for Zero-altered or Zero-inflated Data, Statistical Laboratory Technical Report, no.2019-01, University of Illinois at Chicago.
1 2 3 4 5 6 7 8 9 | t1=sample.h(N=2000,phi=0.2,distri='Poisson',lambda=5) ##hurdle poisson random values
t2=sample.h(N=2000,phi=0.2,distri='nb',r=10,p=0.6) ##hurdle negative binomial
t3=sample.zi(N=2000,phi=0.2,distri='bb',alpha1=8,alpha2=9,n=10) ##zero-inflated beta binomial
##zero-inflated beta negative binomial.
t4=sample.zi(N=2000,phi=0.2,distri='bnb',r=10,alpha1=8,alpha2=9)
bb.zihmle(t3,3,1,1,type='h')
bnb.zihmle(t4, 3.3, 1, 1,type='h')
nb.zihmle(t2, 7, 0.5,type='zi')
poisson.zihmle(t1,type='zi')
|
n alpha1 alpha2 phi loglik
[1,] 9.99 1.186407 2.04323 0 10381.39
Warning message:
In bb.zihmle(t3, 3, 1, 1, type = "h") :
cannot obtain mle with the current model type, the output estimate is derived from general beta binomial distribution.
r alpha1 alpha2 phi loglik
[1,] 10000 10000 0.01 0.2065 413077713
r p phi loglik
[1,] 9.967746 0.5962024 0.1923397 -5116.386
lambda phi loglik
[1,] 5.005268 0.2006423 -4466.521
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.