Docsity

Computer Assignments: Probability Estimation with Exponential & Normal Distributions, Assignments of Mathematics

Toggle sidebar
bg1
Notes on Computer Assignment 1
Math 5040 โ€“ Fall 2002
See the attached program simexp.c for a C program which generates 100 exponential(1)
random variables and counts the fraction below 1 and above 2.
Executing this program yields the following output:
fraction less than 1 is 0.640000
fraction greater than 2 is 0.160000
Let us compare these proportions with the probabilities
๎˜€
{X < 1}and
๎˜€
{X > 2}:
๎˜€
{X < 1}=Z1
0
eโˆ’x
=โˆ’eโˆ’x๎˜Œ
๎˜Œ
1
0
= 1 โˆ’eโˆ’1
= 0.632
๎˜€
{X > 2}=eโˆ’2
= 0.135
Notice that we have estimated p1=
๎˜€
{X < 1}by
ห†p1=1
100
100
X
i=1
1{Xi<1},
where X1,...,X100 are i.i.d. exponential random variables.
What is the variance in our estimate?
Var(p1) = 1
1002100 Var(1{X1<1})
=1
100(0.632)(0.368)
= 0.00233
Thus the standard deviation of ห†p1is 0.0482. Clearly ห†p1has expectation equal to p1.
Thus our simulation makes sense: our estimate fell within a standard deviation of its mean.
See the attached C program normal.c, which generates 100 normal r.v.s by the rejection
method, and counts the fraction in (โˆ’1,1).
The output of the program is
fraction of 100 independent normals in (-1,1) is 0.72
By comparison, the probability a standard normal is in (โˆ’1,1) is about 0.68.
1

Partial preview of the text

Download Computer Assignments: Probability Estimation with Exponential & Normal Distributions and more Assignments Mathematics in PDF only on Docsity!

Notes on Computer Assignment 1

Math 5040 โ€“ Fall 2002

See the attached program simexp.c for a C program which generates 100 exponential(1) random variables and counts the fraction below 1 and above 2. Executing this program yields the following output: fraction less than 1 is 0. fraction greater than 2 is 0.

Let us compare these proportions with the probabilities

{X < 1 } and

{X > 2 }: {X < 1 } =

0

eโˆ’x

= โˆ’eโˆ’x

โˆฃ^1

0 = 1 โˆ’ eโˆ’^1 = 0. 632 {X > 2 } = eโˆ’^2 = 0. 135 Notice that we have estimated p 1 =

{X < 1 } by

pห† 1 =

โˆ‘^100

i=

1 {Xi < 1 } ,

where X 1 ,... , X 100 are i.i.d. exponential random variables. What is the variance in our estimate?

Var(p 1 ) =

100 Var( 1 {X 1 < 1 })

=

Thus the standard deviation of ห†p 1 is 0.0482. Clearly pห† 1 has expectation equal to p 1. Thus our simulation makes sense: our estimate fell within a standard deviation of its mean.

See the attached C program normal.c, which generates 100 normal r.v.s by the rejection method, and counts the fraction in (โˆ’ 1 , 1). The output of the program is fraction of 100 independent normals in (-1,1) is 0. By comparison, the probability a standard normal is in (โˆ’ 1 , 1) is about 0.68.