4Probability Basics

“Probably not,” “they probably will,” “in all probability,” etc.: in the English language, we think we know what we mean when we say something will probably happen. Mathematical “probability” is something a bit more technical than this intuitive feeling.

Probability evolved in the sixteenth and seventeenth centuries from gambling and games of chance. Tossing a “fair” die, and pulling a card from a “well‐shuffled deck,” would have been the “experiments” that originally led to the formal theory of probability. Of course, probability today has developed way beyond this and has become relevant in a wide range of areas.

The relevance of probability to computing stems from the fact that many computing problems contain elements of uncertainty or randomness. For example, the results of experiments to measure, say, algorithm efficiency, CPU (central processing unit) time or response time, may depend on a number of factors including, how busy the computer is at the time of running the program, how many other jobs are running, how many computers are on the network, and these factors vary from experiment to experiment.

In this chapter, we outline the basic concepts of probability, and introduce the functions available in R for examining them.

4.1 Experiments, Sample Spaces, and Events

Any activity for which the outcome is uncertain can be thought of as an “experiment.” An experiment could be as simple as pulling a card from a deck to observe what card occurs, or tossing ...

Get Probability with R, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.