Chapter 8. Probability
Probability theory is the foundation of statistics, and R has plenty of machinery for working with probability, probability distributions, and random variables. The recipes in this chapter show you how to calculate probabilities from quantiles, calculate quantiles from probabilities, generate random variables drawn from distributions, plot distributions, and so forth.
Names of Distributions
R has an abbreviated name for every probability distribution. This name is used to identify the functions associated with the distribution. For example, the name of the normal distribution is “norm,” which is the root of the function names listed in Table 8-1.
| Function | Purpose |
|---|---|
|
Normal density |
|
Normal distribution function |
|
Normal quantile function |
|
Normal random variates |
Table 8-2 describes some common discrete distributions, and Table 8-3 describes several common continuous distributions.
| Discrete distribution | R name | Parameters |
|---|---|---|
Binomial |
|
|
Geometric |
|
|
Hypergeometric |
|
|
Negative binomial (NegBinomial) |
|
|
Poisson |
|
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access