Зміст курсу
Advanced Probability Theory
Advanced Probability Theory
Absolutely Continuous and Discrete Random Variables
Understanding Random Variables
A random variable is a value that changes based on the outcome of a random event or experiment. For example, it could be the number of heads in coin tosses, accidents on a road segment, weight on a scale, or bus wait time.
Random variables can be categorized into two types:
- Discrete Variables: Take specific, countable values like natural numbers (e.g., the number of road incidents);
- Continuous Variables: Can take any value within a certain range (e.g., a person's weight).
Probability Mass Function (PMF)
Probability Mass Function (PMF) is used to describe discrete random variables. It's like a table containing all possible values of the random variable and their corresponding probabilities.
For example, consider a simple PMF describing the outcome of a single coin toss.
Let's look at the example of using PMF in Python: we will use the Binomial distribution described in the Probability Theory Basics course.
from scipy.stats import binom # Flipping a coin 5 times and finding out how many times we get heads # `n` is a number of experiments, `p` is probability of occuring a head coin = binom(n=5, p=0.5) # Due to conditions of an experiment we can have heads 0, 1, 2, 3, 4, 5 times # Using pmf to get probabilities of all described results of an experiment for i in range (6): print('Probability of ', i, ' heads is ', round(coin.pmf(i), 4))
The result of the code above can be represented as follows:
Note
The sum of all probabilities in the PMF table always equals 1.
On the other hand, how can we represent continuous random variables if we cannot simply list all possible values of these variables and write down the distribution series? We will address this question in the next chapter.
Дякуємо за ваш відгук!