HW8_solution
.pdf
keyboard_arrow_up
School
University of Texas *
*We aren’t endorsed by this school
Course
440
Subject
Industrial Engineering
Date
Jan 9, 2024
Type
Pages
11
Uploaded by surker21
CEE 373
Homework #8
Due date: November 10 at 5pm
Total: 100 points
1. (40 points)
[Computer required]
Before solving this problem, please review the
starter code:
https://colab.research.google.com/drive/1Qg2waI348FMSqB5cRJv1O2mj9CwpWzHP?
usp=sharing
Let’s revisit your monthly salary as a newly graduated engineer with your E.I.T.
certification in hand from last homework. Again, the starting salary for graduate
engineers with their E.I.T. certification is uniformly distributed between
$
70,000
to
$
110,000 per year.
You are still interested in
X
, which is 30% of your monthly salary.
Now, you will answer questions about
X
using Monte Carlo Simulation.
(a) Generate 1,000,000 samples of
X
.
Plot these samples in a histogram in
comparison with the PDF of
X
.
(b) Consider
Y
to be the monthly amount your potential roommate can put
towards rent. This is independent and identically distributed to
X
.
You are again interested in your combined monthly salary that can go to-
wards rent,
Z
=
X
+
Y
. Using Monte Carlo Simulation, generate 1,000,000
samples of
Z
. Plot a histogram of these samples with the PDF of
Z
(you
already calculated the PDF in HW7).
(c) Using your Monte Carlo simulation results, calculate the probability of
Z
being greater than or equal to
$
4000 (
P
(
Z
≥
4000)). Compare this to the
probability you calculated in Homework 7.
(d) You believe your sample mean is equal to the true mean of
X
when you draw
multiple samples from
X
. Employ the Central Limit Theorem (CLT) to cal-
culate the true mean (
µ
X
) and standard deviation (
σ
X
) of the sample mean
(
X
) for the following sample sizes:
n
=
{
1
,
2
,
10
,
30
,
300
}
. This calculation
can be done by hand.
(e) For each of the specified sample sizes,
n
=
{
1
,
2
,
10
,
30
,
300
}
, perform the
following steps.
1. Generate
n
samples of
X
2. Calculate the sample mean
X
3. Repeat (1) and (2)
k
= 1
,
000 times
4. Plot a histogram of your results from (1) - (3) and compare this to
the normal PDF using the calculated respective mean and standard
deviation from part (e)
What do you observe about the comparison between the histogram and the
Normal PDF for all values of
n
?
Page 1 of 11
CEE 373
Homework #8
(f) Do the same as part (e), now using an exponential distribution,
E
, with
λ
= 0
.
25 instead of
X
(g) Now consider that your roommate and your combined income is
T
=
cos
3
(
xy
)+
sin
(
y
). Using Monte Carlo Simulation, obtain the PDF of T,
f
T
(
t
) and plot.
Solution:
This is the solution code (
https://colab
.
research
.
google
.
com/drive/1LNI39Lf95pUZTo2M1xLyaIEPHJ
sharing
) for the answers and figures.
(a) The density histogram of Monte Carlo simulation with 1,000,000 samples and
PDF of X.
(b) - PDF of Z from the HW 7:
f
(
z
) =
(
0
.
001
1000
(
z
−
3500)
(3500
≤
z
≤
5500)
−
0
.
001
1000
(
z
−
5500)
(4500
< z
≤
5500)
- Monte Carlo simulation
Draw 1,000,000 samples of X and Y from the uniform distribution.
X
∼
Uniform
(1750
,
2750)
, Y
∼
Uniform
(1750
,
2750)
Z values are the sum of X and Y sampling values.
When drawing PDF and density histogram of samples,
Page 2 of 11
CEE 373
Homework #8
The shape of density histogram is close to the PDF of Z.
(c) - Using PDF:
P
(4000) =
Z
5500
4000
f
(
z
)
dz
= 0
.
875 (
See HW
7
solution
)
- Using Monte Carlo simulation:
P
(
Z
≥
5000) =
the number of samples higher than
4000
the number of total samples
≈
0
.
875
(The values can be different, but it should be close to 0.875).
(d) The mean of PDF:
E
(
X
) =
µ
X
=
Z
2750
1750
xf
(
x
)
dx
= 2250
The variance of PDF:
V ar
(
X
) =
σ
2
X
=
Z
2750
1750
(
z
−
µ
X
)
2
f
(
x
)
dx
= 288
.
68
2
The mean of sample mean:
µ
X
=
µ
X
= 2250
Page 3 of 11
CEE 373
Homework #8
µ
X
does not depending on the sample sizes.
The standard deviation of sample mean:
σ
X
=
r
V ar
(
X
)
n
=
288
.
68
√
n
When n =
{
1, 2, 10, 30, 300
}
, the value of
σ
Z
is 288.68, 204.12, 91.29, 52.70,
and 16.66 for each n.
(e) -If
n = 1
, make 1,000 sample sets having
one
sample and calculate the sam-
ple mean value for each sample set. The theoretical PDF
X
would be close to
Normal(2250, 288.68
2
).
-If
n = 2
, make 1,000 sample sets having
two
samples and calculate the sam-
ple mean value for each sample set. The theoretical PDF
X
would be close to
Normal(2250, 204.12
2
).
-If
n = 10
, make 1,000 sample sets having
ten
samples and calculate the
sample mean value for each sample set.
The theoretical PDF
X
would be
close to Normal(2250, 91.29
2
).
-If
n = 30
, make 1,000 sample sets having
thirty
samples and calculate the
sample mean value for each sample set. The theoretical PDF
X
would be close
to Normal(2250, 52.70
2
).
-If
n = 300
, make 1,000 sample sets having
three hundred
samples and
calculate the sample mean value for each sample set. The theoretical PDF
X
would be close to Normal(2250, 16.66
2
).
When n increases, the shape of density histogram is close to the normal dis-
tribution.
Page 4 of 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help