Title: | Estimation of Count Data Models |
---|---|
Description: | The maximum likelihood estimation (MLE) of the count data models along with standard error of the estimates and Akaike information model section criterion are provided. The functions allow to compute the MLE for the following distributions such as the Bell distribution, the Borel distribution, the Poisson distribution, zero inflated Bell distribution, zero inflated Bell Touchard distribution, zero inflated Poisson distribution, zero one inflated Bell distribution and zero one inflated Poisson distribution. Moreover, the probability mass function (PMF), distribution function (CDF), quantile function (QF) and random numbers generation of the Bell Touchard and zero inflated Bell Touchard distribution are also provided. |
Authors: | Muhammad Imran [aut, cre], M.H. Tahir [aut], Saima Shakoor [aut] |
Maintainer: | Muhammad Imran <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.0 |
Built: | 2024-11-16 03:18:23 UTC |
Source: | https://github.com/cran/countDM |
It gives the maximum likelihood estimates and the corresponding estimate's standard error. It also provides the Akaike information model section criterion. With the help of these functions, the MLE can be calculated for a variety of distributions, including the Borel distribution, the Poisson distribution, zero infated Bell distribution, zero inflated Bell Touchard distribution, zero inflated Poisson distribution, zero one inflated Bell distribution and zero one inflated Poisson distribution. Moreover, the probability mass function, distribution function, quantile function and random numbers generation of the Bell Touchard and zero inflated Bell Touchard distribution are also provided.
Package: | countDM |
Type: | Package |
Version: | 0.1.0 |
Date: | 2023-05-24 |
License: | GPL(>=2) |
Muhammad Imran [email protected]
Muhammad Imran <[email protected]>, M.H. Tahir <[email protected]> and Saima Shakoor <[email protected]>.
Evaluates the maximum likelihood estimate of the Bell distribtion. The PMF of the Bell distribution is as follows:
where denotes the Bell parameter and
is the Bell number and it is given by
The Bell number in the above equation is the nth moment of the Poisson distribution with parameter equal to 1.
bell_mle (x) mle.bell (x, theta)
bell_mle (x) mle.bell (x, theta)
x |
A vector of (non-negative integer) discrete values. |
theta |
A vector of (non-negative integer) values. |
The function allows to estimate the unknown parameter of the Bell distribution with loglik value using a Newton-Raphson algorithm.
bell_mle gives the maximum liklihood estimate of parameter theta. loglik gives value of the maximised log-likelihood. The mle.bell gives the maximum liklihood estimate with standard error and AIC,
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Castellares, F., Ferrari, S. L., & Lemonte, A. J. (2018). On the Bell distribution and its associated regression model for count data. Applied Mathematical Modelling, 56, 172-185.
x <- data_sbirth bell_mle (x) mle.bell (x, 1.2)
x <- data_sbirth bell_mle (x) mle.bell (x, 1.2)
Evaluates the PMF, CDF, QF, random generation and MLE based on the Bell Touchard distribution. The PMF of the Bell Touchard distribution is as follows:
where and
are the two parameters and
are the Touchard polynomials, it is given by
It is important to note that when the parameter , the Bell Touchard distribution reduces to Bell distribution.
dbellt (x, lambda, theta, log = FALSE) pbellt (q, lambda, theta, lower.tail = TRUE, log.p = FALSE) qbellt (p, lambda, theta, lower.tail = TRUE, log.p = FALSE) rbellt (n, lambda, theta) mle_bt (x, lambda, theta)
dbellt (x, lambda, theta, log = FALSE) pbellt (q, lambda, theta, lower.tail = TRUE, log.p = FALSE) qbellt (p, lambda, theta, lower.tail = TRUE, log.p = FALSE) rbellt (n, lambda, theta) mle_bt (x, lambda, theta)
x |
A vector of (non-negative integer) discrete values. |
lambda |
A vector of (non-negative integer) values, |
theta |
A vector of (non-negative integer) values, |
q |
A probablity or a vector of probablities. |
p |
A probablity or a vector of probablities. |
n |
A randomly generated values. |
lower.tail |
logical; if TRUE (default), probabilities will be P [X <= x], otherwise, P [X> x]. |
log |
logical; if TRUE, probabilities p are given as log(p). |
log.p |
logical; if TRUE, probabilities p are given as log(p). |
Recently Castellares et al. (2020) proposed a two parameter discrete Bell Touchard distribution that overcomes the issue of over-dispersion (variance larger than mean). Often, we experience the over-dispersed data in practice, where the Poisson model may not be suitable because its variance is restricted to be equal to mean. The PMF of the Bell Touchard distribution is simple and tractible in order to find probablities as well as several properties of the distribution.
dbellt gives the (log) probability function. pbellt gives the (log) distribution function. qbellt gives the quantile function. rbellt generates random values. mle_bt gives the maximum likelihood estimates with standard error of the estimates and model selection measure, the Akaike information criterion (AIC).
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Castellares, F., Lemonte, A. J., & Moreno–Arenas, G. (2020). On the two-parameter Bell–Touchard discrete distribution. Communications in Statistics-Theory and Methods, 49(19), 4834-4852.
Castellares, F., Ferrari, S. L., & Lemonte, A. J. (2018). On the Bell distribution and its associated regression model for count data. Applied Mathematical Modelling, 56, 172-185.
mle_borel, mle_poisson, bell_mle
x<-2 dbellt (x, 2, 2) pbellt (0.2, 2, 2) pbellt (0.2, 2, 2) rbellt (10, 2, 1) x <- data_sbirth mle_bt (x, 0.12, 0.2) # Plot of PMF of the Bell Touchard distribution for selected parameteric values. # The Bell Touchard distribution reduces to the Bell distribution for fixing theta=1. x <- 0:50 lambda <- 2 theta <- 1.5 plot(dbellt(x, lambda, theta), type = "h", col="red",lwd = 3, main = "Bell Touchard distribution", ylab = "P(X = x)", xlab = "Number of events") legend("topright",c(expression(lambda==2~~theta==1.5)),lty=1, col="red", lwd=2,cex=1.0)
x<-2 dbellt (x, 2, 2) pbellt (0.2, 2, 2) pbellt (0.2, 2, 2) rbellt (10, 2, 1) x <- data_sbirth mle_bt (x, 0.12, 0.2) # Plot of PMF of the Bell Touchard distribution for selected parameteric values. # The Bell Touchard distribution reduces to the Bell distribution for fixing theta=1. x <- 0:50 lambda <- 2 theta <- 1.5 plot(dbellt(x, lambda, theta), type = "h", col="red",lwd = 3, main = "Bell Touchard distribution", ylab = "P(X = x)", xlab = "Number of events") legend("topright",c(expression(lambda==2~~theta==1.5)),lty=1, col="red", lwd=2,cex=1.0)
Evaluates the MLE of the Borel distribution. It is defined by the following PMF:
where the parameter .
mle_borel (x, alpha)
mle_borel (x, alpha)
x |
A vector of (non-negative integer) discrete values. |
alpha |
A vector of (non-negative integer) values, |
The function allows to estimate the unknown parameter of the Borel distribution with standard error of the estimate and model selection measure, the Akaike information criterion (AIC).
mle_borel gives the MLE along with standard error of the estimate and model selction measure AIC.
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Tanner, J. C. (1961). A derivation of the Borel distribution. Biometrika, 48(1/2), 222-224.
x <- c(rep(1,48), rep(2,20), rep(3,7), rep(4,5),rep(5,2),rep(6,6)) mle_borel (x, 0.8)
x <- c(rep(1,48), rep(2,20), rep(3,7), rep(4,5),rep(5,2),rep(6,6)) mle_borel (x, 0.8)
The data set from crime sociology consisting a sample of 4301 people with deviating behavior.
data_criminal
data_criminal
data_criminal |
A vector of (non-negative integer) count values. |
The data set from crime sociology consisting a sample of 4301 people with deviating behavior. Recently, it is used by Zhang et al. (2016), fitted the zero one inflated Poisson distribution.
data_criminal gives the crime sociology consisting a sample of 4301 people with deviating behavior.
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Zhang, C., Tian, G. L., & Ng, K. W. (2016). Properties of the zero-and-one inflated Poisson distribution and likelihood-based inference methods. Statistics and its interface, 9(1), 11-32.
x <- data_criminal table (x)
x <- data_criminal table (x)
Evaluates the MLE of the Poisson distribtion. The PMF of the Poisson distribution is as follows:
where parameter and it is equal to the expected or mean value of X and also to its variance.
mle_poisson (x, theta)
mle_poisson (x, theta)
x |
A vector of (non-negative integer) discrete values. |
theta |
A vector of (non-negative integer) values, |
The function allows to estimate the unknown parameter of Poisson distribution with standard error of the estimate and model selection measure, the Akaike information criterion (AIC).
mle_poisson gives the MLE along with standard error of the estimate and model selection measure AIC.
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Frank A. Haight (1967). Handbook of the Poisson Distribution. New York: John Wiley & Sons.
x <- data_sbirth mle_poisson (x, 0.2)
x <- data_sbirth mle_poisson (x, 0.2)
The number of stillbirths of New Zealand white rabbits.
data_sbirth
data_sbirth
data_sbirth |
A vector of (non-negative integer) count values. |
The data set consists of frequencies of still births in 402 litters of New Zealand white rabbits, originally used by Morgan et al. (2007).
data_sbirth gives the frequencies of still births in 402 litters of New Zealand white rabbits.
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Morgan, B. T., Palmer, K. J., & Ridout, M. S. (2007). Negative score test statistic. The American Statistician, 61(4), 285-288.
Alshkaki, R. S. A. (2016). On the zero-one inflated Poisson distribution. Int J Stat Distrib Appl, 2(4), 42-8.
Pudprommarat, C. (2020, March). Zero-one inflated negative binomial-Sushila distribution and its application. In International Academic Multidisciplinary Research Conference in Rome 2020 (pp. 20-28).
x <- data_sbirth table (x)
x <- data_sbirth table (x)
The function allows to compuate the Touchard polynomial. It is mathematically defined by
The first few Touchard polynomials are as follows:
TP (x, theta)
TP (x, theta)
x |
A vector of (non-negative integer) discrete values. |
theta |
A vector of (non-negative integer) values. |
The function allows to provide the Touchard polynomials.
TP gives the Touchard polynomials after specifying parameteric value.
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Castellares, F., Lemonte, A. J., & Moreno–Arenas, G. (2020). On the two-parameter Bell–Touchard discrete distribution. Communications in Statistics-Theory and Methods, 49(19), 4834-4852.
TP (2,3)
TP (2,3)
Evaluates the MLE of the zero inflated Bell (ZIBELL) distribtion. The PMF of the ZIBELL distribution is as follows:
where ,
and
are the Bell numbers and it is given by
mle_zibell (x, alpha, lambda)
mle_zibell (x, alpha, lambda)
x |
A vector of (non-negative integer) values, discrete values. |
lambda |
A vector of (non-negative integer) values, |
alpha |
A vector of (non-negative integer) values, |
The function allows to estimate the unknown parameter of the ZIBELL distribution with standard error of the estimate and model selection measure, the Akaike information criterion (AIC).
mle_zibell gives the MLE along with standard error of the estimate and model selction measure AIC.
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Castellares, F., Ferrari, S. L., & Lemonte, A. J. (2018). On the Bell distribution and its associated regression model for count data. Applied Mathematical Modelling, 56, 172-185.
x <- data_sbirth mle_zibell (x, 0.2, 1.5)
x <- data_sbirth mle_zibell (x, 0.2, 1.5)
Evaluates the maximum likelihood estimate of the zero inflated Bell Touchard (ZIBELLT) distribtion. The PMF of the ZIBELLT distribution is as follows:
where ,
and
are the Touchard polynomials, it is given by
It is important to note that when the parameter , the ZIBELLT distribution reduces to ZIBELL distribution. On the other side, when the parameter
and pi=0, the ZIBELLT distribution reduces to BELL distribution. So therefore, we can evaluate the PMF, CDF, QF and random numbers of the Bell and ZIBELL distribution by using the following functions.
dzibellt (x, lambda, theta, pi, log = FALSE) pzibellt (q, lambda, theta, pi, lower.tail = TRUE, log.p = FALSE) qzibellt (p, lambda, theta, pi, lower.tail = TRUE, log.p = FALSE) rzibellt (n, lambda, theta, pi) mle_zibellt (x, lambda, theta, pi)
dzibellt (x, lambda, theta, pi, log = FALSE) pzibellt (q, lambda, theta, pi, lower.tail = TRUE, log.p = FALSE) qzibellt (p, lambda, theta, pi, lower.tail = TRUE, log.p = FALSE) rzibellt (n, lambda, theta, pi) mle_zibellt (x, lambda, theta, pi)
x |
A vector of (non-negative integer) discrete values. |
lambda |
A vector of (non-negative integer) values, |
theta |
A vector of (non-negative integer) values, |
n |
The number of random values generated under zero inflated Bell Touchard distribution. |
pi |
A vector of (non-negative integer) values, |
q |
A vector of (non-negative integer) probablities. |
p |
A vector of (non-negative integer) probablities. |
lower.tail |
logical; if TRUE (default), probabilities will be P [X <= x], otherwise, P [X> x]. |
log |
logical; if TRUE, probabilities p are given as log(p). |
log.p |
logical; if TRUE, probabilities p are given as log(p). |
Recently Castellares et al. (2020) proposed a two parameter discrete Bell Touchard distribution that overcomes the issue of over-dispersion (variance larger than mean). Often, we experience the over-dispersed data in practice, where the Poisson model may not be suitable because its variance is restricted to be equal to mean. The PMF of the Bell Touchard distribution is simple and tractible in order to find probablities as well as several properties of the distribution. We extend it to the ZIBELLT distribution and evaluated by the following functions.
dzibellt gives the (log) probability function. pzibellt gives the (log) distribution function. qzibellt gives the quantile function. rzibellt generates random values. mle_zibell gives the maximum likelihood estimates with standard error of the estimates and model selection measure, the Akaike information criterion (AIC).
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Castellares, F., Lemonte, A. J., & Moreno–Arenas, G. (2020). On the two-parameter Bell–Touchard discrete distribution. Communications in Statistics-Theory and Methods, 49(19), 4834-4852.
Castellares, F., Ferrari, S. L., & Lemonte, A. J. (2018). On the Bell distribution and its associated regression model for count data. Applied Mathematical Modelling, 56, 172-185.
dzibellt (2, 0.12, 0.2,0.2) x <- data_sbirth mle_zibellt (x, 0.15,1.8,1.05) # Plot of PMF of the ZIBELLT distribution for selected parameteric values. # The ZIBELLT distribution reduces to the ZIBELL distribution for fixing theta=1. x <- 0:30 lambda <- 1.2 theta <- 1.2 pi <- 0.01 plot(dzibellt(x, lambda, theta, pi), type = "h", col="red",lwd = 3, main = "Zero inflated Bell Touchard distribution", ylab = "P(X = x)", xlab = "Number of events") legend("topright",c(expression(lambda==2~~theta==1.5~~pi==0.01)), lty=1, col="red", lwd=2,cex=1.0)
dzibellt (2, 0.12, 0.2,0.2) x <- data_sbirth mle_zibellt (x, 0.15,1.8,1.05) # Plot of PMF of the ZIBELLT distribution for selected parameteric values. # The ZIBELLT distribution reduces to the ZIBELL distribution for fixing theta=1. x <- 0:30 lambda <- 1.2 theta <- 1.2 pi <- 0.01 plot(dzibellt(x, lambda, theta, pi), type = "h", col="red",lwd = 3, main = "Zero inflated Bell Touchard distribution", ylab = "P(X = x)", xlab = "Number of events") legend("topright",c(expression(lambda==2~~theta==1.5~~pi==0.01)), lty=1, col="red", lwd=2,cex=1.0)
Evaluates the MLE of the zero inflated Poisson (ZIP) distribtion. The PMF of the ZIP is as follows:
where denotes the probability of extra zeros and
is a Poisson parameter, which is also its mean and variance.
mle_zip (x, alpha, theta)
mle_zip (x, alpha, theta)
x |
A vector of (non-negative integer) discrete values. |
theta |
A vector of (non-negative integer) values, |
alpha |
A vector of (non-negative integer) values, |
The function allows to estimate the unknown parameter of the ZIP distribution with standard error of the estimate and model selection measure, the Akaike information criterion (AIC).
mle_zip gives the MLE along with standard error of the estimate and model selction measure AIC.
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Beckett, S., Jee, J., Ncube, T., Pompilus, S., Washington, Q., Singh, A., & Pal, N. (2014). Zero-inflated Poisson (ZIP) distribution: Parameter estimation and applications to model data from natural calamities. Involve, a Journal of Mathematics, 7(6), 751-767.
x <- data_sbirth mle_zip (x, 0.2, 1.5)
x <- data_sbirth mle_zip (x, 0.2, 1.5)
Evaluates the MLE of the zero one inflated Bell (ZOIBELL)distribtion.
where , the two parameters
and
, respectively, denotes the unknown proportion for incorporating extra zeros and extra ones than those allowed by the traditional Bell distribution.
mle_zoibell (x, alpha, beta, theta)
mle_zoibell (x, alpha, beta, theta)
x |
A vector of (non-negative integer) values, discrete values. |
theta |
A vector of (non-negative integer) values, |
alpha |
A vector of (non-negative integer) values, |
beta |
A vector of (non-negative integer) values, |
Inflated models have become quite popular in the recent applied statistical literature. In many scientific studies, we often experience situations, the data consists of a large proportion of zeros and ones. Castellares et al. proposed a single-parameter discrete Bell distribution. We extended the Bell distribution into zero one inflated Bell distribution.
mle_zoibell gives the MLE along with standard error of the estimate and model selction measure AIC.
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Castellares, F., Ferrari, S. L., & Lemonte, A. J. (2018). On the Bell distribution and its associated regression model for count data. Applied Mathematical Modelling, 56, 172-185.
x <- data_sbirth mle_zoibell (x, 0.1,0.2,0.2)
x <- data_sbirth mle_zoibell (x, 0.1,0.2,0.2)
Evaluates the MLE of the zero one inflated Poisson (ZOIP)distribtion.
where , the two parameters
and
, respectively denotes the unknown proportion for incorporating extra zeros and extra ones than those allowed by the traditional Poisson distribution.
mle_zoip (x, alpha, beta, theta)
mle_zoip (x, alpha, beta, theta)
x |
A vector of (non-negative integer) values, discrete values. |
alpha |
A vector of (non-negative integer) values, |
beta |
A vector of (non-negative integer) values, |
theta |
A vector of (non-negative integer) values, |
The function allows to estimate the unknown parameter of the ZOIP distribution with standard error of the estimate and model selection measure, the Akaike information criterion (AIC).
mle_zoip gives the MLE along with standard error of the estimate and model selction measure AIC.
Muhammad Imran and M.H. Tahir.
R implementation and documentation: Muhammad Imran [email protected] and M.H. Tahir <[email protected]>.
Zhang, C., Tian, G. L., & Ng, K. W. (2016). Properties of the zero-and-one inflated Poisson distribution and likelihood-based inference methods. Statistics and its interface, 9(1), 11-32.
Tang, Y., Liu, W., & Xu, A. (2017). Statistical inference for zero-and-one-inflated Poisson models. Statistical Theory and Related Fields, 1(2), 216-226.
Alshkaki, R. S. A. (2016). On the zero-one inflated Poisson distribution. Int J Stat Distrib Appl, 2(4), 42-8.
x <- data_sbirth mle_zoip (x, 0.2,0.1, 0.5)
x <- data_sbirth mle_zoip (x, 0.2,0.1, 0.5)