Skip to contents

For the density function of the Binomial distribution see Binomial.

Usage

mlbinom(x, na.rm = FALSE, ...)

Arguments

x

a (non-empty) numeric vector of data values.

na.rm

logical. Should missing values be removed?

...

The arguments size can be specified to only return the ml of prob. reltol is the relative accuracy requested, defaults to .Machine$double.eps^0.25. iterlim is a positive integer specifying the maximum number of iterations to be performed before the program is terminated (defaults to 100).

Value

mlbinom returns an object of class univariateML. This is a named numeric vector with maximum likelihood estimates for size and prob and the following attributes:

model

The name of the model.

density

The density associated with the estimates.

logLik

The loglikelihood at the maximum.

support

The support of the density.

n

The number of observations.

call

The call as captured my match.call

Details

The estimator computes both the size and prob parameter by default. Be aware that the likelihood will often be unbounded. According to Olkin et al. (1981), the likelihood is unbounded when \(\hat{\mu}/\hat{\sigma}^2 \leq 1\), where \(\hat{\sigma}^2\) is the biased sample variance. When the likelihood is unbounded,the maximum likelihood estimator can be regarded as a Poisson with lambda parameter equal to the mean of the observation.

When \(\hat{\mu}/\hat{\sigma}^2 \leq 1\) and size is not supplied by the user, an error is cast. If size is provided and size < max(x), an error is cast.

The maximum likelihood estimator of size is unstable, and improvements exist. See, e.g., Carroll and Lomard (1985) and DasGupta and Rubin (2005).

References

Olkin, I., Petkau, A. J., & Zidek, J. V. (1981). A comparison of n Estimators for the binomial distribution. Journal of the American Statistical Association, 76(375), 637-642. https://doi.org/10.1080/01621459.1981.10477697

Johnson, N. L., Kemp, A. W., & Kotz, S. (2005). Univariate Discrete Distributions (3rd ed.). Wiley-Blackwell.

Carroll, R. J., & Lombard, F. (1985). A Note on N Estimators for the Binomial Distribution. Journal of the American Statistical Association, 80(390), 423-426. https://doi.org/10.1080/01621459.1985.10478134

DasGupta, A., & Rubin, H. (2005). Estimation of binomial parameters when both n,p are unknown. Journal of Statistical Planning and Inference, 130(1-2), 391-404. https://doi.org/10.1016/j.jspi.2004.02.019

See also

Binomial for the density.

Examples

# The likelihood will often be unbounded.
if (FALSE) { # \dontrun{
mlbinom(ChickWeight$weight)
} # }
# Provide a size
mlbinom(ChickWeight$weight, size = 400)
#> Maximum likelihood estimates for the Binomial model 
#>     size      prob  
#> 400.0000    0.3045  

# Or use mlpoiss, the limiting likelihood of the binomial.
mlpois(ChickWeight$weight)
#> Maximum likelihood estimates for the Poisson model 
#> lambda  
#>  121.8