enbinom {EnvStats} | R Documentation |
Estimate Probability Parameter of a Negative Binomial Distribution
Description
Estimate the probability parameter of a negative binomial distribution.
Usage
enbinom(x, size, method = "mle/mme")
Arguments
x |
vector of non-negative integers indicating the number of trials that took place
before |
size |
vector of positive integers indicating the number of “successes” that
must be observed before the trials are stopped. Missing ( |
method |
character string specifying the method of estimation. Possible values are: |
Details
If x
contains any missing (NA
), undefined (NaN
) or
infinite (Inf
, -Inf
) values, they will be removed prior to
performing the estimation.
Let \underline{x} = (x_1, x_2, \ldots, x_n)
be a vector of n
independent observations from negative binomial distributions
with parameters prob=
p
and size=
\underline{k}
, where
where \underline{k} = c(k_1, k_2, \ldots, k_n)
is a vector of n
(possibly different) values.
It can be shown (e.g., Forbes et al., 2011) that if X
is defined as:
X = \sum^n_{i = 1} x_i
then X
is an observation from a
negative binomial distribution with
parameters prob=
p
and size=
K
, where
K = \sum^n_{i = 1} k_i
Estimation
The maximum likelihood and method of moments estimator (mle/mme) of
p
is given by:
\hat{p}_{mle} = \frac{K}{X + K}
and the minimum variance unbiased estimator (mvue) of p
is given by:
\hat{p}_{mvue} = \frac{K - 1}{X + K - 1}
(Forbes et al., 2011). Note that the mvue of p
is not defined for
K=1
.
Value
a list of class "estimate"
containing the estimated parameters and other information.
See estimate.object
for details.
Note
The negative binomial distribution has its roots in a gambling game where participants would bet on the number of tosses of a coin necessary to achieve a fixed number of heads. The negative binomial distribution has been applied in a wide variety of fields, including accident statistics, birth-and-death processes, and modeling spatial distributions of biological organisms.
The geometric distribution with parameter prob=
p
is a special case of the negative binomial distribution with parameters
size=1
and prob=
p
.
Author(s)
Steven P. Millard (EnvStats@ProbStatInfo.com)
References
Forbes, C., M. Evans, N. Hastings, and B. Peacock. (2011). Statistical Distributions. Fourth Edition. John Wiley and Sons, Hoboken, NJ.
Johnson, N. L., S. Kotz, and A. Kemp. (1992). Univariate Discrete Distributions. Second Edition. John Wiley and Sons, New York, Chapter 5.
See Also
NegBinomial, egeom
, Geometric.
Examples
# Generate an observation from a negative binomial distribution with
# parameters size=2 and prob=0.2, then estimate the parameter prob.
# Note: the call to set.seed simply allows you to reproduce this example.
# Also, the only parameter that is estimated is prob; the parameter
# size is supplied in the call to enbinom. The parameter size is printed in
# order to show all of the parameters associated with the distribution.
set.seed(250)
dat <- rnbinom(1, size = 2, prob = 0.2)
dat
#[1] 5
enbinom(dat, size = 2)
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Negative Binomial
#
#Estimated Parameter(s): size = 2.0000000
# prob = 0.2857143
#
#Estimation Method: mle/mme for 'prob'
#
#Data: dat, 2
#
#Sample Size: 1
#----------
# Generate 3 observations from negative binomial distributions with
# parameters size=c(2,3,4) and prob=0.2, then estimate the parameter
# prob using the mvue.
# (Note: the call to set.seed simply allows you to reproduce this example.)
size.vec <- 2:4
set.seed(250)
dat <- rnbinom(3, size = size.vec, prob = 0.2)
dat
#[1] 5 19 12
enbinom(dat, size = size.vec, method = "mvue")
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Negative Binomial
#
#Estimated Parameter(s): size = 9.0000000
# prob = 0.1818182
#
#Estimation Method: mvue for 'prob'
#
#Data: dat, size.vec
#
#Sample Size: 3
#----------
# Clean up
#---------
rm(dat)