Sei sulla pagina 1di 43

Idea of Random Variable

• Consider a random experiment of tossing a fair


coin twice.
• Suppose a person plays a game where
– he wins Rs. 100 if he gets at least one head in
two tosses, and
– he loses Rs. 200 otherwise.
• If the person keeps playing the game for a long
time, is he going to gain some money or loose?
• What is the long term gain or loss to the person.
• The probability of getting at least one head in
two tosses is
P({HH, HT ,TH})=3/4.
• So he has 75% chance of winning Rs. 100.
• But, at the same time, he could lose Rs. 200 with
25% chance.
• Now how to incorporate this idea of his gain (or
loss) along with the probability.
• We define X as his gain or profit in the same
game, then
– X takes the value 100 when he wins.
– X takes the value -200 when he looses.
• Now each of these outcomes is a part of the
sample space.
• So each of them has some specific probability to
happen.
• We write it more systematically as follows –

• Using the corresponding probabilities, we write


the same idea as

• Or
• This variable X is called random variable.
• Random Variable changes its value depending on
what we get as an outcome of a random
experiment.
• Each value of a random variable is associated with
a probability.
• A random variable is a rule for assigning numbers
to the possible outcomes of an experiment.
Symbolically they are denoted by capital letters
such as X, Y, or Z with or without subscripts and
the values taken by them are denoted by x, y, or z.
Example
• Consider the random experiment of tossing
two coins
Sample space: S = {HH, HT, TH, TT}
X is number of Heads appeared
X is a random variable
X can take any value out of 0,1 and 2.

P(X =0) = P{TT} = 1/4,


P(X =1) = P{HT, TH} = 2/4,
P(X =2) = P{HH} = 1/4.
Example
• Consider the random experiment of tossing a fair die.
 Sample space: S = {1, 2, 3, 4, 5, 6}
 Let X be the value on the upper face of the die
 X could be 1, 2, 3, 4, 5 or 6
 The event of “getting 1” is same as saying “X=1”

So,
 P(getting 1) = P(X=1) = 1/6
 P(X=2) =1/6,
 P(X=3) = 1/6,
 P(X=4) = 1/6,
 P(X=5) = 1/6,
 P(X=6) = 1/6
Example
• Consider the random experiment of tossing a
fair coin thrice.
Sample space
S={HHH, HHT, HTH, THH, HTT, THT, TTH, TTT}
X: no. of heads appearing in three tosses
X is a random variable.
X could be 0, 1, 2, or 3.

P(X = 0) = P(TTT) = 1/8


P(X=1) = P(HTT, THT, TTH) = 3/8
P(X=2) = P(HHT, HTH, THH) = 3/8
P(X=3) = P(HHH) = 1/8
Same Example
• Consider the same example again.
S = {HHH, HHT, HTH, THH, HTT, THT, TTH, TTT}
X: no. of heads appearing in three tosses
X belongs to {0, 1, 2, 3}
Event of “getting at least one head” is same as “X ≥ 1”

– P(X ≥ 1) = P(HHH, HHT, HTH, THH, HTT, THT, TTH) = 7/8


– P(X ≤ 1) = P(HTT, THT, TTH, TTT) = 4/8
– P(X < 2) = P(HTT, THT, TTH, TTT) = 4/8
– P(X ≤ 2) = P(HHT, HTH, THH, HTT, THT, TTH, TTT)= 7/8
• In general,
– P(X = x) is the probability that X takes on the value
x and
– P(X ≤ x) is the probability that X takes on a value
that is less than or equal to x
– As sum of all probabilities is 1 we have:
• P(X ≤ x) = 1 – P(X > x)
• P(X ≥ x) = 1 – P(X < x)
Types of Random Variables
• Random Variables are of two types:
– Discrete Random Variable
– Continuous Random Variable

• Discrete Random Variable takes only a countable (finite


or countably infinite) number of values.
• no. of accounts opened,
• no. of cars sold,
• Friday night attendance at a cinema,
• no. of defective bulbs in a box, etc.
• Continuous Random Variable takes on any values within
an interval.
• weight of fertilizer packed in a bag,
• amount of sugar in an orange,
• time required to run a mile,
• price of a stock, etc.

• Continuous random variable is usually a measurement.


• It can take an uncountably infinite number of values.
Discrete random variable
Probability Distribution of a Discrete Random Variable
• Also called as Probability Mass Function (pmf).
• It is a mutually exclusive listing of all possible values of
the discrete random variable along with corresponding
probabilities.
All possible values of random variable X

Corresponding probabilities

• 0≤p(x)≤1 for all x.


• Together they sum up to 1.
Example:
• X is the number of heads appearing in two coins tossing
experiment.
• X is a discrete random variable having the probability distribution
probabilit y mass function of X is
1 / 4, if x  0

p( x)  2 / 4, if x  1
1 / 4, if x  2

0.6
Probabilities

0.5

0.4

0.3

0.2

0.1

0
x=0 x=1 x=2
• Example:
• In throwing a die, X is the value that appeared
• X is a discrete random variable having the probability distribution

probabilit y mass function of X is


p ( x)  1 / 6, if x  1,2,3,4,5,6.

0.2
Probabilities

0.15

0.1

0.05

0
x=1 x=2 x=3 x=4 x=5 x=6
• Recall the first example where X is the random variable
denoting the gain and is given by

• In tabular format, the probability distribution of X is


given by

• Probability mass function of X is written as


3 / 4 if X  100
p( x)  
1 / 4 if X   200
• Sometimes, the pmf can be expressed as a
mathematical function.
Example:
• X denotes the number of tosses needed to get
the first tail.
• X is a discrete random variable.
• So the random variable X has the probability distribution
probabilit y mass function of X is
 1/ 2 if x  1
1 / 22 if x  2

p( x)  
 1 / 2 3
if x  3
  

• probability mass function p(x) can also be written as

• Also, 1
  x 2 3
1 1 1 1
 p ( x )    
x 1  2 
   
2 2 2
      2 1
1
x 1
1
2
Example:
• Consider the previous example again.
• The discrete random variable has the pmf

• The probability of getting a tail in less than 3 tosses is


given by
• p(X < 3) = p(X=1) + p(X=2)
= p(1) + p(2)
= (1/2) + (1/2)2
=1/2 + 1/4
= 3/4
Example:
• Suppose an individual purchases two electronic
components
• Each of which may either be defective or acceptable.
• Sample space: S = {DD, DA, AD, AA}
• Given that P(DD) = 0.09, P(DA) = 0.21,
P(AD) = 0.21, P(AA) = 0.49.
• X: number of acceptable components.
• Obtain the probability distribution of X.
• What is the probability of getting at least one
acceptable components?
– Ans: 0.91
Exercise
After watching a number of children playing games at a
video arcade, a statistics practitioner estimated the following
probability distribution of X, the number of games per visit.

X 1 2 3 4 5 6 7
p(X) .05 .15 .15 .25 .20 .10 .10

a. What is the probability that a child will play more than


four games?
b. What is the probability that a child will play at least two
games?

Sol: a) .40 b).95


Ex.1 Determine whether the following is a valid probability
distribution
X 0 1 2 3
p(x) .1 .3 .4 .1

Ex.2 The random variable X has the following prob. distribution


X -3 2 6 8
p(x) .2 .3 .4 .1

Find the following probabilities


a) P(X>0)
b) P(X≥1)
c) P(X≥2)
d) P(2≤X≤5)
Sol: a).8 b).8 c).8 d).3
Expectation of a Discrete Random Variable
• “some sort of average” of all the values that the random
variable takes.

• Acts as the center of its distribution.

• Concept analogous to the physical concept of the center


of gravity of a distribution of mass.

• The expected value of a discrete random variable X is a


weighted average of the possible values that the random
variable can take. Here probability values act as weight.
• The mean of a random variable provides the long-run
average of the variable, or the expected average
outcome over many observations

• X is a discrete random variable having the pmf p(x)


• Expectation or Expected value or mean of X is given by

• Recall the first example where X is the random variable


denoting the gain

3 / 4 if x  100
• pmf of X is p ( x)  
1 / 4 if x   200
Expected gain of the person is
E(X) = (100)(3/4) + (-200)(1/4) = 25 Rupees

Laws of Expected Value


In general, if a and b are constants; and X and Y are
random variables, then we have

• E(a) = a

• E(aX) = aE(X)

• E(ax + bY) = aE(X) + bE(Y)

• E(X+a)=E(X)+a
Example: Suppose X is a discrete random variable having
following probability distribution
x -2 -1 0 1
p(x) 0.4 k 0.2 0.3
Find E(X).
– Ans: -0.6
Example:The number of pizzas delivered to university students
each month is a random variable with following probability
distribution.
X 0 1 2 3
P(x) .1 .3 .4 .2
Determine the mean number of pizzas delivered to students each
Month
Ans: 1.7
Example
– Consider the random experiment of tossing a fair
coin.
– What is the expected number of tosses needed to get
the first tail.
– Recall the example discussed earlier.
– Random variable X is the number of tosses needed to
get the first tail.
– pmf of X is given as

– We have to find E(X) = ∑ xi p(xi)


– Ans: 2
Variance of a Discrete Random
Variable
• The idea of center is not enough to summarize a
probability distribution.
• We need some idea of variability also.
• Variance of a random variable X is defined as

Var ( X )   2
X 
 E  X  E ( X )
2

E X   E ( X )
2 2

• It is the expected squared deviation of possible


values of X from its mean.
E ( X 2 )   x 2 p( x) and E ( X )   x p( x),
x x

• where p(x) is the pmf of X.


• Note that Variance is always non-negative.
• Standard Deviation of X = σx = √[Var (X)]
Laws of Variance
If a and b are constants, X and Y are random variables,
then we have
– Var(a) = V(a)=0,
– Var(aX) = a2Var(X),
– Var(X+a)=Var(X),
– Var(aX + bY) = a2Var(X) + b2Var(Y) + 2ab σXY
– σXY is the covariance between X and Y.
(will be discussed later)
Example: Suppose X is a discrete random variable having
following probability distribution
x -2 -1 0 1
p(x) 0.4 k 0.2 0.3
– Find Var(X).
– Ans: 1.64
Example: The number of pizzas delivered to university students
each month is a random variable with following probability
distribution.
X 0 1 2 3
P(x) .1 .3 .4 .2
Determine the variance of the number of pizzas delivered
Ans: .81
EXERCISE
The monthly sales at a computer store have a mean of $25,000
and a standard deviation of $4,000. Profits are calculated by
multiplying sales by 30% and subtracting fixed costs of $6,000.
Find the mean and standard deviation of monthly profits
Solution
Relationship between profit and sales:
Profit=.30(Sales)-6,000
Expected or Mean profit is
E(Profit)=E[.30(Sales)-6,000]
E(Profit)=.30E(Sales)-6,000=.30(25,000)-6,000=1,500
The Variance is
V(Profit)=V[.30(Sales)-6,000]=(.3)2 V(Sales)=.09(4,000)2
=1,440,000
Thus, standard deviation of monthly profits is
σProfit = √1,440,000 = $1,200
Exercise

You have a choice of receiving $1000 in cash or receiving a


beautiful painting from your grandmother. However, the
actual value of the painting is uncertain. You are told that the
painting has a 20% chance of being worth $2,000, a 50%
chance of being worth $1,000, and a 30% chance of being
worth $500. What should you do?
Joint Probability Distribution of two Discrete
Random Variables
• Let X and Y be two discrete random variable
• Joint probability distribution or joint probability mass
function of X and Y is
Possible values of Y
X Y b1 b2 ……… bm Total
Possible values of X
a1 p11 p12 ……… p1m p1.
a2 p21 p22 ……… p2m p2.
. . . . . .
. . . . . .
an pn1 pn2 ……… pnm pn. Marginal pmf of X
Total p.1 p.2 ……… p.m 1 Marginal pmf of Y

pij  P( X  ai and Y  b j ), i  1,2,, n; j  1,2,, m.


Example:
• A fair coin is tossed once.
• Let X denote the number of heads.
• Y denote the number of tails.
• Find the joint probability mass function of X and Y.
• Ans Y
X 0 1 Total
0 0 1/2 1/2
1 1/2 0 1/2
Total 1/2 1/2 1
Example:
• A fair coin is tossed three times independently.
• X: no. of heads on the first toss; Y: total no. of heads.
• Find the joint pmf of X and Y.
• Ans Y
X 0 1 2 3 Total
0 1/8 2/8 1/8 0 4/8
1 0 1/8 2/8 1/8 4/8
Total 1/8 3/8 3/8 1/8 1
• Marginal probability distribution of X is
X 0 1
P(x) 4/8 4/8
• Marginal probability distribution of Y is
Y 0 1 2 3
P(y) 1/8 3/8 3/8 1/8
Covariance between two Discrete
Random Variables
• X and Y are two discrete random variables.
• Covariance is a measure of relationship between X and Y.
• It is given by
 XY  E { X  E ( X )}{Y  E (Y )}
 E ( XY )  E ( X ) E (Y )

• Here, n m
E ( XY )   ai b j pij
i 1 j 1
n m
E ( X )   ai pi , E (Y )   b j p j
i 1 j 1
Illustration

Xavier and David are real estate agents. Let X


denote the number of houses that Xavier will
sell in a month and let Y denote the number of
houses that David will sell in a month. An
analysis of their past monthly performances has
the following joint probabilities.
Example:
• Consider the following bivariate distribution
X
Y 0 1 2 Total
0 .12 .42 .06 .6
1 .21 .06 .03 .3
2 .07 .02 .01 .1
Total .4 .5 .1 1
Compute
a) E(X) b) E(Y) c) V(X) d) V(Y) e) COV(X,Y)
f) E(X+Y) g) V(X+Y)

Sol: a) .7 b) .5 c) .41 d) .45 e) -.15 f) 1.2 g) .56


Independence of two Discrete Random Variables
• Two discrete random variables X and Y are said
to be independent of each other when
• pij = (pi) (pj) for i = 1,2,…,n and j = 1,2,…,m.
• When X and Y are independent, then covariance
between them is zero.
• i.e., σXY = 0.
• This implies that when X and Y are independent,
• E(XY) = E(X).E(Y)
• An investor invests 40% of his money in stock A and
60% in stock B. Based on the information given in the
table below
Stock A Stock B
E(A) =9.5% E(B)=7.6%
SD(A)=12.93% SD(B)= 8.2%
Cov (A,B)= 18.60
Compute:
a) Expected return of the portfolio
b) Portfolio variance
Ans: a) 8.36% b)59.89 (SD= 7.74%)
Continuous Random Variable
Probability Distribution of a Continuous Random Variable
• X is continuous random variable.
• A continuous random variable X can assume all possible
values between a given interval say a  x  b.
• We can not assign a probability to each possible value.
• Point probability p(x) becomes meaningless in this case.
• Replace the pmf p, by a function f defined for all values of
a  x  b.
• This probability distribution function f of a continuous
random variable is known as probability density function
(pdf)

Potrebbero piacerti anche