STA380H5: Computational Statistics - Fall 2022
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
STA380H5: Computational Statistics - Fall 2022
Final Project
1. Consider the following two probability density functions:
f(x) = for a < x < b
and
g(x) = for a < x < b,
where a and b are finite real numbers.
(a) Write an appropriate introduction for this project.
(b) Show that la(b) f(x)dx = la(b) g(x)dx = 1.
(c) Find the cumulative distribution functions F(x) and G(x).
(d) Write an algorithm to generate a sample from f(x) using the inverse-transform algorithm.
(e) Set a = 0 and b = 1. If X ∼ f(x), show that 1 − X ∼ g(x). Also, for a = 0 and b = 1, if X ∼ g(x),
show that 1 − X ∼ f(x). Note: ∼ means ‘has’ .
(f) If X ∼ h1 (x) = 2x, for 0 < x < 1, show that Y = a + (b − a)X ∼ f . Also, if X ∼ h2 (x) =
2(1 − x), for 0 < x < 1, show that Y = a + (b − a)X ∼ g .
(g) Derive the inverse-transform algorithm for generating samples from h1 and h2 .
(h) Explain how you would extend the algorithms developed in part (g) to generate a sample from f
and a sample from g .
(i) If U1 and U2 are two independent random variable from Uniform[0 , 1], show that Z = max(U1 ,U2 ) has density h1 .
(j) Use part (i) to propose an algorithm to sample from f . Note, this algorithm should be different
from the one proposed in part (d) and part (h).
(k) Set a = 1,b = 5. Using R/RStudio and the algorithms in part (d) (or (h)) and part (j), generate two
samples of size 106 from f . For the generated samples, plot the relative frequency histogram and the corresponding density on the same picture. Use the option “breaks=”Scott”” in the histogram and make appropriate titles. Report the sample mean and the sample variance for each case. Compare it with the exact mean and the exact variance.
(l) Propose an acceptance-rejection algorithm to generate a sample of size 106 from f for a = 1,b = 5. Using R/RStudio, compare this method with the previous two algorithms. Use an appropriate method for comparison. Which one do you recommend? Why?
2. Let Y1 and Y2 be two independent random variables from N(0, 1). Set X = .
(a) Write an appropriate introduction for this project.
(b) Show that fX (x) = , −∞ < x < ∞ . Hint: Use the Jacobian technique: X1 = and
X2 = Y2 .
(c) Find E(X).
(d) Show that FX (x) = arctan(x) + . (e) Find F1 (x).
(f) Write an algorithm to generate a random variable from the distribution of X using the inverse
transform method.
(g) Using R/RStudio, based on your algorithm in (f), simulate a sample of size 106 from the distribution
of X . For the generated sample, plot the relative frequency histogram with the true density super- imposed for comparison. Use the option “breaks=”Scott”” in the histogram and make appropriate titles.
(h) Using R/RStudio, generate 5 different samples of size 106 from X . For each of the generated samples,
report the sample mean and the sample variance. Comment on the results.
(i) Use fX (x) as a target candidate/trial distribution, write the acceptance-rejection algorithm to gen- erate a sample from Y1 (i.e., N(0, 1)).
(j) Using R/RStudio, based on your algorithm in (i), generate a sample of size 106 from Y1 . For the
generated sample, plot the relative frequency histogram with the true density of Y1 superimposed for comparison. Use the option “breaks=”Scott”” in the histogram and make appropriate titles.
3. Let X be a continuous random variable with the following probability density function: f(x) = e −|x|3 , −∞ < x < ∞ ,
where c is a positive constant.
(a) Write an appropriate introduction for this project.
(b) Find a Monte Carlo estimation to c. Denote this estimator by . Hint: Use importance sampling.
Compare with the following densities on −∞ < x < ∞ :
f1 (x) = 0.5e−|x|
f2 (x) =
1 |
π(1 + x2 ) |
f3 (x) = ^e −x2 /2 .
You need to write the explicit formula of the estimator for each case.
(c) Using R/RStudio, for each of the above densities, provide the numerical value of .
(d) Find a Monte Carlo estimation estimate for E[X] and E[X2]. You may use based on f3 . You need to write the explicit formula of the estimator. Use R/RStudio to obtain the numerical values.
(e) Use another variance reduction technique to estimate c. You need to write the explicit formula of
the estimator. Using R/RStudio, provide the numerical value of and its mean squared error.
(f) Use the acceptance-rejection algorithm to generate a sample from f . Plot the relative frequency
histogram. Use the option “breaks=”Scott”” in the histogram and make appropriate titles.
(g) Find the exact value of c. Hint: Γ(z) =l0∞ xz−1e −xdx.
(h) Plot the true density on the same picture in part (f).
4. Consider the data given in the file lifetime.txt.
(a) Write an appropriate introduction for this project.
(b) Let X denote the lifetime. Estimate E(X) and provide appropriate confidence intervals. Comments
on the procedure and the results.
(c) Apply nonparametric bootstrap procedure to estimate med(X) and kurtosis(X) and 95%-quantile. Provide appropriate confidence intervals. Comments on the procedure and the results.
(d) Verify that data follow an exponential distribution with mean 1/λ . Find , the maximum likelihood estimator of λ . Hint: You may use the one-sample Kolmogorov-Smirnov Test in R/RStudio.
(e) Apply parametric bootstrap procedure to estimate med(X), kurtosis(X) and 95%-quantile. Provide
appropriate confidence intervals. Comments on the procedure and the results.
(f) Compare values obtained via bootstrap to the theoretical values (based on the estimated ).
2022-12-01