Learn R Programming

VGAM (version 0.9-0)

geometric: Geometric Distribution

Description

Maximum likelihood estimation for the geometric distribution.

Usage

geometric(link = "logit", expected = TRUE, imethod = 1,
          iprob = NULL, zero = NULL)

Arguments

link
Parameter link function applied to the parameter $p$, which lies in the unit interval. See Links for more choices.
expected
Logical. Fisher scoring is used if expected = TRUE, else Newton-Raphson.
imethod
An integer with value 1 or 2 or 3 which specifies the initialization method for the probability. If failure to converge occurs try another value.
iprob, zero
See CommonVGAMffArguments for more details.

Value

  • An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm, and vgam.

Details

A random variable $Y$ has a 1-parameter geometric distribution if $P(Y=y) = p (1-p)^y$ for $y=0,1,2,\ldots$. Here, $p$ is the probability of success, and $Y$ is the number of (independent) trials that are fails until a success occurs. Thus the response $Y$ should be a non-negative integer. The mean of $Y$ is $E(Y) = (1-p)/p$ and its variance is $Var(Y) = (1-p)/p^2$. The geometric distribution is a special case of the negative binomial distribution (see negbinomial). If $Y$ has a geometric distribution with parameter $p$ then $Y+1$ has a positive-geometric distribution with the same parameter.

Multiple responses are permitted.

References

Evans, M., Hastings, N. and Peacock, B. (2000) Statistical Distributions, New York: Wiley-Interscience, Third edition.

See Also

negbinomial, Geometric, betageometric, expgeometric, zageometric, zigeometric, rbetageom.

Examples

Run this code
gdata <- data.frame(x2 = runif(nn <- 1000) - 0.5)
gdata <- transform(gdata, x3 = runif(nn) - 0.5,
                          x4 = runif(nn) - 0.5)
gdata <- transform(gdata, eta  = 1.0 - 1.0 * x2 + 2.0 * x3)
gdata <- transform(gdata, prob = logit(eta, inverse = TRUE))
gdata <- transform(gdata, y1 = rgeom(nn, prob))
with(gdata, table(y1))
fit <- vglm(y1 ~ x2 + x3 + x4, geometric, gdata, trace = TRUE)
coef(fit, matrix = TRUE)
summary(fit)

Run the code above in your browser using DataLab