# egeom: Estimate Probability Parameter of a Geometric Distribution

### Description

Estimate the probability parameter of a geometric distribution.

### Usage

 1  egeom(x, method = "mle/mme") 

### Arguments

 x vector of non-negative integers indicating the number of trials that took place before the first “success” occurred. (The total number of trials that took place is x+1). Missing (NA), undefined (NaN), and infinite (Inf, -Inf) values are allowed but will be removed. If length(x)=n and n is greater than 1, it is assumed that x represents observations from n separate geometric experiments that all had the same probability of success (prob). method character string specifying the method of estimation. Possible values are "mle/mme" (maximum likelihood and method of moments; the default) and "mvue" (minimum variance unbiased). You cannot use method="mvue" if length(x)=1. See the DETAILS section for more information on these estimation methods.

### 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, …, x_n) be a vector of n independent observations from a geometric distribution with parameter prob=p.

It can be shown (e.g., Forbes et al., 2011) that if X is defined as:

X = ∑^n_{i = 1} x_i

then X is an observation from a negative binomial distribution with parameters prob=p and size=n.

Estimation
The maximum likelihood and method of moments estimator (mle/mme) of p is given by:

\hat{p}_{mle} = \frac{n}{X + n}

and the minimum variance unbiased estimator (mvue) of p is given by:

\hat{p}_{mvue} = \frac{n - 1}{X + n - 1}

(Forbes et al., 2011). Note that the mvue of p is not defined for n=1.

### Value

a list of class "estimate" containing the estimated parameters and other information. See
estimate.object for details.

### Note

The geometric distribution with parameter prob=p is a special case of the negative binomial distribution with parameters size=1 and prob=p.

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.

### 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.

Geometric, enbinom, NegBinomial.

### Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53  # Generate an observation from a geometric distribution with parameter # prob=0.2, then estimate the parameter prob. # (Note: the call to set.seed simply allows you to reproduce this example.) set.seed(250) dat <- rgeom(1, prob = 0.2) dat #[1] 4 egeom(dat) #Results of Distribution Parameter Estimation #-------------------------------------------- # #Assumed Distribution: Geometric # #Estimated Parameter(s): prob = 0.2 # #Estimation Method: mle/mme # #Data: dat # #Sample Size: 1 #---------- # Generate 3 observations from a geometric distribution with parameter # prob=0.2, then estimate the parameter prob with the mvue. # (Note: the call to set.seed simply allows you to reproduce this example.) set.seed(200) dat <- rgeom(3, prob = 0.2) dat #[1] 0 1 2 egeom(dat, method = "mvue") #Results of Distribution Parameter Estimation #-------------------------------------------- # #Assumed Distribution: Geometric # #Estimated Parameter(s): prob = 0.4 # #Estimation Method: mvue # #Data: dat # #Sample Size: 3 #---------- # Clean up #--------- rm(dat) 

Search within the EnvStats package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.