gnbinom: Graphical Depiction of the Negative Binomial Distribution

View source: R/gnbinom.R

gnbinomR Documentation

Graphical Depiction of the Negative Binomial Distribution

Description

gbinom permits specification of regions in a negative binomial distribution

Usage

gnbinom(k, r, p)

Arguments

k

this argument is used to set the x axis scale of the graph. Often choosing a value of 10 or 15 is adequate for textbook types of demonstrations. See the examples below for better illustration.

r

The number of successes

p

probability of a success on each trial.

Details

The function plots probabilities of each of several possible numbers of failures (ranging up to k) before the rth success. The graph can be confusing without exploring the examples below (as well as class materials on the function).

Note

This function is a modification of the code for the Negative Binomial Distribution found in the Rcmdr package.

Author(s)

Bruce Dudek bruce.dudek@albany.edu

See Also

gbinom, for an analogous function displaying the binomial distribution.

Examples


#setting \code{r} to 1 reduces the negative binomial (Pascal) distribution
#to a geometric distribution and the plot can be easily interpreted.
gnbinom(5,1,.5)
# probabilities of 0,1,2,3 or 4 failures before the second success.
gnbinom(4,2,.5)
# probabilities of 0 through 8 failures before the second success.
gnbinom(8,2,.5)
# probabilities of 0 through 10 failures before the third success.
gnbinom(10,3,.5)
# any value of p can be used
gnbinom(10,2,.1)


bcdudek/bcdstats documentation built on Jan. 3, 2024, 10:09 p.m.