betageomUC: The Beta-Geometric Distribution

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Density, distribution function, and random generation for the beta-geometric distribution.

Usage

1
2
3
dbetageom(x, shape1, shape2, log = FALSE)
pbetageom(q, shape1, shape2, log.p = FALSE)
rbetageom(n, shape1, shape2)

Arguments

x, q

vector of quantiles.

n

number of observations. Same as runif.

shape1, shape2

the two (positive) shape parameters of the standard beta distribution. They are called a and b in beta respectively.

log, log.p

Logical. If TRUE then all probabilities p are given as log(p).

Details

The beta-geometric distribution is a geometric distribution whose probability of success is not a constant but it is generated from a beta distribution with parameters shape1 and shape2. Note that the mean of this beta distribution is shape1/(shape1+shape2), which therefore is the mean of the probability of success.

Value

dbetageom gives the density, pbetageom gives the distribution function, and rbetageom generates random deviates.

Note

pbetageom can be particularly slow.

Author(s)

T. W. Yee

See Also

geometric, betaff, Beta.

Examples

1
2
3
4
5
6
7
8
## Not run: 
shape1 <- 1; shape2 <- 2; y <- 0:30
proby <- dbetageom(y, shape1, shape2, log = FALSE)
plot(y, proby, type = "h", col = "blue", ylab = "P[Y=y]", main = paste(
     "Y ~ Beta-geometric(shape1=", shape1,", shape2=", shape2, ")", sep = ""))
sum(proby)

## End(Not run)

Example output

Loading required package: stats4
Loading required package: splines
[1] 0.9393939

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.