0% found this document useful (0 votes)
11 views

Simulation

The document provides an overview of random variables, including their definitions, types (discrete and continuous), and key concepts such as probability mass functions (pmf), cumulative distribution functions (cdf), expectation, variance, and covariance. It explains how to calculate expected values and variances for various scenarios, including examples involving coin tosses and job profits. Additionally, it discusses the properties of joint distributions for both discrete and continuous random variables.

Uploaded by

yeonni42
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Simulation

The document provides an overview of random variables, including their definitions, types (discrete and continuous), and key concepts such as probability mass functions (pmf), cumulative distribution functions (cdf), expectation, variance, and covariance. It explains how to calculate expected values and variances for various scenarios, including examples involving coin tosses and job profits. Additionally, it discusses the properties of joint distributions for both discrete and continuous random variables.

Uploaded by

yeonni42
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

IEOR 4404: Simulation

Probability Review (con’d)


Random Variables
• Random variable summarizes or represents the outcomes
with numerical values
• The realized value of a random variable is random
• To specify a random variable, identify its range of values
and probability assigned to each value

numeric value
random associated
outcome
experiment with each
outcome
Random Variables
• Random variable summarizes or represents the outcomes
with numerical values
• The realized value of a random variable is random
• To specify a random variable, identify its range of values
and probability assigned to each value

Coin Toss H or T X = 2 if Heads;


X = 0 if Tails
Random Variables
• More formally: a random variable is a function that assigns a
numerical value to each outcome in the sample space

• A random variable is discrete if the range of values that it


takes is finite or ``can be enumerated’’

• Possible range of values:


• {0, 1} (coin toss example)
• {0.5, 2, π, e}
• {0, 1, 2, 3, 4, …}
Random Variables
• Probability mass function (pmf) p(a) of a discrete random
variable X is p(a) = P(X = a), for each possible value a of X

• p(a) can be positive for at most a countable number of values


of a – if X takes values x1, x2, x3, …, then p(xi) > 0, i = 1, 2, …
and p(x) = 0 for all other values of x

• Example. Suppose a company hired 6 employees recently and


let X be the number of females in the group. Further suppose
that P(X = 1) = 0.1, P(X = 2) = 0.3, P(X = 3) = 0.5, P(X = 4) =
0.05, P(X = 5) = P(X = 6) = 0.025
Random Variables
• Probability mass function (pmf) p(a) of a discrete random
variable X is p(a) = P(X = a), for each possible value a of X

• p(a) can be positive for at most a countable number of values


of a – if X takes values x1, x2, x3, …, then p(xi) > 0, i = 1, 2, …
and p(x) = 0 for all other values of x

• Example. Suppose a company hired 6 employees recently and


let X be the number of females in the group. Further suppose
that P(X = 1) = 0.1, P(X = 2) = 0.3, P(X = 3) = 0.5, P(X = 4) =
0.05, P(X = 5) = P(X = 6) = 0.025

• The pmf of X is specified by p(1) = 0.1, p(2) = 0.3, p(3) = 0.5,


p(4) = 0.05, p(5) = p(6) = 0.025, and p(x) = 0 for all other
values of x
Random Variables
• Can also define the cumulative distribution function (cdf) of a
random variable X as F(x) = P(X ≤ x) = Σa≤xP(X = a) = Σa≤xp(a)
Random Variables
• Can also define the cumulative distribution function (cdf) of a
random variable X as F(x) = P(X ≤ x) = Σa≤xP(X = a) = Σa≤xp(a)
• The cdf of X in the previous example:
F(x) = 0 for x < 1, 0.1 for 1≤x<2, 0.4 for 2≤x<3, 0.9 for 3≤x<4,
0.95 for 4≤x<5, 0.975 for 5≤x<6, and 1 for x≥6

1
0.95 0.975
0.9

0.4

0.1
0 1 2 3 4 5 6
Random Variables
• The pmf/cdf of a random variable X specifies it completely

• Knowing pmf is equivalent to knowing cdf, which is equivalent


to specifying X completely
Random Variables
• The joint probability mass function of two (discrete) random
variables X and Y is p(x,y) = P(X=x, Y=y)

• Given the joint pmf of two (discrete) random variables X and


Y is p(x,y) = P(X=x, Y=y), the marginal pmfs are given by

pX(x) = P(X=x) = ΣyP(X=x, Y=y) = Σyp(x,y)

and

pY(y) = P(Y=y) = ΣxP(X=x, Y=y) = Σxp(x,y)


Random Variables
• Definition: two discrete random variables X and Y are
independent if for any x and y, P(X=x, Y=y) = P(X=x)P(Y=y)

• In other words, p(x, y) = pX(x)pY(y) for all x and y


Expectation of Random Variables
• Arguably the most important characteristic of a random
variable is its expected value/mean/expectation

• Definition: the expected value of a discrete random variable X


is defined by E[X] = ΣxxP(X = x) = Σxxp(x)
Expectation of Random Variables
• Example. What is the expected value of the outcome of a fair
die roll?
Expectation of Random Variables
• Example. What is the expected value of the outcome of a fair
die roll?
• E[X] = 1×1/6 + 2×1/6 + 3×1/6 + 4×1/6 + 5×1/6 + 6×1/6 = 7/2
Expectation of Random Variables
• Example. What is the expected value of the outcome of a fair
die roll?
• E[X] = 1×1/6 + 2×1/6 + 3×1/6 + 4×1/6 + 5×1/6 + 6×1/6 = 7/2

• Example. What is the expected value of the number of coin


tosses until we see a Heads, for a biased coin of coming up
Heads with probability 0.3?
Expectation of Random Variables
• Example. What is the expected value of the outcome of a fair
die roll?
• E[X] = 1×1/6 + 2×1/6 + 3×1/6 + 4×1/6 + 5×1/6 + 6×1/6 = 7/2

• Example. What is the expected value of the number of coin


tosses until we see a Heads, for a biased coin of coming up
Heads with probability 0.3?
• Let X = the number of tosses until Heads. Then P(X=1)=0.3,
P(X=2)=0.7×0.3, …, P(X=k) = 0.7k-1×0.3, …
• E[X] = 1×P(X=1) + 2×P(X=2) + 3×P(X=3) + … = Σk k×0.7k-1×0.3 =
… = 1/0.3 = 10/3
Expectation of Random Variables
• E[X+Y] = E[X] + E[Y] is true in general

• Can generalize the argument to show that for discrete random


variables X1, X2, …, Xn, E[X1+X2+…+Xn] = E[X1]+…+E[Xn]

• Example. A construction firm has recently sent in bids for 3 jobs


worth (in profits) 10, 20, and 40 thousand dollars respectively. If the
probabilities of winning the jobs are respectively 0.2, 0.8 and 0.3,
what is the firm’s expected total profit?
Expectation of Random Variables
• E[X+Y] = E[X] + E[Y] is true in general

• Can generalize the argument to show that for discrete random


variables X1, X2, …, Xn, E[X1+X2+…+Xn] = E[X1]+…+E[Xn]

• Example. A construction firm has recently sent in bids for 3 jobs


worth (in profits) 10, 20, and 40 thousand dollars respectively. If the
probabilities of winning the jobs are respectively 0.2, 0.8 and 0.3,
what is the firm’s expected total profit?

• Solution. Let Xi, i = 1, 2, 3 denote the firm’s profit from job i, then
total profit = X1 + X2 + X3. So E[total profit] = E[X1 + X2 + X3] = E[X1] +
E[X2] + E[X3].
• E[X1] = 10×0.2+0×0.8 = 2; E[X2] = 16 and E[X3] = 12
• E[X1 + X2 + X3] = 2 + 16 + 12 = 30
Expectation of Random Variables
• Example. What is the expected value of the number of times
that in a thoroughly shuffled deck of 52 cards two adjacent
cards are of the same rank (two aces, two kings, etc)?
Expectation of Random Variables
• Example. What is the expected value of the number of times
that in a thoroughly shuffled deck of 52 cards two adjacent
cards are of the same rank (two aces, two kings, etc)?

• Solution. Let Xi be 1 if the cards in position i and i+1 are of the


same rank, and 0 otherwise. Then the quantity of interest is
E[X1 + X2 + … + X51] = E[X1] + … + E[X51].

• E[X1] = 1×3/51+0×48/51 = 3/51


• Similarly, E[Xi] = 3/51
• E[X1 + X2 + … + X51] = 3/51×51 = 3
Expectations of Functions of RV
• Often may be interested in expectation of a function of a
random variable

• In general:
𝐸[𝑓(𝑋)] = ෍ 𝑓 𝑥 𝑃 𝑋 = 𝑥 = ෍ 𝑓(𝑥)𝑝(𝑥)
𝑥 𝑥
Expectations of Functions of RV
• Often may be interested in expectation of a function of a
random variable

• In general:
𝐸[𝑓(𝑋)] = ෍ 𝑓 𝑥 𝑃 𝑋 = 𝑥 = ෍ 𝑓(𝑥)𝑝(𝑥)
𝑥 𝑥

• Example. R.v. X has the p.m.f p(2) = 0.2, p(1) = 0.5, p(-1) = 0.3.
Compute E[X2].
Expectations of Functions of RV
• Often may be interested in expectation of a function of a
random variable

• In general:
𝐸[𝑓(𝑋)] = ෍ 𝑓 𝑥 𝑃 𝑋 = 𝑥 = ෍ 𝑓(𝑥)𝑝(𝑥)
𝑥 𝑥

• Example. R.v. X has the p.m.f p(2) = 0.2, p(1) = 0.5, p(-1) = 0.3.
Compute E[X2].

• Solution. E[X2] = Σx x2P(X = x) = 22P(X = 2) + 12P(X = 1) + (-


1)2P(X = -1) = 1.6
Expectations of Functions of RV
• Also, for any constant 𝑎 and 𝑏,

𝐸[𝑎𝑋 + 𝑏] = 𝑎𝐸[𝑋] + 𝑏

• Question: is E[f(X)] = f(E[X]) in general? E.g., is E[X 2] = (E[X])2?


Variance of Random Variables
• Write μ = E[X]

• Definition: Variance of X, denoted by Var(X), is defined to be


Var(X) = E[(X-μ)2]

• Equivalent formula for variance: Var(X) = E[X2]-(E[X])2

• Standard deviation = Var(X)


Properties of Variance
• Var(aX + b) = a2Var(X)

• Variance of a constant is 0

• Is it true that Var(X + Y) = Var(X) + Var(Y)?


Covariance
• Definition: the covariance of two random variables X and Y is
defined to be
Cov(X, Y) = E[(X – μX)(Y – μY)],
where μX = E[X] and μY = E[Y]

• Covariance measures how two random variables tend to


“move” together

• Useful properties:
– Cov(X, Y) = E[XY] – E[X]E[Y]
– Cov(X, Y) = Cov(Y, X)
– Cov(X, X) = Var(X)
– Cov(aX, Y) = aCov(X, Y)
– Cov(X + Z, Y) = Cov(X, Y) + Cov(Z, Y)
– Var(X + Y) = Var(X) + Var(Y) + 2Cov(X, Y)
Covariance
• Definition: Correlation between X and Y is
Covariance
• If X and Y are independent, Cov(X, Y) = 0, and E[XY] = E[X]E[Y]

• If X and Y are independent, then Var(X + Y) = Var(X) + Var(Y)

• Question: X and Y are independent. What’re the expectation


and variance of X – Y?
Probability Density Function
• Definition. The random variable X is continuous if there
exists a nonnegative function f(x) (defined on the whole
real line) so that f(x) integrates to 1, i.e.,

and for every real number a,

• In this case, f(x) is called the probability density function


(pdf) of the random variable X
• The function F(a) = P(X ≤ a) is called the cumulative
distribution function (cdf) of X
Some Discussion
• Remark 1. f(x) is the derivative of F(a) = P(X ≤ a)
• Remark 2. Since F is differentiable, it is a continuous
function. In particular, it has no “jumps” like the cdf of
discrete random variables
• Remark 3. f(x) is NOT P(X = x) (= 0)
• Remark 4. One way to make sense of f(x) is as follows

for small Δx; f(x) itself is NOT a probability, but it does


measure how likely it is to find a point near x
Joint Probability Density Function
• Similar to the discrete case, we can define joint
distributions for continuous random variables

• Definition. Continuous random variables X and Y have a


joint pdf f(x, y) if f(x, y) ≥ 0 for all x and y,

and for all −∞ < 𝑎, 𝑏 < ∞,


𝑏 𝑎
ℙ 𝑋 ≤ 𝑎, 𝑌 ≤ 𝑏 = න න 𝑓(𝑥, 𝑦) 𝑑𝑥 𝑑𝑦
−∞ −∞
Independent Continuous RV
• Definition (Marginal pdf). Let X and Y be continuous random
variables with joint pdf f(x, y). The marginal pdf fX of X is given by

• and the marginal pdf fY of Y is given by

• Can show that (similar for Y)


𝑥
𝑃 𝑋 ≤ 𝑥 = න 𝑓𝑋 𝑢 𝑑𝑢
−∞
• Definition (Independence). Continuous rv X and Y are
independent if for any x and y,
P(X ≤ x, Y ≤ y) = P(X ≤ x)P(Y ≤ y)
or equivalently, for any x and y not at the “boundaries” of
discontinuity
f(x, y) = fX(x)fY(y)
Expectation of Continuous RV
• Recall the definition of expectation for discrete rv
• Suppose X takes values x1, x2, … and P(X = xi) = pi
• Then E[X] = p1x1 + p2x2 + …
• Definition. The expectation of a continuous random
variable X with pdf f(x) is defined by

• Remark. f(x)dx serves as the continuous analog of pi in


the discrete case
• Variance is also defined the same as in the discrete case
Properties of Expectation and Variance
• Similarly, the covariance between two continuous r.v.’s X and Y
is
𝐶𝑜𝑣 𝑋, 𝑌 = 𝐸 𝑋 − 𝜇𝑋 𝑌 − 𝜇𝑌

• All properties of expectation, variance and covariance for


discrete r.v.’s hold also for continuous r.v.’s. For example,
• E[X+Y] = E[X] + E[Y]
• E[aX+b] = aE[X] + b
• Var(aX+b) = a2Var(X)
• Cov(X, Y) = E[(X-μX)(Y-μY)] = E[XY] – E[X]E[Y]
• Var(X+Y) = Var(X) + Var(Y) + 2Cov(X, Y)
• If X and Y are independent, then E[XY] = E[X]E[Y], Cov(X, Y) = 0,
and Var(X + Y) = Var(X) + Var(Y)
Conditional Probabilities
• For a pair of joint discrete r.v.’s X and Y, with pmf 𝑝(𝑥, 𝑦), the
conditional pmf of X given Y=y is
𝑝 𝑥, 𝑦
𝑝𝑋|𝑌 𝑥 𝑦 = 𝑃(𝑋 = 𝑥|𝑌 = 𝑦) =
𝑝𝑌 𝑦

• The conditional cdf of X given Y=y is


σ𝑎≤𝑥 𝑝 𝑎, 𝑦
𝐹𝑋|𝑌 𝑥 𝑦 = 𝑃 𝑋 ≤ 𝑥 𝑌 = 𝑦 = ෍ 𝑝𝑋|𝑌 𝑎𝑦 =
𝑝𝑌 𝑦
𝑎≤𝑥
Conditional Probabilities
• For a pair of joint continuous r.v.’s X and Y, with pdf 𝑓(𝑥, 𝑦), the
conditional pdf of X given Y=y is
𝑓 𝑥, 𝑦
𝑓𝑋|𝑌 𝑥 𝑦 =
𝑓𝑌 𝑦

• The conditional cdf of X given Y=y is


𝑥 𝑥
‫׬‬−∞ 𝑓 𝑢, 𝑦 𝑑𝑢
𝐹𝑋|𝑌 𝑥 𝑦 = න 𝑓𝑋|𝑌 𝑢 𝑦 𝑑𝑢 =
−∞ 𝑓𝑌 𝑦
Conditional Probabilities
• For two r.v.’s 𝑋 and 𝑌, we have

𝐸 𝑌 =𝐸 𝐸 𝑌𝑋

This is the law of total probability

2
• Define 𝑉𝑎𝑟 𝑌 𝑋 = 𝐸[ 𝑌 − 𝐸 𝑌 𝑋 |𝑋]. We also have

𝑉𝑎𝑟 𝑌 = 𝑉𝑎𝑟 𝐸 𝑌 𝑋 + 𝐸[𝑉𝑎𝑟 𝑌 𝑋 ]

This is the variance decomposition


Discrete Uniform Random Variable
• A discrete uniform random variable X on {a, a+1, …, b} is
equally likely to be any x in {a, a+1, …, b}

• E.g., fair die roll; fair coin toss

• P(X = x) = 1/(b-a+1), x = a, a+1, …, b

• E[X]; Var(X)
Bernoulli Random Variables
• A Bernoulli random variable is used to indicate the
success/failure of an event, with a success probability
p; e.g., a coin toss
• Sometimes called Bernoulli trial
• P(X = 1) = p; P(X = 0) = 1-p

1 0
Bernoulli Random Variables
• A Bernoulli random variable is used to indicate the
success/failure of an event, with a success probability
p; e.g., a coin toss
• Sometimes called Bernoulli trial
• P(X = 1) = p; P(X = 0) = 1-p

1 0
• E[X] = p
• Var(X) = p(1 – p)
• Notation: Ber(p)
Binomial Distribution
• Consider n independent repetitions of a Bernoulli trial
with success probability p
• X denotes the number of successes in n trials
𝑛
• Pmf: P(X = k) = p(k) = 𝑘
pk(1-p)n-k, k=0,…,n
Binomial Distribution
• Consider n independent repetitions of a Bernoulli trial
with success probability p
• X denotes the number of successes in n trials
𝑛
• Pmf: P(X = k) = p(k) = 𝑘
pk(1-p)n-k, k=0,…,n
• E[X]=np
• Var(X)=np(1-p)
• Denoted by Bin(n, p)
Geometric Distribution
• X = # of Bernoulli trials with success probability p until
we see a first success
• Pmf: P(X = k) = (1-p)k-1p, k = 1, 2, …
• E[X] = 1/p
• Var(X) = (1-p)/p2
• Denoted by Geo(p)
Geometric Distribution
• Example. Tom and his mom lost each other while wandering
through a crowded amusement park. Their iphones are out
of battery. Tom’s mom, being a wise woman, foresaw this
and made a prior agreement with Tom. Tom will wait at the
entrance of one of the 15 attractions and his mom searches
the attractions in a random order (the “wait-for-mommy”
strategy). What are the expected value and standard
deviation of the number of searches before Tom’s mom finds
him?
Geometric Distribution
• Example. Tom and his mom lost each other while wandering
through a crowded amusement park. Their iphones are out
of battery. Tom’s mom, being a wise woman, foresaw this
and made a prior agreement with Tom. Tom will wait at the
entrance of one of the 15 attractions and his mom searches
the attractions in a random order (the “wait-for-mommy”
strategy). What are the expected value and standard
deviation of the number of searches before Tom’s mom finds
him?

• Suppose now that Tom and his mom agrees that, in intervals
of 10 minutes, they will each pick a random entrance and go
to their chosen entrances. What are the expected value and
standard deviation of the number of searches in this case?
Poisson Distribution
• Poisson r.v. counts the number of occurrences of
interest in a segment of time or space; possible values
are 0, 1, 2, …
• Poisson distribution with parameter λ = np
approximates Bin(n, p) when n is large and p is small;
e.g., number of calls received by an emergency center
• X has a Poisson distribution with parameter λ>0 if its
pmf satisfies
P(X = k) = e-λλk/k!, k = 0, 1, 2, …
• E[X] = Var(X) = λ
• Denoted by Poi(λ)
Uniform Random Variables
• A random variable X is uniformly distributed over [a, b] if its
probability density function (pdf) f(x) is

1/(b-a)

a b
• Denote it by Unif(a, b)
• Used to model a “completely random” selection over the interval
Uniform Random Variables
• Note that this is a valid pdf because

• The (cumulative) distribution function of Unif(a, b) is

a b
Uniform Random Variables
• Expectation of X ~ Unif(a, b) is

• Variance of X can be computed as follows


Exponential Random Variables
• A random variable X has an exponential pdf with
parameter λ > 0 if the pdf f(x) is

λ=2

λ=1 λ = 0.5
Exponential Random Variables
• Denoted by Exp(λ)
• Often used to model the time till some event (e.g.,
earthquake, phone call, radioactive decay, etc) occurs
• cdf F(x) is given by

• E[X] = 1/λ λ=1


• Var(X) = 1/λ2
Normal Random Variables
• A bell-shaped pdf curve
• Random variable X is normally distributed with mean μ
and variance σ2 if it has pdf
Normal Random Variables
• Normal distribution and r.v. show up in many natural
phenomena and are important in statistics (later)
• E[X] = μ, Var(X) = σ2
• Denote it by N(μ, σ2)
• N(0, 1) is called the standard normal distribution
Normal Random Variables
• Property 1: If X~N(μ, σ2), then aX+b~N(aμ+b, a2σ2)
• Property 1’: If X~N(μ, σ2), then Z = (X-μ)/σ ~ N(0, 1)
• Moral: all normal rv can be “reduced” to the standard
normal
• Often use Φ(x) to denote the cdf of standard normal

• No closed-form formula for Φ(x) but the standard


normal table exists
Normal Random Variables
• Property 2: if X1~N(μ1, σ12) and X2~N(μ2, σ22) are independent
normal rv, then X1+X2~N(μ1+μ2, σ12+σ22)

You might also like