1. The objective of this part is to generate random variables of various kinds and measure their probability
distributions. Additionally, you will estimate the mean and variance of random variables of various kinds.
a. Generate a sequence of each of the following types of random variables; each sequence should be
at least 10,000 points long.
i. A Poisson random variable as a limiting case of the binomial random variable with p =
0.25 or less and n = 40 or more while maintaining a = np = 1.
ii. A type 1 geometric random variable with parameter p = 0.30.
iii. A uniform distributed random variable in the range (-2,3].
iv. A Gaussian distributed random variable with mean y = 2 and variance o? = 5.0.
V. An exponential random variable with parameter 1 = 2.5.
vi. A binomial random variable. Let the number of Bernoulli trials ben 20. Recall that
the binomial random variable is defined as the number of 1s in n trials for a Bernoulli
(binary) random variable. Let the parameter p in the Bernoulli trials be p = 0.7.
b. Estimate the CDF and PDF or PMF as appropriate and plot these functions next to their theoretical
counterparts. Compare and comment on the results obtained.
For each type of random variable described in Steps a-i to a-vi, calculate the theoretical mean and
variance,
d. Estimate the mean and the variance of these random variables using the following formulas:
C.
Answers
Answer:
variable X has the normal distribution with mean μ and variance σ 2
written more
concisely as X ∼ N
μ, σ 2
if X has the pdf given by
n
x;μ, σ 2
= (2π )−1/2
σ −1
e−(x−μ)2/(2σ2) − ∞ < x < ∞.
It follows then that Z = (X − μ)/σ ∼ N(0, 1) and that
P[X ≤ x] = P
Z ≤
x − μ
σ
=
x − μ
σ
,
where (x) =
x
−∞(2π )−1/2e−1
2 z2
dz is known as the standard normal distribu-
tion function. The significance of the terms mean and variance for the parameters
μ and σ 2 is explained below (see Example A.1.1).
(b) The uniform distribution on [a, b]. The pdf of a random variable uniformly dis-
tributed on the interval [a, b] is given by
u(x; a, b) =
⎧
⎪⎨
⎪⎩
1
b − a
, if a ≤ x ≤ b,
0, otherwise.
(c) The exponential distribution with parameter λ. The pdf of an exponentially dis-
tributed random variable with parameter λ > 0 is
e(x; λ) =
⎧
⎨
⎩
0, if x < 0,
λe−λx
, if x ≥ 0.
The corresponding distribution function is
F(x) =
0, if x < 0,
1 − e−λx
, if x ≥ 0.
(d) The gamma distribution with parameters α and λ. The pdf of a gamma-distributed
random variable is
g(x; α, λ) =
⎧
⎨
⎩
0, if x < 0,
xα−1λαe−λx
/ (α), if x ≥ 0,
where the parameters α and λ are both positive and is the gamma func