Docsity

Probability Theory: Mass, Density Functions, and Simulating Discrete Variables, Lecture notes of Economic Analysis

Partial preview of the text

Download Probability Theory: Mass, Density Functions, and Simulating Discrete Variables and more Lecture notes Economic Analysis in PDF only on Docsity!

Chapter 1

Probability Theory

Mass Functions and Density Functions

Outline

Mass Functions

Density Functions

Hazard Functions

Joint Distributions

Independent Random Variables

Simulating Discrete Random Variables

Mass Functions

Let’s make tosses of a biased coin whose outcomes are independent. Let X denote the random variable that gives the number of tails before the first head and p denote the probability of heads in any given toss. Then

fX (0) = P{X = 0} = P{H} = p fX (1) = P{X = 1} = P{TH} = (1 − p)p fX (2) = P{X = 2} = P{TTH} = (1 − p)^2 p .. .

fX (x) = P{X = x} = P{T · · · TH} = (1 − p)x^ p

Because the terms in this mass function form a geometric sequence, X is called a geometric random variable

Mass Functions

Recall that a geometric sequence c, cr , cr 2 ,... , cr n^ has sum

sn = c + cr + cr 2 + · · · + cr n^ = c(1 − r n+1) 1 − r

for r 6 = 1. If |r | < 1, then limn→∞ r n^ = 0 and thus sn has a limit as n → ∞. In this case, the infinite sum is the limit

c + cr + cr 2 + · · · + cr n^ + · · · = lim n→∞ sn = c 1 − r

Thus,

x=0 fX^ (x) =^

x=0(1^ −^ p) x (^) p = p 1 −(1−p) = 1.

F (b) = P{X > b} =

∑^ ∞

x=b+

fX (x) =

∑^ ∞

x=b+

(1 − p)x^ p = (1 − p)b+1p 1 − (1 − p)

= (1 − p)b+

and FX (b) = 1 − (1 − p)b+1^ for b = 0, 1 , 2 ,.. ..

Mass Functions

Example An urn contains balls numbers 1 through n. From these r are removed at random. Let X be the maximum value of the removed balls.

If they are removed with replacement, then the distribution function

FX (x) = P{X ≤ x} =

( (^) x n

)r .

The mass function

fX (x) = P{x − 1 < X ≤ x} = FX (x) − FX (x − 1) =

( (^) x n

)r −

x − 1 n

)r .

Mass Functions

If they are removed without replacement, then the distribution function

FX (x) = P{X ≤ x} =

(x r

(n r

) (^) = (x)r (n)r

The mass function

fX (x) = P{x − 1 < X ≤ x} = FX (x) − FX (x − 1)

=

(x r

(n r

(x− 1 r

(n r

(x− 1 r − 1

(n r

by the Pascal triangle identity.

Density Functions

For X a random variable whose distribution function FX has a derivative. The function fX satisfying

FX (x) =

∫ (^) x

−∞

fX (t) dt

is called the probability density function and X is called a continuous random variable.

By the fundamental theorem of calculus, the density function is the derivative of the distribution function.

fX (x) = lim ∆x→ 0

FX (x + ∆x) − FX (x) ∆x = F (^) X′ (x).

In other words, if ∆x is small,

FX (x + ∆x) − FX (x) ≈ fX (x)∆x.

Density Functions

We can compute probabilities by evaluating definite integrals

P{a < X ≤ b} = FX (b) − FX (a)

=

∫ (^) b

a

fX (t) dt.

The density function has two basic proper- ties that mirror the properties of the mass function:

  • (^) fX (x) ≥ 0 for all x in the state space.

−∞ fX^ (x)^ dx^ = 1.

Figure: Integral of density function fX (x). Shaded region has area P{a < X ≤ b}.

Density Functions

Exercise. Let X be a continuous random variable with density

fX (x) =

0 if x ≤ 0 , 1 2 √x if 0^ <^ x^ ≤^1 , 0 if 1 < x.

  1. Sketch a graph of fX. Notice that fX is not bounded.
  2. Show that fX is a density function and find its distribution function FX. FX (x) = 0, x < 0, =

x, 0 ≤ x < 1, = 1, 1 < x

  1. Use distribution function to find P{X ≤ 1 / 4 } and P{ 1 / 4 ≤ X ≤ 1 / 2 }. 1 /2,

Exercise. Generalize the notion of mixtures to continuous random variables.

Hazard Functions

The hazard function h(x) for a continuous nonnegative random variable is the rate of failure at time x. More precisely,

h(x) = lim ∆x→ 0

∆x P{X ≤ x + ∆x|X ≥ x}

If X has cumulative distribution FX and density fX , then

1 ∆x

P{X ≤ x + ∆x|X ≥ x} = P{x < X ≤ x + ∆x} ∆x P{X ≥ x}

= FX (x + ∆x) − FX (x) ∆x (1 − FX (x))

fX (x) (1 − FX (x))

as ∆x → 0. Thus,

h(x) =

fX (x) (1 − FX (x))

d dx ln(1 − FX (x)).

Joint Distributions

Experimental procedures use data based on multiple observations. Consequently, we will expand on the concepts above to the case of multiple random variables and their joint distribution. For the case of two random variables, X 1 and X 2 , this means looking at the probability of events,

P{X 1 ∈ B 1 , X 2 ∈ B 2 }.

For discrete random variables, take B 1 = {x 1 } and B 2 = {x 2 } and define the joint probability mass function

fX 1 ,X 2 (x 1 , x 2 ) = P{X 1 = x 1 , X 2 = x 2 }.

For continuous random variables, we consider B 1 = (x 1 , x 1 + ∆x 1 ] and B 2 = (x 2 , x 2 + ∆x 2 ] and ask that for some function fX 1 ,X 2 , the joint probability density function satisfies

P{x 1 < X 1 ≤ x 1 + ∆x 1 , x 2 < X 2 ≤ x 2 + ∆x 2 } ≈ fX 1 ,X 2 (x 1 , x 2 )∆x 1 ∆x 2.

Independent Random Variables

For independent discrete random variables, we have that

fX 1 ,X 2 (x 1 , x 2 ) = P{X 1 = x 1 , X 2 = x 2 } = P{X 1 = x 1 }P{X 2 = x 2 } = fX 1 (x 1 )fX 2 (x 2 ).

In this case, we say that the joint probability mass function is the product of the marginal mass functions. A similar identity for independent continuous random variables.

Exercise. Roll two dice and consider equally likely outcomes. Let X 1 be the value on the first die and X 2 be the value on the second. Show that X 1 and X 2 are independent.

Simulating Discrete Random Variables

Exercise.

  1. Repeat the simulation and compare the values using the table command.
  2. For equally likely outcomes, repeat the simulation, remove prob=f and make a table. Describe the differences in the tabulated values.
  3. Simulate 80 observations of a fair die and make a table.
  4. Simulate 80 observations of an unfair die whose mass function is given below. x 1 2 3 4 5 6 fX (x) 1/12 1/12 1/12 1/4 1/4 1/
  5. Compute the mean and standard deviation of the observations. Describe the differences in the tabulated values for the fair and unfair die.

Exercise. Simulate the number of ♦’s from 5 cards drawn random from a standard deck. Compare your results with the mass function.

Simulating Discrete Random Variables

Exercise. Give the mass function for the random variable X , the maximum value on the roll of two independent die.

To simulate this,

x<-replicate(36000,max(sample(6,2,replace=TRUE))) table(x) x 1 2 3 4 5 6 977 3081 4949 7018 8982 10993

For the minimum,

x<-replicate(36000,min(sample(6,2,replace=TRUE))) table(x) x 1 2 3 4 5 6 11036 9097 6878 5027 2943 1019