Continuous Random Variable

Summary

  • If [a, b] are the domain of the continuous random variable function f and f(x) > 0 then:  \int _{ a }^{ b }{ f\left( x \right) dx } \quad =\quad 1
  • Cumulative probabilities provided, can be represented as: P\left[ X\quad \le \quad a \right] \quad =\quad \int _{ a }^{ b }{ f\left( x \right) dx }
  • Differentiating cdf always gives you probability density function.
  • Mean\quad =\quad E(X)\quad =\quad \mu \quad =\quad \int _{ a }^{ b }{ x\quad \ast \quad f\left( x \right) dx }
  • var(x)\quad =\quad { \sigma }^{ 2 }\quad =\quad E({ X }^{ 2 })\quad -\quad { \left[ E(x) \right] }^{ 2 }
  • S.D\quad =\quad \sigma \quad =\quad \sqrt { E({ X }^{ 2 })\quad -\quad { \left[ E(x) \right] }^{ 2 } }
  • to find the probability of X that is in an interval
    P(a ≤  X  ≤ b) = P(X  ≤  b) – P(X  ≤  a) = F(b) – F(a)

A random variable is said to be continuous random variable if its value lies in an interval.
E.g if you are asked to find the number of students in class whose height lies between 120cm to 140cm, to solve this question, you will only take students that lie within the 120cm to 140 cm interval, this will be known as continuous random variable.

If for a continuous random variable, we need to define a probability function f(x), then f(x) is said to be a probability density function. If [a,b] are the domain of the continuous random variable function f and f(x) > 0 then:

 \int _{ a }^{ b }{ f\left( x \right) dx } \quad =\quad 1

Cumulative Distribution Function (c.d.f.)

Cumulative distribution function(also written as CDF) in continuous random variable, remains the same as the discrete random variable. Assume we have a continuous random variable X with the probability density function P\left[ a\quad \le \quad x\quad \le \quad b \right] . Then Cumulative probabilities provided, can be represented as:

P\left[ X\quad \le \quad a \right] \quad =\quad \int _{ a }^{ b }{ f\left( x \right) dx }

Also, to find the probability of X that is in an interval, such as P\left[ a\quad \le \quad x\quad \le \quad b \right] . We can say:

P(a\quad \le \quad X\le \quad b)\quad =\quad P(X\quad \le \quad b)\quad -\quad P(X\quad \le \quad a)=F(b)\quad -\quad F(a)

Example #1

Q. If x is said to be a random variable with range [2, 4] and probability density function f\left( x \right) \quad =\quad \frac { x }{ 6 } .  What is the value of cumulative distribution function (x\quad \le \quad 2.5).

Solution:

Firstly, we can see that the question does not mention whether the random variable is discrete or continuous, however, we can see that they have given us a range between [2, 4], thus that makes it pretty clear that the question is talking about continuous random variable.

Secondly, to solve this question, we know that we need to find the values between 2 to 4. And we also know that the question asked for the probability  (x\quad \le \quad 2.5), and since our range is between 2 – 4 our a would be 2 and b would be 2.5, for this we will use the Cumulative distribution function formula written above:

P\left[ X\quad \le \quad a \right] \quad =\quad \int _{ a }^{ b }{ f\left( x \right) dx }

=\quad \int _{ 2 }^{ 2.5 }{ \frac { x }{ 6 } dx } \quad =\quad { \left[ \frac { { x }^{ 2 } }{ 12 } \right] }_{ 2 }^{ 2.5 }=\quad 0.1875

Important note:

  • Cumulative distribution function always follows the constraint 0\quad \le \quad cdf\le \quad 1.  Since probability is a non-negative value and cdf is also considered a non-decreasing function.
  • Secondly, differentiating cdf always gives you probability density function.

Expectation and Variance

Expected value, also known as the mean of all the possible outcomes. In continuous random variable, it is calculated using the following formula:

E(X)\quad =\quad \mu \quad =\quad \int _{ a }^{ b }{ x\quad \ast \quad f\left( x \right) dx }

The variance and standard deviation remain the same as that of discrete random variable.

var(x)\quad =\quad { \sigma }^{ 2 }\quad =\quad E({ X }^{ 2 })\quad -\quad { \left[ E(x) \right] }^{ 2 }

S.D\quad =\quad \sigma \quad =\quad \sqrt { E({ X }^{ 2 })\quad -\quad { \left[ E(x) \right] }^{ 2 } }

References
  1. https://ltcconline.net/greenl/courses/117/DoubIntProb/ctsrandvar.htm
  2. https://www.hackerearth.com/practice/machine-learning/prerequisites-of-machine-learning/continuous-random-variables/tutorial/