MLE of count data (univariate discrete distributions) {MLE} | R Documentation |
MLE of count data
Description
MLE of count data.
Usage
disc.mle(x, distr = "poisson", N = NULL, type = 1, tol = 1e-07)
Arguments
x |
A vector with discrete valued data. |
distr |
The distribution to fit, "poisson" stands for the Poisson, "zip" for the zero-inflated Poisson, "ztp" for the zero-truncated Poisson, "negbin" for the negative binomial, "binom" for the binomial, "borel" for the Borel distribution, "geom" for the geometric, "logseries" for the log-series distribution, "betageom" for the beta-geometric, "betabinom" for the beta-binomial distribution and "skellam" for the Skellam distribution, "gp" for the generalised Poisson distribution and "gammapois" for the gamma-Poisson distribution. |
type |
This argument is for the negative binomial and the geometric distribution. In the negative binomial you can choose which way your prefer. Type 1 is for smal sample sizes, whereas type 2 is for larger ones as is faster. For the geometric it is related to its two forms. Type 1 refers to the case where the minimum is zero and type 2 for the case of the minimum being 1. |
N |
This is for the binomial distribution only, specifying the total number of successes. If NULL, it is sestimated by the data. It can also be a vector of successes. |
tol |
The tolerance level up to which the maximisation stops set to 1e-07 by default. |
Details
Instead of maximising the log-likelihood via a numerical optimiser we used a Newton-Raphson algorithm which is faster.
See wikipedia for the equation to be solved in the case of the zero inflated distribution. https://en.wikipedia.org/wiki/Zero-inflated_model.
In order to avoid negative values we have used link functions, log for the lambda
and logit for the \pi
as suggested by Lambert (1992).
As for the zero truncated Poisson see https://en.wikipedia.org/wiki/Zero-truncated_Poisson_distribution.
Value
The following list is not inclusive of all cases. Different functions have different names. In general a list including:
mess |
This is for the negbin.mle only. If there is no reason to use the negative binomial distribution a message will appear, otherwise this is NULL. |
iters |
The number of iterations required for the Newton-Raphson to converge. |
loglik |
The value of the maximised log-likelihood. |
prob |
The probability parameter of the distribution. In some distributions this argument might have a different name. For example, param in the zero inflated Poisson. |
Author(s)
Michail Tsagris and Sofia Piperaki.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr and Sofia Piperaki sofiapip23@gmail.com.
References
Lambert D. (1992). Zero-Inflated Poisson Regression, with an Application to Defects in Manufacturing. Technometrics. 34 (1): 1–14
Johnson N. L., Kotz S. and Kemp A. W. (1992). Univariate Discrete Distributions (2nd ed.). Wiley.
Skellam J. G. (1946) The frequency distribution of the difference between two Poisson variates belonging to different populations. Journal of the Royal Statistical Society, series A 109/3, 26.
Nikoloulopoulos A.K. and Karlis D. (2008). On modeling count data: a comparison of some well-known discrete distributions. Journal of Statistical Computation and Simulation, 78(3): 437–457.
See Also
Examples
x <- rpois(100, 2)
disc.mle(x, type = "poisson")