gnbinom | R Documentation |
gbinom
permits specification of regions in a negative binomial
distribution
gnbinom(k, r, p)
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. |
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).
This function is a modification of the code for the Negative Binomial
Distribution found in the Rcmdr
package.
Bruce Dudek bruce.dudek@albany.edu
gbinom
, for an analogous function
displaying the binomial distribution.
#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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.