0% found this document useful (0 votes)
16 views30 pages

Week 3 - Discrete & Continuous R.V

The document discusses discrete random variables, their classifications, and common distributions such as Bernoulli, Binomial, and Poisson. It explains probability mass functions (p.m.f) and cumulative distribution functions (c.d.f) for discrete random variables, along with examples and R commands for calculations. Additionally, it briefly touches on continuous random variables and their probability density functions (pdf).

Uploaded by

An Lộc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views30 pages

Week 3 - Discrete & Continuous R.V

The document discusses discrete random variables, their classifications, and common distributions such as Bernoulli, Binomial, and Poisson. It explains probability mass functions (p.m.f) and cumulative distribution functions (c.d.f) for discrete random variables, along with examples and R commands for calculations. Additionally, it briefly touches on continuous random variables and their probability density functions (pdf).

Uploaded by

An Lộc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Discrete random variables

Classifications of random variables


0.2
Discrete uniform distribution

probability
0.1

0
Bernoulli distribution
2 4 6 8 10 12
X
Binomial distribution

Discrete random variables Poisson distribution

Normal distribution
Random variables
Uniform distribution

Continuous random variables


Probabilities for a discrete RV
• The probability distribution of a discrete RV X, is called, a probability
mass function (p.m.f) of X
𝑓 𝑥 = 𝑃𝑟(𝑋 = 𝑥), for different values of x
For a random variable X, we use Pr(X=x) to denote the probability
of X equal to x

• We define a cumulative distribution function (c.d.f) for X as

𝐹 𝑥 = 𝑃𝑟 𝑋 ≤ 𝑥
X
Value of X
Basic properties of p.m.f. and c.d.f.
⇒ 𝑓 𝑥 must be between zero and one for any 𝑥

⇒ 𝐹 𝑥 is nondecreasing in 𝑥 , and will approach 1 when 𝑥 → ∞


Discrete probability distributions
Commonly used discrete distributions:
• Discrete uniform distribution: multiple values; each with the same
probability
• Bernoulli distribution: an experiment that has only two possible
outcomes
• Binomial distribution: an experiment consists of a series of
independent Bernoulli trials, the distribution of the number of
successes follows a binominal distribution
• Poisson distribution: an experiment involves the number of instances
over a period of times
Bernoulli distribution
• The experiment where the outcomes is either Success and Failure
-E.g., Flip a coin; take the driver license test; test a product defect
• The Bernouli RV takes the value of “1” if {Success} occurs, and “0” if {Failure}
occurs

The probability distribution of this RV 𝑋 can be written as


𝑓 𝑥 = 𝑝 if 𝑥 = 1,
= 1 – 𝑝 if 𝑥 =0,
= 0 otherwise.
The 𝑝 is the known probability of the event {Success}
Example: Bernoulli distribution
• The success rate of the driver’s license test is known to be 0.4. We
can model the experiment of a single test as a RV following the
Bernoulli distribution:
𝑓(𝑥) = 0.4 if 𝑥 = 1, 𝑓(𝑥) = 0.6 if 𝑥 = 0, and 𝑓 𝑥 = 0 otherwise
• A food manufacturer is required to test its products for food safety
before shipping. The outcome of a test is either pass or no-pass. If the
probability of pass is known to be 0.95, we can model the experiment
of a single test as a RV following the Bernoulli distribution:
𝑓(𝑥) = 0.95 if 𝑥 = 1, 𝑓(𝑥) = 0.05 if 𝑥 = 0, and 𝑓 𝑥 = 0 otherwise
Binomial distribution
• An experiment consists of a series of n independent Bernoulli trials
-E.g., Flip a coin 100 times; 10 people take the driver license test; test
defects among 1,000 sampled products
• The RV 𝑋 that counts the total number of successes in the experiment
will follow a Binomial distribution

𝑛 𝑥
𝑓(𝑥) = 𝑝 1 − 𝑝 𝑛−𝑥 , 𝑓𝑜𝑟 𝑥 = 0, … , 𝑛
𝑥
where 𝑝 is the known probability of the event {Success} .
Binomial distribution
• An experiment consists of a series of n independent Bernoulli trials
-E.g., Flip a coin 100 times; 10 people take the driver license test; test
defects among 1,000 sampled products
• The RV 𝑋 that counts the total number of successes in the experiment
will follow a Binomial distribution

𝑛 𝑥
𝑓(𝑥) = 𝑝 1 − 𝑝 𝑛−𝑥 , 𝑓𝑜𝑟 𝑥 = 0, … , 𝑛
𝑥
where 𝑝 is the known probability of the event {Success} .
Binomial distribution
10 people taking the driver license test (n=10)
The probability that each individual passing the test is independent and is 0.8
What is the probability that 3 people passed the test (f(3)=?)

10
𝑓 3 = 0.83 1 − 02 10−3 ,
3
The3probability of
7
observing an instance of “3 people passed the test “ is
0.8 ∗ 1 − 0.8
There are C10,3 possible instances (different combinations of people passing
the tests). As such, f(3) is equal to the product of the probability multiplied
by the number of instances
Examples: Binomial distributions
• You are about to flip a fair coin 100 times. You want to know the
probability of observing a certain number of heads. Let the total number of
heads be a RV 𝑋. Then 𝑋 follows a Binomial distribution.
• To calculate f(x), use dbinom(x,n,p)
E.g., 𝑓(40) = dbinom(40,100,0.5) = 0.01084387.
• To calculate F(x), use pbinom(x,n,p)
F(40) = pbinom(40,100,0.5) = 0.02844397
F(39)= pbinom(39,100,0.5) = 0.0176001
Notice F(40)-F(39)=f(40)
Notice F(40) can also be obtained from sum(dbinom(0:40,100,0.5))
Poisson distribution
• Poisson distribution can represent the number of times an event
occurs within a time interval.
E.g., the number of car accidents, the number of customer arrivals at a
store, and the number of defects in a batch of products.
• The Poisson distribution has a single parameter, λ (lambda), the
average occurrence rate in a given time interval
• Pr(𝑋 = 𝑘) = (𝑒 −𝜆 ∗ 𝜆𝑘 ) / 𝑘!, where k is a non-negative integer,
and e is natural exponential function (about = 2.718).
Conditions for Poisson distribution
1. The event occurrences should not be strongly dependent
E.g., customers arrival should be “random”
2. The average rate should be a constant
E.g., cannot use the same rv for both peek-hour and off-peak hour
traffic
3. Two or more events cannot happen at the same time
Conditions for Poisson distribution
1. The event occurrences should not be strongly dependent
E.g., customers arrival should be “random”

Make my own
decision? Or see Store
whether others
enter or not
Conditions for Poisson distribution
1. The event occurrences should not be strongly dependent
E.g., customers arrival should be “random”
2. The average rate should be a constant
E.g., cannot use the same rv for both peek-hour and off-peak hour
traffic
3. Two or more events cannot happen at the same time
Examples: Poisson distributions
• A website on average is visited by 20 browsers / min.
• We can use a Poisson RV to calculate the probability of the number of
arrivals
Assume X to be a Poisson RV. Then
Pr 𝑋 > 25 = 1 − Pr 𝑋 ≤ 25 = 1 − 𝑝𝑝𝑜𝑖𝑠(25,20) =0.112185
Summary
• The probability mass function (f(x)) and distribution function (F(x))
• Three common discrete RV’s
• R commands to calculate pmf and cdf
Continuous random variables
Probability accounting for discrete RV’s
• For a discrete RV, the total probability mass (=1.0) is distributed to
countably many points. Thus, we can tabulate the probability of its
distribution “point-by-point”

Pr 𝑋 = 𝑥 = 0. 25 𝑓𝑜𝑟 𝑥 = 0 𝑎𝑛𝑑 2

Pr 𝑋 = 𝑥 = 0.5 𝑓𝑜𝑟 𝑥 = 1

Pr 𝑋 = 𝑥 =0 elsewhere
Probability for continuous RV’s
• Bc a continuous RV can take on uncountably many values, the
probability of Pr 𝑌 = 𝑦 = 0 for any arbitrary 𝑦 (since we must spread the
probability mass (=1) to unaccountably many points).

• Probability for a continuous RV is defined over a range of values and


is measured by the area under the density curve
Probability for continuous RV’s
• The f(x) is now called the probability density function (pdf)
• The f(x) value is not probability. Instead, it reflects the relative
likelihood of the values over a range and it is scaled to make the total
area under the curve = 1.0
Normal distributions (Gaussian distribution)
Basic properties of p.d.f. and c.d.f. for
continuous distributions
⇒ 𝑓 𝑥 must be nonnegative for any 𝑥

⇒ 𝐹 𝑥 is nondecreasing in 𝑥 , and will be 1 when 𝑥 → ∞


R commands for random variables
• f(1)=dnorm(1, mean = 0 , sd = 1 ) = 0.2419707
• F(-1)=pnorm(-1, mean = 0 , sd = 1 ) = 0.1586553
Example: Normal distributions
• X follows a standard normal distribution. (a) Show graphically the
probability that X<1. (b) Calculate its probability

(b)
>pnorm(1,0,1)
=0.8413447
Example: Continuous uniform distributions
• X is uniformly distributed over [0, 10]. calculate the probability that
(a) X<=3, (b) X>=7, (c) 1<=X<=6

(a) Pr(X<=3) can be found using the


command
punif(x, min = a, max = b).

>punif(3, min = 0, max = 10)


=0.3
Example: Continuous uniform distributions
• X is uniformly distributed over [0, 10]. calculate the probability that
(a) X<=3, (b) X>=7, (c) 1<=X<=6

(b)
>1-punif(7, min = 0, max = 10)
=0.3
Example: Continuous uniform distributions
• X is uniformly distributed over [0, 10]. calculate the probability that
(a) X<=3, (b) X>=7, (c) 1<=X<=6

(b)
>punif(6, min = 0, max = 10) -
punif(1, min = 0, max = 10)
=0.5

You might also like