zageomUC: Zero-Altered Geometric Distribution

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

Description

Density, distribution function, quantile function and random generation for the zero-altered geometric distribution with parameter pobs0.

Usage

1
2
3
4
dzageom(x, prob, pobs0 = 0, log = FALSE)
pzageom(q, prob, pobs0 = 0)
qzageom(p, prob, pobs0 = 0)
rzageom(n, prob, pobs0 = 0)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

number of observations. If length(n) > 1 then the length is taken to be the number required.

prob, log

Parameters from the ordinary geometric distribution (see dgeom).

pobs0

Probability of (an observed) zero, called pobs0. The default value of pobs0 = 0 corresponds to the response having a positive geometric distribution.

Details

The probability function of Y is 0 with probability pobs0, else a positive geometric(prob) distribution.

Value

dzageom gives the density and pzageom gives the distribution function, qzageom gives the quantile function, and rzageom generates random deviates.

Note

The argument pobs0 is recycled to the required length, and must have values which lie in the interval [0,1].

Author(s)

T. W. Yee

See Also

zageometric, zigeometric, rposgeom.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
prob <- 0.35; pobs0 <- 0.05; x <- (-1):7
dzageom(x, prob = prob, pobs0 = pobs0)
table(rzageom(100, prob = prob, pobs0 = pobs0))

## Not run:  x <- 0:10
barplot(rbind(dzageom(x, prob = prob, pobs0 = pobs0),
                dgeom(x, prob = prob)),
        beside = TRUE, col = c("blue", "orange"), cex.main = 0.7, las = 1,
        ylab = "Probability", names.arg = as.character(x),
        main = paste("ZAG(prob = ", prob, ", pobs0 = ", pobs0,
                   ") [blue] vs",  " Geometric(prob = ", prob,
                   ") [orange] densities", sep = "")) 
## End(Not run)

Example output

Loading required package: stats4
Loading required package: splines
[1] 0.00000000 0.05000000 0.33250000 0.21612500 0.14048125 0.09131281 0.05935333
[8] 0.03857966 0.02507678

 0  1  2  3  4  5  6  7  8 10 13 
 4 28 35 11  9  6  2  2  1  1  1 

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