Some common distributions CompSci 369, 2022
School of Computer Science, University of Auckland
Copyright By PowCoder代写 加微信 powcoder
Last lecture
Basics of probability Random variables
This lecture
Revisiting Basics of probability and Random variables Common distributions
Discrete distributions
Bernoulli random variables
Named after , a Swiss mathematician.
A Bernoulli r.v. takes one of two values, 0 or 1. 1 is “success”, 0 is “failure”
is the probability of success, is the probability of failure.
is the sole parameter of a Bernoulli distribution. Expectation is .
Variance is
qp = 2p − 21 ⋅ p + 20 ⋅ q = 2]X[E − ]2X[E = )X(raV p = 1 ⋅ p + 0 ⋅ q = ]X[E
Bernoulli Example:
If , 30 random draws from a Bernoulli distribution look like
While when , 30 random draws look like
101010100001110010100001000000]1[ ##
)EURT = ecalper ,)2.0,8.0(c = borp,03,)1,0(c(elpmas 2.0 = p
010111011100101010100010001011]1[ ##
)EURT = ecalper ,)5.0,5.0(c = borp,03,)1,0(c(elpmas 5.0 = p
Geometric random variables
Geometric r.v. is the number of failures before the rst success in repeated Bernoulli trials.
Flip a coin until we get heads then count the number of tails.
The possible values: (any natural number)
A geometric has one parameter, which is the probability of success in the associated Bernoulli trial.
Geometric PDF
The probability distribution function (pdf) of geometric is .
px)p − 1( = )x = X(P
Geometric expectation and variance
The expectation of is .
The variance of is
2p =)X(raV X q
p=]X[E X q
Example of geometric
If , 30 random draws from a geometric distribution look like
While when , 30 random draws look like
2 0 0 1 0 ]62[## 2 3 0 1 1 0 0 1 1 2 0 6 0 4 2 5 4 0 4 0 51 0 0 2 1 ]1[ ##
002201010010120530001000000301]1[ ##
)2.0 = borp,03(moegr 2.0 = p
)5.0 = borp,03(moegr 5.0 = p
Different definitions of geometric
The geometric can be de ned as the total number of trials until the rst success.
This means possible values are (rather than in our de nition)
Check which de nition is being used (or suits your problem)
…,3,2,1,0 …,3,2,1
Binomial distribution
A binomial r.v. is the number of successes in Bernoulli trials.
Fix . Perform Bernoulli trials with probability of success and count the number of successes. The result is a binomial random variable.
Takes values between 0 and .
Two parameters:
, the number of Bernoulli trials undertaken
, the probability of success in the Bernoulli trials.
Binomial PDF
.n , … ,2 ,1 ,0 = x rof x−n)p − 1(xp)x( = )x = X(P = )x(f n
.!)x−n(!x =)x( !n n
Binomial mean and variance
Expectation of is
The variance of is
has a binomial distribution with parameters and
p n X )p ,n(niB ∼ X
qpn = )p−1(pn = ]X[raV X pn = ]X[E X
Binomial Example
Let . If , 30 random draws from a binomial (n = 30, p = 0.5) distribution look like
While when , 30 random draws from Bin(n = 30, p = 0.2) look like
434453634357183573256445422535]1[ ##
9 117 1131]62[## 119 01219 016 016 31019 8 219 9 6 4141210101114101]1[ ##
)2.0 = borp,02 = ezis ,03(monibr 2.0 = p
)5.0 = borp,02 = ezis ,03(monibr 5.0=p 02=n
Poisson distribution
Named after the French mathematician Siméon .
Used to model the number of rare events that occur in a xed period of time. Events occur independently of each other: one event occur does not precipitate or hinder another event occurring.
Single parameter, , called the rate parameter (higher rate produces more events).
Poisson is a count so possible values are
…,3,2,1,0
Poisson PDF
where by de nition.
…,3,2,1,0 = x rof !x )λ−(pxe = )x(f xλ
Poission expectation and variance
If is Poisson it has expectation
and variance
Write when has a Poisson distribution with parameter .
λ X )λ(ssioP ∼ X .λ = ]X[raV
Poisson example
30 random draws from a Poisson distribution with rate look like
While when , 30 random draws look like
211100101000100110100011010100]1[ ##
330302130012111223050220314321]1[ ##
)5.0 = adbmal,03(siopr 5.0 = λ
)2 = adbmal,03(siopr
Can apply to discrete or continuous values All allowable outcomes are equally likely.
Discrete uniform
When is discrete and takes possible values, the uniform pdf is for all .
ix n/1 = )ix = X(P nX
Continuous uniform
When uniform over on , the density function is . Write .
a−b =)x(f ]b,a[ X 1
)]b,a[(U ∼ X
Uniform Examples
30 random draws from a discrete uniform distribution with possible outcomes 1,2,..,8:
30 random draws from (rounded to 3 dp)
880.2 111.4 321.3 582.3 331.3 125.2 ]52[ ##
990.3 281.2 813.3 785.2 366.3 381.4 247.4 322.5 695.5 386.5 296.5 033.5 ]31[ ##
416.5 734.2 544.5 215.3 518.4 595.5 913.5 515.2 086.5 350.5 492.2 325.5 ]1[ ##
)3 = stigid ,)6 = xam ,2 = nim ,03(finur(dnuor )]6 ,2[( U
213521517381318731487768468764]1[ ##
)T = ecalper,03 = ezis,8:1(elpmas
Continuous distributions
Exponential
The exponential distribution describes the waiting time between independent events.
Takes any non-negative value:
It has a single parameter, , known as the rate.
Exponential density
The probability density function for exponential is , where .
xλ−eλ = )x(f X
)λ(pxE ∼ X 0≥x
Exponential mean and variance
The expectation of is .
The variance of is
2λ =)X(raV X 1
λ=]X[E X 1
Exponential example
30 random draws from an exponential distribution with rate parameter .
When , 30 draws look like
342.0 385.0 811.0 393.0 103.2 389.0 ]52[ ##
206.1 503.2 706.2 755.0 806.1 767.5 757.0 505.2 630.3 553.0 044.1 789.1 ]31[ ##
520.0 351.4 512.5 508.0 239.0 476.0 609.1 938.0 625.2 198.0 145.1 362.0 ]1[ ##
272.0 541.0 912.1 692.0 002.0 382.0 ]52[ ##
943.1 611.0 523.0 440.0 857.0 277.0 920.0 601.0 221.0 874.0 882.0 654.0 ]31[ ##
053.0 606.1 748.0 274.0 591.0 573.0 671.0 670.0 163.0 099.0 372.1 730.1 ]1[ ##
)3 = stigid,)5.0 = etar,03(pxer(dnuor 5.0 = λ
)3 = stigid ,)2 = etar,03(pxer(dnuor
Memorylessness
An important property of the exponential distribution is memorylessness. Memorylessness is a property is shared with the geometric distribution and no
other distributions.
So if you insist on the memoryless property, you are insisting on a geometric or exponential distribution.
Formally, if is exponentially distributed, it has the memoryless property that
.0≥y,x∀ ,)x>X(rP=)y> T|x+y>X(rP X
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com