Probability distributions

Constructing probability distribution for random variable

dharmanath patil 🤟🏻
Analytics Vidhya
4 min readAug 27, 2019

--

Discrete Vs Continuous

In order to understand probability distribution it is required to understand what are random variables and types of random variables. If you are not familiar with these- please visit Random Variables and Types Of Random Variables. Assuming you have prior knowledge about these topics, let’s try to understand probability distribution for discrete random variable and continuous random variable.

1. Probability Distribution For Discrete Random Variables

Let’s say we define a random variable X as the number of heads we get after 3 flips of a fair coin. We would like to plot distribution for this p(X). We will list all possible outcomes in this experiment as:

all possible outcomes after 3 flips of a fair coin
  • probability of getting 0 heads: P(X=0) = 1/8
  • probability of getting 1 head: P(X=1) = 3/8
  • probability of getting 2 heads: P(X=2) = 3/8
  • probability of getting 3 heads: P(X=3) = 1/8

From above we can plot distribution as:

discrete probability distribution

Above picture shows probability distribution for number of heads that we get after 3 flips of fair coin. X-axis always holds the experiment outcome for which we want to plot the distribution and y-axis either can be probability or number of experiments for which we observed the outcomes.

2. Probability Distribution For Continuous Random Variables

Let’s say we define a random variable Y as the exact amount of rain that might fall tomorrow. We would like to plot distribution for this p(Y).

Say, we don’t know actual probability distribution function for this but let’s draw one (randomly) and try to interpret. Let’s assume it looks something like below:

Probability density curve

From the above figure, if we try to interpret the probability of exact amount of rain that might fall tomorrow being equals to 2 i.e p(Y=2) then we might misjudge as 0.5 which is not true. We can correlate this to the area of a unit square. The area of a unit square is 1 while the area of any point in that unit square is 0. Similarly, the sum of probabilities of all the outcomes in a continuous probability distribution add up to exactly 1 and the probability of any exact event in continuous random distribution is 0. In the above density-curve, the area under the curve will add up to exactly 1.

and p(Y=2)=0

This is little confusing isn’t it? Let’s make it little simple. Observe discrete probability distribution figure. In that figure each outcome is occupying a unit space on x-axis and the height on y-axis depends on the number of times the outcome has been observed out of all the possible outcomes.

Hence probability of happening any event is equals to (magnitude on x * magnitude on y).

In discrete probability distribution since each outcome occupies unit space on x-axis, the probability of happening any event is equals to (1 * magnitude on y) which is nothing but magnitude on y.

In continuous variable distribution, we have nearly infinite outcomes hence each outcome occupies significantly zero unit on x axis. If we substitute magnitude of x in the equation (magnitude on x * magnitude on y) we will get probability equals to 0. Hence probability of happening any exact event is equals to 0 in continuous variable distribution since the magnitude of outcome on x-axis is nearly 0.

So how continuous variable distributions is used? In continuous distribution we can always find the probability of an event between bounds. For example p(1.9<Y<2.1). All we need to do is find the area between 1.9 and 2.1 as shown below:

area between 1.9 and 2.1

Using integral of density function you can find the area between 1.9 and 2.1 which represents the probability of rain that might fall tomorrow between 1.9 inches and 2.1 inches.

Conclusion

We saw how to plot probability distribution and density curves for discrete random variable and continuous random variable respectively. We also saw how probability of an event in discrete random distribution defers from continuous random distribution.

Find next post Binomial Random Variable

--

--

dharmanath patil 🤟🏻
Analytics Vidhya

I’m a Sr. Data Scientist at Youplus Inc. and this is my notepad for Applied Math / CS / Deep Learning / NLP topics.