# Probability

In games of chance, probability has a very intuitive definition. However, this is not the case in other contexts. Today probability theory is being used much more broadly with the word probability commonly used in everyday language. Google’s auto-complete of “What are the chances of” give us: “having twins”, “rain today”, “getting struck by lightning”, and “getting cancer”. One of the goals of this part of the book is to help us understand how probability is useful to understand and describe real-world events when performing data analysis. Probability theory is useful any time our data is affected by chance in some way. All of the other chapters in this book build upon probability theory. Knowledge of probability is therefore indispensable for most data analysis challenges.

Because knowing how to compute probabilities gives you an edge in games of chance, throughout history many smart individuals, including famous mathematicians such as Cardano, Fermat, and Pascal, spent time and energy thinking through the math of these games. As a result, Probability Theory was born. Probability continues to be highly useful in modern games of chance. For example, in poker, we can compute the probability of winning a hand based on the cards on the table. Also, casinos rely on probability theory to develop games that almost certainly guarantee a profit. We will use casino games to illustrate the basic concepts.

This part of the book discusses concepts that can be found in many comprehensive books on probability theory. These books delve into the mathematical theories and formulas behind probability.

However, this book takes a different approach. Instead of diving into the mathematical theories, it uses R to demonstrate these concepts. This helps readers visualize and better understand the principles of probability in practical terms, as they can see the results and outcomes by running code.

Despite this practical approach, the book does not immediately apply these probability concepts to real-world data. This connection between probability theory and real data will be made in a subsequent section or part of the book.

In other words, while you’re learning about probability now, it’ll be a bit longer before you see how these concepts relate directly to real datasets.