Docsity

Bernoulli Trials - Essay - Mathematics, Essays (high school) of Mathematics

Toggle sidebar
bg1
Bernoulli trials
An experiment, or trial, whose outcome can be classified as either a success or failure is
performed.
X = 1 when the outcome is a success
0 when outcome is a failure
If p is the probability of a success then the pmf is,
p(0) =P(X=0) =1-p p(1) =P(X=1) =p
A random variable is called a Bernoulli random variable if it has the above pmf for p
between 0 and 1.
Expected value of Bernoulli r. v.:
E(X) = 0*(1-p) + 1*p = p
Variance of Bernoulli r. v.:
E(X 2) = 02*(1-p) + 12*p = p
Var(X) = E(X 2) - (E(X)) 2 = p - p2 = p(1- p)
Ex. Flip a fair coin. Let X = number of heads. Then X is a Bernoulli random variable with
p=1/2.
E(X) = 1/2
Var(X) = 1/4
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download Bernoulli Trials - Essay - Mathematics and more Essays (high school) Mathematics in PDF only on Docsity!

Bernoulli trials

An experiment, or trial, whose outcome can be classified as either a success or failure is

performed.

X = 1 when the outcome is a success

0 when outcome is a failure

If p is the probability of a success then the pmf is,

p(0) =P(X=0) = 1 - p p(1) =P(X=1) =p

A random variable is called a Bernoulli random variable if it has the above pmf for p

between 0 and 1.

Expected value of Bernoulli r. v.:

E(X) = 0(1-p) + 1p = p

Variance of Bernoulli r. v.:

E(X

2

2

*(1-p) + 1

2

*p = p

Var(X) = E(X

2

) - (E(X))

2

= p - p

2

= p(1-p)

Ex. Flip a fair coin. Let X = number of heads. Then X is a Bernoulli random variable with

p=1/2.

E(X) = 1/

Var(X) = 1/

Binomial random variables

Consider that n independent Bernoulli trials are performed. Each of these trials has

probability p of success and probability (1-p) of failure.

Let X = number of successes in the n trials.

p(0) = P(0 successes in n trials) = (1-p)

n

{FFFFFFF}

p(1) = P(1 success in n trials) = (n 1)p(1-p)

n- 1

{FSFFFFF}

p(2) = P(2 successes in n trials) = (n 2)p

2

(1-p)

n- 2

{FSFSFFF}

p(k) = P(k successes in n trials) = (n k)p

k

(1-p)

n-k

A random variable is called a Binomial(n,p) random variable if it has the pmf,

p(k) = P(k successes in n trials) = (n k)p

k

(1-p)

n-k

for k=0,1,2,….n.

Valid pmf: sum_{k=0}^n p(k) = 1

sum_{k=0}^n (n k)p

k

(1-p)

n-k

= (p+(1-p))

n

Ex. A Bernoulli(p) random variable is binomial(1,p)

Ex. Roll a dice 3 times. Find the pmf of the number of times we roll a 5.

X = number of times we roll a 5 (number of successes)

X is binomial(3,1/6)

p(0) = (3 0)(1/6)

0

3

p(1) = (3 1)(1/6)

1

2

p(2) = (3 2)(1/6)

2

1

p(3) = (3 3)(1/6)

3

0

Ex. Screws produced by a certain company will be defective with probability.

independently of each other. If the screws are sold in packages of 10, what is the

probability that two or more screws are defective?

X = number of defective screws.

X is binomial(10,0.01)

P(X ≥ 2) = 1 - P(X<2) = 1 – P(X=0) – P(X=1) = 1 – (10 0)(.01)

0

10

1

9

Multinomial r.v.’s

In the binomial case, we counted the number of outcomes in a binary experiment (the

number of heads and tails). The multinomial case generalizes this from the binary to the

k-ary case.

Let n_i=number of observed events in i-th slot; p_i = prob of falling in i-th slot.

P(n_1,n_2,…,n_k)=(N!/ n_1!n_2!…n_k!)p_1^n_1p_2^n_2…*p_k^n_k.

The first term is the usual multinomial combinatoric term (familiar from chapter 1); the

second is the probability of observing any sequence with n_1 1’s, n_2 2’s, …, and n_k

k’s.

To compute the moments here, just note that n_i is itself Bin(N,p_i). So E(n_i)=Np_i

and V(n_i)=Np_i(1-p_i).

For the covariances, note that n_i+n_j is Bin(N,p_i+p_j). So

V(n_i+n_j)= N(p_i+p_j)(1-p_i-p_j).

But we also know that

V(n_i+n_j)=V(n_i)+ V(n_j)+2C(n_i,n_j). Put these together and we get that

C(n_i,n_j)=-Np_ip_j.

Note that it makes sense that the covariance is negative: since N is limited, the more of

n_i we see, the fewer n_j we’ll tend to see.

The Poisson Random Variable

A random variable X, taking on the values 0, 1, 2, ….., is said to be a Poisson random

variable with parameter λ if for some λ > 0,

p(i) = P(X=i) = exp(-λ)λ

i

/i! for i=0,1,2,3,……

Valid pmf:

0 0 0

!

"

=

!

"

=

!

"

=

$ $ $ $

e e

i

e

i

p i e

i

i

i

i

i

The Poisson random variable has a large range of applications. A major reason for this is

that a Poisson random variable can be used as an approximation for a binomial random

variable with parameter (n,p) when n is large and p is small. (Rare events)

Let X be a binomial random variable and let λ=np. (λ moderate)

i

n

i

i

n i

i

i

i n i

i ni i n i

n

n

n i

nn n i

i n n

nn n i

n i i n n

n

p p

n i i

n

p p

i

n

P X i

'

'

' '

For n large and λ moderate,

!

"

" e

n

n

i

n

nn n i

i

n

)

Hence,

i

P X i e

i

"!

Ex. If X and Y are independent Poisson random variables with parameters λ 1

and λ

2

respectively, then Z=X+Y is Poisson with parameters λ 1

+λ

2

Verify for yourself, using either m.g.f. (easiest) or convolution formula.

Poisson Process

A Poisson process is a model for counting occurrences, or events, over an interval. For

example, we are often interested in situations where events occur at certain points in time.

(Time is continuous)

Ex. The number of customers’ entering a post office on a given day.

How many customers enter a store in t hours?

Assume that the customers arrive at random time points.

  • Split the t hours into n intervals of very small length (say 1 s).
  • If λ customers arrive on average during an hour, then approximately λ t

customers will arrive during t hours. The probability that a customer arrives

during each interval is λt/n.

  • Only one customer can arrive during each time interval.
  • Each person arrives independently.

The intervals can be represented as a sequence of n independent Bernoulli trials with

probability of success λt/n in each. Use Poisson approximation (n large, p small).

A Poisson process having rate λ means that the number of events occurring in any fixed

interval of length t units is a Poisson random variable with mean λt. The value λ is the

rate per unit time at which events occur and must be empirically determined. We write

that the number of occurrences during t time units as N(t). N(t) is Poison(λt).

Ex. Customers enter a post office at the rate of 1 every 5 minutes.

What is the probability that no one enters during a 10 minute time period?

Let N(t) = the number of customers entering the post office during time t.

N(t) is Poisson(λt) where λ=1 and t=2.

P(N(t) = 0) = exp(-λt) = exp(-2) = 0.

What is the probability that at least two people enter during a 10 minute time period?

P(X>=2) = 1- P(X<2) = 1-(P(N(2) = 0) + P(N(2) = 1)) = 1-(exp(-2) + 2exp(-2)) = 1-(

Geometric distribution

Consider that n independent Bernoulli trials are performed. Each of these trials has

probability p of success and probability (1-p) of failure.

Let X = number of unsuccessful trials preceding the first success.

X is a discrete random variable that can take on values of 0,1, 2, 3,.....

S, FS, FFS, FFFS, FFFFS, FFFFFS, FFFFFFS, ........

P(X=0) = p

P(X=1) = (1-p)p

P(X=2) = (1-p)

2

p

P(X=n) = (1-p)

n

p

A random variable is called a Geometric(p) random variable if it has the pmf,

p(k) = (1-p)

k

p for k=0,1,2,…..

Valid pmf:

sum_{k=0}^inf p(1-p)

k

= p /(1-(1-p)) = p/p = 1

Ex. A fair coin is flipped until a head appears. What is the probability that the coin needs

to be flipped more than 5 times?

X = number of unsuccessful trials preceding the first H.

P ( X " 5 ) = 1 # P ( X < 5) = 1 # p ( 1 # p )

j

j = 0

4

= 1 # p

1 # ( 1 # p )

5

1 # ( 1 # p )

= 1 # p

1 # ( 1 # p )

5

p

= ( 1 # p )

5

5

This is the same probability as getting 5 straight tails. (Note that the combinatoric term

here is 5 choose 5, i.e., 1.)

Negative Binomial

Consider that n independent Bernoulli trials are performed. Each of these trials has

probability p of success and probability (1-p) of failure.

X = number of failures preceding the r-th success.

X takes values 0,1,2,…

P(X=0) = p

r

SSSSSSS

P(X=1) = (r 1)p

r

(1-p) SSSSFSSS

P(X=2) = (r+1 2)p

r

(1-p)

2

SSSSFSFSS

P(X=3) = (r+2 3)p

r

(1-p)

3

SSSSFFSFSS

P(X=n) = (r+n-1 x)p

r

(1-p)

n

This random variable is called a Negative binomial(r,p) random variable.

Valid pdf: Need to use negative binomials.

The negative binomial distribution is used when the number of successes is fixed and

we're interested in the number of failures before reaching the fixed number of successes.

If X is NegBin(r,p), then X=sum_{i=1} ^r X_i, with X_i independent Geo(p) r.v.’s.

E(X)=rq/p; V(X)=rq/(p^2).

MGF of Geo(p):

E(exp(tX_i))=

e

tn

q

n

p

n = 0

"

= p ( qe

t

n

n = 0

"

= p ( qe

t

n

n = 0

"

= p /( 1 $ qe

t

)for qexp(t)<1.

MGF of NegBin(r,p)=[p/(1-qexp(t))]^r.

Ex. Find the expected number of times one needs to roll a dice before getting 4 sixes.

X = number of rolls before getting 4 sixes.

X is negative binomial with r=4 and p=1/6.

E(X) = r/p = 4/(1/6) = 24.

Hypergeometric random variables

Assume we have a box that contains m red balls and (N-m) white balls. Suppose we

choose n different balls from the box, without replacement.

Let X = number of red balls.

X takes value from 0 to n.

P(X=0) = (m 0)(N-m n)/(N n)

P(X=1) = (m 1)(N-m n-1)/(N n)

P(X=k) = (m k)(N-m n-k)/(N n)

A random variable is called a Hypergeometric(n,N,m) random variable if it has the pmf,

P(X=k) = (m k)(N-m n-k)/(N n) for k = 0, 1, …. n

Show that this is a valid pmf.

Suppose that we have a population of size N that consists of two types of objects. For

example, we could have balls in an urn that are red or green , a population of people who

are either male or female , etc. Assume there are m objects of type 1, and N-m objects of

type 2.

Let X = number of objects of type 1 in a sample of n objects.

X is Hypergeometric with parameters (n,N,m).

Ex. Suppose 25 screws are made, of which 6 are defective. Suppose we randomly sample

10 screws and place them in a package. What is the probability that the package contains

no defective screws?

X = number of defective screws in the package.

X is hypergeometric with n=10, N=25 and m=6.

P(X=0) = (6 0)(19 10)/(25 10) = 0.

Uniform Random Variables

0 otherwise

x

f x

Expected Value and Variance:

2 2 2

"

!

"

!

+

x

dx

x

E X xf x dx

2 2

2 3 3 3 2 2

2 2

"

!

"

!

+

x

dx

x

E X x f x dx

2 2 2 2

Var X =

Ex. Buses arrive at specified stop at 15-minute intervals starting at 7 AM. (7:00, 7:15,

7:30, 7:45, ….) If the passenger arrives at the stop at a time that is uniformly distributed

between 7 and 7:30, find the probability that he waits

(a) less than 5 minutes for the bus;

(b) more than 10 minutes for the bus;

X = number of minutes past 7 the passenger arrives.

X is a uniform random variable over the interval (0,30).

(a) The passenger waits less than 5 minutes if he arrives either between 7:10 and 7:

or between 7:25 and 7:30.

30

25

15

10

P X P X dx dx

(b) The passenger waits more than 10 minutes if he arrives either between 7:00 and

7:05 or between 7:15 and 7:20.

20

15

5

0

P X P X dx dx

Exponential Random Variables

X is an exponential random variable with parameters λ (λ>0) if the pdf of X is given by

%

0 ifx 0

ifx 0

x

e

f x

&

&

The cdf is given by

F ( a ) = P ( X " a ) = # e

$ # x

dx

0

a

= $ e

$ # x

[ ]

0

a

= 1 $ e

$ # a

for a>=0.

The exponential can be used to model lifetimes or the time between unlikely events. They

are used to model waiting times, at telephone booths, at the post office and for time until

decay of an atom in radioactive decay.

Expected Value and Variance:

Let X be an exponential random variable.

E ( X ) = x " e

" x

dx

0

$

= # xe

" x

[ ]

0

$

  • e

" x

dx

0

$

e

" x

0

$

E ( X

2

) = x

2

" e

" x

dx

0

$

= # x

2

e

" x

[ ]

0

$

  • 2 xe

" x

dx

0

$

"

E ( X ) =

"

2

2 2 2

2 2

Var X = E X " E X = " = ; thus the standard deviation (the “scale” of

the density) is 1/λ.

These formulas are easy to remember if you keep in mind the following fact: if X ~ exp(1)

and Y=X/λ, c>0, then Y ~ exp(λ). Thus λ is really just a scaling factor for Y.

Ex. Suppose that the length of a phone call in minutes is an exponential random variable

with λ=1/10. If somebody arrives immediately ahead of you at a public telephone booth,

find the probability you have to wait

(a) more than 10 minutes;

(b) between 10 and 20 minutes.

Let X = length of call made by person in the booth.

(a) ( 10 ) 1 ( 10 ) 1 ( 10 ) 1 ( 1 ) 0. 368

10 / 10 1

" "

P X P X F e e

(b) ( 10 20 ) ( 20 ) ( 10 ) ( 1 ) ( 1 ) 0. 233

20 / 10 10 / 10 1 2

" " " "

P X F F e e e e

The Gamma Random Variable

X is a Gamma random variable with parameters (α,λ) (α, λ > 0) if the pdf of X is given by

'

0 ifx 0

ifx 0

( x)

  • 1

) x (

e

f x

where

"

0

1

( ) e y dy

y %

%. (The gamma function)

It can be shown, through integration by parts, that "( # )=( #! 1 )"( #! 1 ). (Verify at home)

Also a simple calculation shows that: !( 1 )= 1.

Combining these two facts gives us for integer-valued α (α=n),

"( n )=( n! 1 )"( n! 1 )=( n! 1 )( n! 2 )"( n! 2 )=L=( n! 1 )( n! 2 )L 2 "( 1 )=( n! 1 )!.

Additionally it can be shown that " ( 1 / 2 )= !. (Verify at home)

Expected Value and Variance:

! "! "

%

&

%

& &

0 0

1

E X xe x dx e x dx

x x

2 2

0

1

2

0

2 2 1

! "! "

%

& +

%

& &

E X x e x dx e x dx

x x

2 2

2

2

2 2

Var X = E X # E X =

Many random variables can be seen as special cases of the gamma random variable.

(a) If X is gamma with α=1, then X is an exponential random variable.

(b) If X is gamma with λ=1/2 and α=n/2 is χ

2

with n degrees of freedom. (We’ll discuss this soon.)

Ex. Let X be a Gamma distribution with parameter (α, λ).

1

!!

$ #

f x e x

x

for 0<=x<∞.

Calculate M ( t )

X

!

!

!

"!

!

!

"! "!

,

) ) )

,

) ) )

,

) )

t t

t e t x dx

t

M t Ee e e x dy e x dx

t x

tX tx x t x

X

0

( ) 1

0

( ) 1

0

1

1

2

1

! +

( (

)

)

)

(

)

)

)

)

(

t t

t

M t

X

"

  • 1

X

E X M

3

2 2

1

( (

t t t

M t

X

2

3

2

2

!

" "

!

!

!

" "

"

X

E X M

The Beta Random Variable

X is a Beta random variable with parameters (a,b) if the pdf of X is given by

%

0 therwise

( 1 - x) if 0 x 1

( , b)

1 b- 1

o

x

B a

f x

a

where

B ( a , b ) = x

a " 1

( 1 " x )

b " 1

dx

0

1

. (The Beta function)

The Beta family is a flexible way to model random variables on the interval [0,1]. It is often

used to model proportions (e.g., the prior distribution of the fairness of a coin).

The following relationship exists between the beta and gamma function:

a b

a b

B a b

. ( Verify: !( a ) !( b )=K=!( a + b ) B ( a , b ))

Expected Value and Variance:

E ( X ) =

B ( a , b )

xx

a " 1

( 1 " x )

b " 1

dx

0

1

B ( a , b )

x

a

( 1 " x )

b " 1

dx

0

1

B ( a + 1 , b )

B ( a , b )

$( a + 1 )$( b )

$( a + b + 1 )

$( a + b )

$( a )$( b )

a $( a )$( a + b )

( a + b )$( a + b )$( a + b )

a

( a + b )

2

a b a b

ab

Var X

We will see an application of the beta distribution to order statistics of samples drawn

from the uniform distribution soon.

Normal Random Variables

X is a normal random variable with parameters μ and σ

2

if the pdf of X is given by

2

2

2

( )

!

μ

"!

x

f x e for x in (-∞, ∞).

This is the density function for the so-called Bell curve. The normal distribution shows up

frequently in Probability and Statistics, due in large part to the Central Limit Theorem.

If X is a normally distributed random variable with μ=0 and σ=1, then X has a standard

normal distribution. The pdf of X is then given by

2

2

μ

"

f x = e for x in (-∞, ∞).

f(x) is a valid pdf, because f(x)>=0 and 1

2

2

2

( )

"

"

e dx

x

$

μ

This last result is not immediately clear. See book for proof. The idea is to compute the

joint pdf of two iid Gaussians, for which the normalization factor turns out to be easier to

compute.

Fact: If X is normally distributed with parameters μ and σ

2

, then Y=aX+b is normally

distributed with parameters aμ+b and a

2

σ

2

Proof:

a

y b

F

a

y b

F y PY y PaX b y P X

Y X

2 2 2

2 2

( ( ))/ 2

( )/ 2

μ!

μ!

"! "!

y ba a

a

y b

Y Y X X

e

a

e

a

a

y b

f

a a

y b

F

dy

d

F y

dy

d

f y

# +

Y is normally distributed with parameters aμ+b and a

2

σ

2

An important consequence of this fact is that if X is normally distributed with parameters

μ and σ

2

, then

" μ

X

Z is standard normal.