Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

PT1,2,3 - Random Variables, Distribution Functions, Mathematical Expectation - CG-1-39

Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

RANDOM VARIABLES,

DISTRIBUTION FUNCTIONS &


MATHEMATICAL EXPECTATION
DR. CHARU GOEL
RANDOM VARIABLES
• Definition: Consider a random experiment with Sample Space S, then a random variable X is a single-
valued real function that assigns a real number called the value of X(Si) to each sample point Si of S.

S (= domain of the r.v. X) = the set of all expected outcomes, and


R (= range of the r.v. X) = the collection of all numbers i.e. values of X(Si)
Random variable
• A random variable is a numerical description of the outcome of a statistical experiment.
• Example: Toss a coin

• Types of random variable


q Discrete (having specific values)
q Continuous (any value in a continuous range)
Definitions and Notation
• Discrete Random variable: one whose possible values are finite or countably infinite (like the
numbers 1, 2, 3, …)
Example: Tosses of a coin, Rolling a die, Marks of students, etc.
• Continuous random variable: one whose values constitute an entire (infinite) range of possibilities
over an interval.
Example: Temperature, Time, Weight of employees, etc.

• Random variables are generally denoted with capital letters such as X, Y, Z


(for more number of possible values taken by random variables, denote them by x1, x2, …, xn)
Examples of discrete random variable
1. Toss a coin twice, and let the random variable X be the number of tails appearing.
q What are the possible values of X ?

q What kind of random variable is X?

q What are the probabilities of the possible outcomes?


Examples of discrete random variable
1. Toss a coin twice, and let the random variable X be the number of tails appearing.
q What are the possible values of X ?
0, 1, 2
q What kind of random variable is X?
Discrete
q What are the probabilities of the possible outcomes?
Possible outcomes: S = { (H,H), (H,T), (T,H), (T,T) }

X = No. of tails 0 1 2

Probability 1/4 1/2 1/4


Examples of discrete random variable
2. Roll a fair 6-sided die, and let the random variable X be the outcome of the rolled die.
q What are the possible values of X ?

q What kind of random variable is X?

q What are the probabilities of the possible outcomes?


Examples of discrete random variable
2. Roll a fair 6-sided die, and let the random variable X be the outcome of the rolled die.
q What are the possible values of X ?
1, 2, 3, 4, 5, 6
q What kind of random variable is X?
Discrete
q What are the probabilities of the possible outcomes?
Possible outcomes: S = {1, 2, 3, 4, 5, 6}

Outcome of 1 2 3 4 5 6
die roll
Probability 1/6 1/6 1/6 1/6 1/6 1/6
1. Probability Distribution
• Probability distribution of a random variable is a list of all the possible values of
a random variable along with their corresponding probabilities.
• Let P(X = xi) = pi denotes the probability that the discrete r.v. X takes all the
value x1, x2, …, xk corresponding to the various outcomes of a random
experiment. The collection of pairs (xi , pi), i = 1, 2, …, k is called the probability
distribution of X or the discrete probability distribution.
X x1 x2 … xk

P(X = xi) = pi p1 p2 … pk
Probability Mass Function of a random variable
• The function P(X) is called the probability function of the discrete r.v. X
if
1. 0 ≤ pi ≤ 1 for all i = 1, 2, …, k
2. p1 + p2+ … + pk = 1

• The probability function f(x) = P(X = x) of a discrete r.v. X is also


called the probability mass function of X.
Examples of Probability Distribution
1. Probability distribution of two tosses of a coin, where the random variable X is
the number of tails appearing:
X = No. of tails 0 1 2

Probability 1/4 1/2 1/4

2. Probability distribution of rolling a fair 6-sided die, where the random variable
X is the outcome of the rolled die:
Outcome of 1 2 3 4 5 6
die roll
Probability 1/6 1/6 1/6 1/6 1/6 1/6
Examples of Probability Distribution
3. A coin is tossed 3 times and the random variable X is number of tails tossed.
q What are the possible outcomes, values of X, and probabilities?
Examples of Probability Distribution
3. A coin is tossed 3 times and the random variable X is number of tails tossed.
q What are the possible outcomes, values of X, and probabilities?
Examples of Probability Distribution
3. A coin is tossed 3 times and the random variable X is number of tails tossed.
q What are the possible outcomes, values of X, and probabilities?

q How do we find probability that x =1? and that X =2?

q Is it a Probability mass function?

q Probability distribution?
Examples of Probability Distribution
3. A coin is tossed 3 times and the random variable X is number of tails tossed.
q What are the possible outcomes, values of X, and probabilities?

q How do we find probability that x =1? and that X =2?


p1 = P(X=1) = 1/8 + 1/8 + 1/8 = 3/8; p2 = P(X=2) = 1/8 + 1/8 + 1/8 = 3/8
q Is it a Probability mass function?
Yes [since 0 ≤ pi ≤ 1 for all i =0, 1, 2, 3 and P(X=0) + P(X=1) + P(X=2) + P(X=3) = 1]
q Probability distribution: X = xi 0 1 2 3
P(X=xi) 1/8 3/8 3/8 1/8
Examples of Probability Distribution
4. QUESTION: From a lot of 12 items containing 3 defective items, a sample of 4 items are drawn at random
without replacement. Let a random variable X denote the number of defective items in the sample. Find the
probability distribution of X.

SOLUTION: The lot contains of 9 non-defective items. Since X denotes the number of defective items, x can
take the values 0, 1, 2, 3.
Examples of Probability Distribution
4. QUESTION: From a lot of 12 items containing 3 defective items, a sample of 4 items are drawn at random
without replacement. Let a random variable X denote the number of defective items in the sample. Find the
probability distribution of X.

SOLUTION: The lot contains of 9 non-defective items. Since X denotes the number of defective items, x can
take the values 0, 1, 2, 3. Four items drawn without replacement.
q For x = 0, p(x) = 9C4/12C4 = 14/55
q For x = 1, p(x) = 9C3 3C1 /12C4 = 28/55
q For x = 2, p(x) = 9C2 3C2 /12C4 = 12/55
q For x = 3, p(x) = 9C1 3C3 /12C4 = 1/55
Examples of Probability Distribution
4. QUESTION: From a lot of 12 items containing 3 defective items, a sample of 4 items are drawn at random
without replacement. Let a random variable X denote the number of defective items in the sample. Find the
probability distribution of X.

SOLUTION: The lot contains of 9 non-defective items. Since X denotes the number of defective items, x can
take the values 0, 1, 2, 3. Four items drawn without replacement.
q For x = 0, p(x) = 9C4/12C4 = 14/55
q For x = 1, p(x) = 9C3 3C1 /12C4 = 28/55
q For x = 2, p(x) = 9C2 3C2 /12C4 = 12/55
q For x = 3, p(x) = 9C1 3C3 /12C4 = 1/55

We have the following probability distribution:


x 0 1 2 3
P(X = x) 14/55 28/55 12/55 1/55
2. Distribution Function/Cumulative Distribution Function
• Let X be a random variable. Then the function F(x) defined by
F(x) = P(X ≤ x) , (-∞ < 𝑥 < ∞)
is called the distribution function of X.
• It has the following properties:
1. F(-∞) = 0, F(∞) = 1
2. 0 ≤ F(x) ≤ 1
3. If x1 < x2, then F(x1) ≤ F(x2)
4. P(a ≤ X ≤ b) = F(b) - F(a)

• F(x) is also called the cumulative probability distribution function of X.


Distribution Function/Cumulative Distribution Function
• In case of a discrete random variable X, the discrete distribution
function of X is defined by
F(x) = ∑xi , x (p(xi))
where p(xi) = P(X = xi) is the value of the probability distribution.
• For this definition, we have
p(xi) = P(X = xi) = F(xi) - F(xi-1)
3. Mean and Standard Deviation of a discrete Random variable
• Mean and Standard deviation of a discrete random variable X is defined as:
Mean =

Standard deviation =

• Mean is weighted average of values, where each value is weighted with its
probability.
• Standard deviation is “typical” distance of values from mean.
• Square of Standard Deviation is the Variance.
Mean and Variance of a Random variable
• Mean and Variance are also called the expected values, denoted by E[g(x)], where g(x)
is a random variable.

• Formula for mean = µx = E(X) = ∑0 𝑥𝑖 𝑝𝑖

• Formula for variance = Var(X) = (σx)2 = E[(x - µx)2] = ∑0 𝑥𝑖 − µx 2𝑝𝑖


• Check that:

Var(X) = σx2 = E(X2) - [E(X)]2 [using ∑0 𝑝𝑖 = 1]


Example of Discrete Probability Distribution
• QUESTION: A random variable X has the following probability distribution

q Find the value of c.


q Evaluate P(X<3), P(0<X<4).
q Determine the distribution function of X.
q Find the mean and variance of X.
• SOLUTION:
Example of Mean, Variance and SD of a Random Variable
• QUESTION: A fair 6-sided die is rolled. Number X rolled on a die has the probability distribution:

X = no. rolled 1 2 3 4 5 6
P(X=x) 1/6 1/6 1/6 1/6 1/6 1/6

What are the mean, variance, and standard deviation of X?


Example of Mean, Variance and SD of a Random Variable
• QUESTION: A fair 6-sided die is rolled. Number X rolled on a die has the probability distribution:

X = no. rolled 1 2 3 4 5 6
P(X=x) 1/6 1/6 1/6 1/6 1/6 1/6

What are the mean, variance, and standard deviation of X?


• SOLUTION:
q Mean = 21/6 = 3.5
q Variance = 2.92
q Standard deviation = 1.7 (square root of variance)
Example of Mean, Variance and SD of a Random Variable
• QUESTION: A fair 6-sided die is rolled. Number X rolled on a die has the probability distribution:

X = no. rolled 1 2 3 4 5 6
P(X=x) 1/6 1/6 1/6 1/6 1/6 1/6

What are the mean, variance, and standard deviation of X?


• SOLUTION:
q Mean = 21/6 = 3.5 (same as median 3.5 because symmetric)
q Variance = 2.92 (found by hand or with software)
q Standard deviation = 1.7 (square root of variance)
Probability Distribution

• A function that represents a discrete probability distribution is called a


probability mass function.

• A function that represents a continuous probability distribution is called a


probability density function.
4. Continuous random variable

• A random variable X is said to be a continuous random variable if it


takes all possible values in a given interval Ix.
• For example, weight, age, height, etc. are continuous random
variables.
5. Probability Density Function of a random variable
6. Cumulative distribution function (CDF)
Continuous random variable and Probability Distributions
• Random variable: X
• Cumulative distribution function (CDF): F(x) = P(X ≤ x), (-∞ < 𝑥 < ∞)
• Probability density function (pdf): f(x) = dF(x)/dx
• Rules governing continuous distributions:
• f(x) ≥ 0 Ɐ x
• ∫6 𝑓 𝑥 𝑑𝑥 = 1
7
8
• P(a ≤ X ≤ b) = F(b) – F(a) = ∫9 𝑓 𝑥 𝑑𝑥
9
• P(X=a) = P(a ≤ X ≤ a) = ∫9 𝑓 𝑥 𝑑𝑥 = 0 Ɐ a
• F(-∞) = 0, F(∞) = 1
• F(x) is a continuous function of x.
• f(x) = F’(x) at all points where F(x) is differentiable.
7. Mean and Variance of a Continuous Random variable
• If X is a continuous random variable and f(x) is the pdf of X, then we define
Mean = µx = ∫6 𝑥 𝑓 𝑥 𝑑𝑥
7

Variance = (σx)2 = ∫6 𝑥 − µx 2 𝑓 𝑥 𝑑𝑥
7

= ∫; 𝑥2 𝑓 𝑥 𝑑𝑥 − 2µx(∫; 𝑥𝑓 𝑥 𝑑𝑥) − (µx ) 2( ∫; 𝑓 𝑥 𝑑𝑥)
< < <

= ∫6 𝑥2 𝑓 𝑥 𝑑𝑥 - (µx)2 [using ∫6 𝑓 𝑥 𝑑𝑥 = 1]
7 7

• Square root of Variance is the Standard Deviation.


Example 1
• QUESTION: If the density function of a continuous random variable X is given by
f(x) = 0, x < 0
= ax, 0 ≤ x ≤ 2,
= (4-x)a, 2 ≤ x ≤ 4,
= 0, x > 4
Then
q Find the value of a
q Find the cdf of X
q Find P(X > 2.5)
Example 1
• SOLUTION:
(i) Since f(x) is a pdf, we have
=
∫6 𝑓 𝑥 𝑑𝑥 = 1, that is ∫> 𝑓 𝑥 𝑑𝑥 = 1
7

Note that f(x) is a continuous function. We have


@ =
∫> 𝑎𝑥𝑑𝑥 + ∫@ 𝑎 4 − 𝑥 𝑑𝑥 = 1
or 2a + 2a = 1,
or a = ¼
Example1
• SOLUTION (Contd.):

<
(ii) The cdf is F(x) = P (-∞ < x ≤ x) = ∫BC 𝑓 𝑥 𝑑𝑥
We have
x<0: F(x) = 0

< <
0 ≤ x ≤ 2: F(x) = ∫> 𝑑𝑥 = 𝑥2/8
=

@ <F
2 ≤ x ≤ 4: F(x) = ∫> (𝑥/4)𝑑𝑥 + ∫@ 4 − 𝑥 𝑑𝑥 = (8𝑥 − 𝑥2 − 8)/8
=

> @ = <
x > 4: F(x) = ∫BC 𝑓 𝑥 𝑑𝑥 + ∫> 𝑓 𝑥 𝑑𝑥 + ∫@ 𝑓 𝑥 𝑑𝑥 + ∫= 𝑓 𝑥 𝑑𝑥 = 1

= F
(iii) P(X> 2.5) = ∫@.K 4 − 𝑥 𝑑𝑥 = 9/32
=
Example 2
• QUESTION: The distribution function of a random variable is given by

1 − 1 + 𝑥 𝑒 B< , 𝑥 ≥ 0
F(x) = L
0, 𝑥 < 0
Find the corresponding density function of random variable X. Also find the mean and variance.
Q Q
• SOLUTION: We have f x = ( 𝐹 𝑥 = (1 − 1 + 𝑥 𝑒 B< )
Q< Q<

Q
= (1 − 𝑒 B< − 𝑥𝑒 B< ) = 0 − (−𝑒 B< ) − (𝑥 −𝑒 B< + 𝑒 B< ) = 𝑥𝑒 B<
Q<

𝑥𝑒 B< , 𝑥 ≥ 0
Hence, f(x) = L is the required density function.
0 , otherwise
C C
Mean = µx = ∫BC 𝑥𝑓 𝑥 𝑑𝑥 = ∫> 𝑥2𝑒 B< 𝑑𝑥 = … = 2
C C
Variance = ∫BC 𝑥2𝑓 𝑥 𝑑𝑥 − (µx)2 = ∫> 𝑥3𝑒 B< 𝑑𝑥 − (µx)2 = … = 6 – 22 = 2
EXPECTED VALUES OF CONTINUOUS RVS
C
• Expected Value: µx = E(X) = Mean = ∫BC 𝑥𝑓 𝑥 𝑑𝑥
C
• E[g(X)] = ∫BC 𝑔 𝑥 𝑓 𝑥 𝑑𝑥
• Variance: (σx)2 = Var(X)= E[(x - µx)2]
C
= ∫BC 𝑥 − µx 2 𝑓 𝑥 𝑑𝑥 = E(X2) – (µx)2 = E(X2) – [E(X)]2
For real numbers a,b:
C
• E[aX+b] = ∫BC 𝑎𝑥 + 𝑏 𝑓 𝑥 𝑑𝑥 = aE(X) + b = aµx + b

• Var [aX+b] = (σax+b)2 = E[(aX+b) – E(aX+b)]2 = a2 V(X) = a2 (σx)2


• Standard deviation = σax+b = |a|σx

You might also like