Statistics-Chapter 4: Random Variable

Vishva Shah
5 min readJul 4, 2020

--

Hello there,

Today is going to be the base of the advanced chapters which you will be learning later. We will be learning random variables and their moments. So Let’s begin.

Random variables

A random variable is a rule for associating a number with each element in a sample space. So, if w is an element of the sample space S (ie w is one of the possible outcomes of the experiment concerned) and the number x is associated with this outcome, then X(w) = x

Discrete random variables

If you remember what we learnt in the last chapter: sets, a sample space is the set of all possible outcomes, of an experiment.

In the example given above, X is a discrete random variable as the numbers cannot be continuous in a die, where x can take values according to the events specified.

Probabilities:

We learnt how to calculate probabilities in the last chapter. This is a very simple example of calculating discrete probability and how to compute it.

Example of probability

Probability distribution functions:

P(X=x) — what do we mean by this? The function f(x) =P(X =x) for each x in the range of X is the probability function (PF) of X — it specifies how the total probability of 1 is divided up amongst the possible values of X and so gives the probability distribution of X. Probability functions are also known as “probability distribution functions”. Note the requirements for a function to qualify as the probability function of a discrete random variable:

This means that the summation of all probabilities should sum up to 1 and all the probabilities should be non-negative.

Cumulative distribution functions:

CDF graph

The cumulative distribution or cumulative distribution function (CDF) of X is also very important: F(x) = P(X ≤ x) gives the probability that X assumes a value that does not exceed x. The minimum value of F(x) will be 0 and then it will add up all the probabilities where the maximum value of F(x) shouldn’t be more than 1. Consider it like a step function as shown in the figure.

Continuous random variables

Unlike discrete random variables, continuous random variable can take any value within a specified range.

Probability density function:

The PDF of continuous random variable is shown in the figure. Can you spot the difference between the pdf of a discrete random variable and the pdf of continuous random variable?

Well, the difference is that in DRV, we use summation while in CRV, we use integration.

In the figure, you can also see that the shaded area is the probability that our random variable X is between values a and b. Also, similar to the DRV, the summation, in this case, the integration of f(x) within the specified limits, should sum up to 1.

Cumulative distribution function:

The cumulative distribution function (CDF) is defined to be the function: F(x) =P(X ≤ x). For a continuous random variable, F(x) is a continuous, non-decreasing function, defined for all real values of x, just like the step function we saw above, only this won’t be discrete.

This is an example of how to calculate CDF of a function W. You should aim to solve problems like this very easily as this is a typical example of solving the CDF of any given function.

Expected Values:

The first expectation is for Discrete random variable and the second one is an example of Continuous random variable.

Hope this makes your concept clear about how to calculate expected values.

Variance and standard deviation:

Remember how we learnt to calculate variance in chapter 1: Numerical Measures, if not, you can always go back and revise it. This is how we calculate the variance using the expected values we learnt above.

Example for calculating variance for continuous random variable

Linear functions of X:

These are important results. The result for the expected value can be thought of simply as “whatever you multiply the random variable by or add to it, you do the same to the mean”. When you multiply the random variable by a constant you multiply the standard deviation by the same value, so the variance is multiplied by that constant squared. If this doesn’t seem obvious you could try this on a few simple examples.

Example of this article

This is all about random variables. Hope this makes your concepts clear.

In the next article, we will learn about most of the distributions and their moments. It’s going to be a lot of fun. :)

Happy Learning. Stay tuned. Stay safe!

--

--

Vishva Shah

Machine Learning Associate at PwC | Master of Business Analytics at UIC | Actuarial Science | Master’s and Bachelor’s in Commerce