You are on page 1of 21

DISTRIBUTIONS/

RANDOM VARIABLES

Random Variables

36

Random variable: Response of random experiments taking

different numerical values with certain probabilities.


The probability models describe the random variables.
EXAMPLES

Number of car crashes in Ahmedabad tomorrow


Amount of rainfall in India next month
Salary offered to a PGPX passout

Length of time a cancer patient survives after detection

Random Variables

37

Random variable: Response of random experiments taking

different numerical values with certain probabilities.


The probability models describe the random variables.
EXAMPLES

Number of car crashes in Ahmedabad tomorrow


Amount of rainfall in India next month
Salary offered to a PGPX passout

Length of time a cancer patient survives after detection

Discrete Random Variables

38

Takes finitely/countably many values: typically integers


All examples that we are going to look at in this class are

numbers of something:
Number of earthquakes in Japan in one year
Number of errors in each page of a text book
Number of heads in 1000 coin tosses

39

Formal Description
Value (x)

Probability (p(x))

p(2)

Total

p(1)

The probability function above is called probability mass function (p.m.f.)


Values can, of course, be any other set of integers.

Distribution function

40

The distribution function for a discrete random variable

looks like a step, and hence is called a step function.


Example
p(1) = 0.1, p(2) = 0.2 and p(5) = 0.7.
What is the distribution function?

41

Expectation

Expectation of a random variable is the weighted average

of its values, weighted by the corresponding probabilities:

The expectation (or mean/average) of a discrete

random variable X taking values x1, x2, , xn with


probabilities p(x1), p(x2), , p(xn) is given by the
weighted average

E(X) xip(xi ).
n

i 1

Examples

42

1. p(1) = 0.1, p(2) = 0.2 and p(5) = 0.7.

2. I usually buy either one or two packets of biscuits each

time I go to the store with probabilities 0.4 and 0.4,


respectively. The packets cost Rs.10 each. However,
sometimes, (with 0.2 probability,) there is a sale when
the packets are sold at Rs.8 per pack, when I buy 10
packs. What is my expected cost?

43

Properties (True for all variables)

1. If X is a random variable, and a and b are two constants,

then
E(aX) = aE(X), E(b+X) = b+E(X).
E.g. If $1 = Rs. a, then if expected salary of a PGPX passout
in US$ is $E(X), in Rs. it is Rs.aE(X). Then again, if everyone
is paid a joining bonus $b, salary is $(b+aE(X)).
2. If X and Y are two random variables, then
E(X+Y) = E(X) + E(Y).
E.g. Expected sum of salary of two friends is sum of their
expectations.

44

Variance

The variance of a random variable measures its spread.


For a discrete random variable X, variance is given by

the weighted average of the squared deviations from


the expectation
V(X) (xi - E(X)) p(xi ) xi2p(xi ) E(X)2
n

i1

i 1

Examples: Compute the variance for our two examples.

Properties (True for all variables)

45

1. If X is a random variable, and a and b are two constants,

then
V(aX) = a2V(X), V(b+X) = V(X).
2. If X and Y are two independent random variables, then
V(X+Y) = V(X) + V(Y).
Otherwise there will be a cross-term. Lets not bother about
that.

Special Random Variables

46

When I repeat an exercise which results in only two

possible outcomes, how do I obtain the probability


distribution of number of occurrences of what I want?

Examples:
Probability distribution of the number of double heads in
24 throws of two fair dice.
Probability distribution of number of children out of 100
randomly chosen kids of age 10 who have dropped out of
school.

Binomial Random Variable

47

A Bernoulli trial is a random event with only two possible

outcomes, say success and failure, with fixed


probabilities.
We get to define success!
A binomial random variable is the number of successes
(or failures) in a fixed number of independent Bernoulli
trials.

48

Binomial(n,p)

n independent trials with probability of success p


X = number of success

n x
n x
P(X=x) = p (1 p) , x = 0, 1, 2, ..., n
x
E(X) = np

Var(X) = np(1-p)

p.m.f.

EXCEL: BINOMDIST(x,n,p,TRUE/FALSE)
c.d.f.

Example

49

Example

50

Let us assume that the chance of hitting yellow part is 0.1 in

one shot, and that there is no improvement in performance


over trials.
What is the probability distribution of the number of hits to the
yellow part in 10 trials?
What is the probability that yellow is not hit in any of the 10
attempts? What is the probability that at least 3 hits were
successful?

Additive Property

If X~Bin(n, p) and Y~Bin(m, p)

are independent, then


X+Y~Bin(n+m, p).

Example: In10 trials, Number

of hits has distribution Bin(10,


0.1).
Try 5 more times. Number of
hits now has distribution Bin(15,
0.1).
Note: p has to be the same,
and independence is needed.

51

Poisson Distribution
Used to model rare events

52

Is an approximation of a Bin(n,p) random variable with

large n and small p such than np = is moderate

X = number of events: rate

e
P(X=x) =

x
x!

x = 0, 1, 2, ...

E(X) = , Var(X) =
EXCEL: POISSON(x,,TRUE/FALSE)

Example

53

Assume that for a particular book the chance of any printing

error in a page is 0.0001, independently of the other pages.


What is the probability that there are at least two errors in the
first 50 pages of the book? Assume a Poisson distribution.

Additive Property

54

If X~Poisson(1) and Y~Poisson(2) are independent, then

X+Y~Poisson(1+2).

Note: Independence is needed.

Example

55

What is the probability that there is one error in the first 50

pages and another in the next 50?

What is the probability that there is one error in page 1-60

and none in pages 41-100?