Chapter 2


In this chapter, you’ll learn the rules of probability and apply them to games of chance, jury selection, surveys, and blood types. You’ll use R to generate simulated random data and learn how to create your own R functions.


Because of the variation that is inherent in the processes we study, we are forced to speak in probabilistic terms rather than absolutes. We talk about the probability that a sixth-grader is exactly 150 cm tall, or, more often, the probability that his height will lie between two values, such as 150 and 155 cm. The events we study may happen a large proportion of the time, or “almost always,” but seldom “always” or “never.”

Rather arbitrarily, and some time ago, it was decided that probabilities would be assigned a value between 0 and 1, that events that were certain to occur would be assigned probability 1, and that events that would “never” occur would be given probability zero. This makes sense if we interpret probabilities in terms of frequencies; for example, that the probability that a coin turns up heads is the ratio of the number of heads in a very large number of coin tosses to the total number of coin tosses.

When talking about a set of equally likely events, such as the probability that a fair coin will come up heads, or an unweighted die will display a “6,” this limitation makes a great deal of sense. A coin has two sides; we say the probability it comes up heads is a half and the probability of tails is a half ...

Get Introduction to Statistics Through Resampling Methods and R, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.