8.5 Exercises
Exercise 8.1 Consider 8.11. Develop a bootstrap confidence interval for the median profit. Report your confidence interval at the 0.99 level.
Exercise 8.2 Consider 8.11. Develop a bootstrap confidence interval for the minimum profit. Report your confidence interval at the 0.99 level.
Exercise 8.3 Consider the following probability density function:
\[ f(x) = \begin{cases} \frac{5x}{16} + \frac{3x^3}{32} + \frac{5x^4}{256} & 0 \leq x \leq 2\\ 0 & \text{otherwise} \\ \end{cases} \]
In all cases, implement and test your algorithms.
Develop an algorithm to generate random variables from the probability density function that uses both the inverse transform method and the composition method (together).
Develop an algorithm to generate random variables from the probability density function that uses acceptance rejection.
Exercise 8.4 Consider the following probability density function:
\[ f(x) = \begin{cases} \dfrac{2x}{25} & 0 \leq x \leq 5\\ 0 & \text{otherwise} \\ \end{cases} \]
Write a KSL program to generate observations from this distribution using MCMC.
Exercise 8.5 Consider the following probability density function:
\[f(x) = \begin{cases} \dfrac{3x^2}{2} & -1 \leq x \leq 1\\ 0 & \text{otherwise} \\ \end{cases}\]
Write a KSL program to generate observations from this distribution using MCMC.
Exercise 8.6 Use the Monte Carlo method and antithetic variates to estimate the following integral with 95% confidence to within \(\pm 0.01\).
\[\int\limits_{1}^{4} \left( \sqrt{x} + \frac{1}{2\sqrt{x}}\right) \mathrm{d}x\]
Exercise 8.7 Use the Monte Carlo method and antithetic variates to estimate the following integral with 99% confidence to within \(\pm 0.01\).
\[\theta = \int\limits_{0}^{1} \int\limits_{0}^{1} \left( 4x^{2}y + y^{2}\right) \mathrm{d}x \mathrm{d}y\]
Exercise 8.8 Use the Monte Carlo method and importance sampling to estimate the following integral with 95% confidence to within \(\pm 0.01\).
\[\int\limits_{1}^{4} \left( \sqrt{x} + \frac{1}{2\sqrt{x}}\right) \mathrm{d}x\]
Exercise 8.9 Use the Monte Carlo method and importance sampling to estimate the following integral with 99% confidence to within \(\pm 0.01\).
\[\theta = \int\limits_{0}^{1} \int\limits_{0}^{1} \left( 4x^{2}y + y^{2}\right) \mathrm{d}x \mathrm{d}y\]
Exercise 8.10 A firm is trying to decide whether or not to invest in two proposals A and B that have the net cash flows shown in the following table, where \(N(\mu, \sigma)\) represents that the cash flow value comes from a normal distribution with the provided mean and standard deviation.
End of Year | 0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|---|
A | \(N(-250, 10)\) | \(N(75, 10)\) | \(N(75, 10)\) | \(N(175, 20)\) | \(N(150, 40)\) |
B | \(N(-250, 5)\) | \(N(150, 10)\) | \(N(150, 10)\) | \(N(75, 20)\) | \(N(75, 30)\) |
The interest rate has been varying recently and the firm is unsure of the rate for performing the analysis. To be safe, they have decided that the interest rate should be modeled as a beta random variable over the range from 2 to 7 percent with \(\alpha_1 = 4.0\) and \(\alpha_2 = 1.2\). Given all the uncertain elements in the situation, they have decided to perform a simulation analysis in order to assess the situation. Use to answer the following questions:
Compare the expected present worth of the two alternatives using common random numbers. Estimate the probability that alternative A has a higher present worth than alternative B.
Determine the number of samples needed to be 95% confidence that you have estimated the \(P[PW(A) > PW(B)]\) to within \(\pm\) 0.10.
Exercise 8.11 A firm produces YBox gaming stations for the consumer market. Their profit function is: \[\text{Profit} = (\text{unit price} - \text{unit cost})\times(\text{quantity sold}) - \text{fixed costs}\]
Suppose that the unit price is $200 per gaming station, and that the other variables have the following probability distributions:
Unit Cost | 80 | 90 | 100 | 110 |
---|---|---|---|---|
Probability | 0.20 | 0.40 | 0.30 | 0.10 |
Quantity Sold | 1000 | 2000 | 3000 | |
Probability | 0.10 | 0.60 | 0.30 | |
Fixed Cost | 50000 | 65000 | 80000 | |
Probability | 0.40 | 0.30 | 0.30 |
Use a simulation model with antithetic variates to estimate the mean profit from your sample and compute a 95% confidence interval for the mean profit. Estimate the probability that the profit will be positive.
Exercise 8.12 YBox video game players arrive at a two-person station for testing. The inspection time per YBox set is EXPO(10) minutes. On the average 82% of the sets pass inspection. The remaining 18% are routed to an adjustment station with a single operator. Adjustment time per YBox is UNIF(7,14) minutes. After adjustments are made, the units are routed back to the inspection station to be retested. Build an simulation model of this system. Use a replication length of 30,000 minutes.
Use control variates to estimate the total time a set spends in the system.
Exercise 8.13 Create a model to simulate observations from a \(N(\mu, \sigma^2)\) random variable. Use your simulation to generate two independent samples of size \(n_1 = 20\) and \(n_2 = 30\) from normal distributions having \(\mu_1 = 2\), \(\sigma_1^2 = 0.64\) and \(\mu_2 = 2.2, \sigma_2^2 = 0.64\). Assume that you don’t know the true means and variances. Use the method of independent samples to test whether \(\mu_2 > \mu_1\).
Exercise 8.14 Create a model to simulate observations from a \(N(\mu, \sigma^2)\) random variable. Use your simulation to generate two independent samples of size \(n_1 = 20\) and \(n_2=30\) from normal distributions having \(\mu_1 = 2\), \(\sigma_1^2 = 0.64\), and \(\mu_2 = 2.2\), \(\sigma_2^2 = 0.36\). Assume that you don’t know the true means and variances. Use the method of independent samples to test whether \(\mu_2 > \mu_1\).
Exercise 8.15 Create a model to simulate observations from a \(N(\mu, \sigma^2)\) random variable. Use your simulation to generate two independent samples of size \(n_1 = 30\) and \(n_2 = 30\) from normal distributions having \(\mu_1 = 2\), \(\sigma_1^2 = 0.64\) and \(\mu_2 = 2.2\), \(\sigma_2^2 = 0.36\). Assume that you don’t know the true means and variances. Use the paired-t method to test whether \(\mu_2 > \mu_1\).
Exercise 8.16 Create a model to simulate observations from a \(N(\mu, \sigma^2)\) random variable. Use your simulation to generate two dependent samples of size \(n_1 = 30\) and \(n_2 = 30\) from normal distributions having \(\mu_1 = 2\), \(\sigma_1^2 = 0.64\) and \(\mu_2 = 2.2\), \(\sigma_2^2 = 0.36\). Use the method of common random number. Assume that you don’t know the true means and variances. Use the paired-t method to test whether \(\mu_2 > \mu_1\).
Exercise 8.17 Let \(X\) be a random variable with a lognormal distribution with mean 2.0, and variance 4.0. Let \(Y\) be a random variable with a Weibull distribution with shape 5.0 and scale 10.0. We are interested in generating the joint distribution of \((X, Y)\) when \(X\) and \(Y\) have dependence specified with the following copulas:
Gausian copula with correlation 0.8. Generate 1000 pairs of \((X, Y\)). Measure the Pearson, Kendall, and Spearman correlation between \(X\) and \(Y\). Make a 2-D plot of \((X, Y)\).
Clayton copula with \(\theta\), where \(U\) is the first coordinate and \(V\) is the second coordinate. Generate 1000 pairs of \((U, V)\) from the copula. Measure the Pearson, Kendall, and Spearman correlation between \(U\) and \(V\) when \(\theta = 2\). Generate 1000 pairs of \((X, Y\)) using the copula with mapping \(U\) to \(X\) and \(V\) to \(Y\). Measure the Pearson, Kendall, and Spearman correlation between \(X\) and \(Y\) when \(\theta = 2\). Make a 2-D plot of \((X, Y)\).
Frank copula with \(\theta\), where \(U\) is the first coordinate and \(V\) is the second coordinate. Generate 1000 pairs of \((U, V)\) from the copula. Measure the Pearson, Kendall, and Spearman correlation between \(U\) and \(V\) when \(\theta = 2\). Generate 1000 pairs of \((X, Y\)) using the copula with mapping \(U\) to \(X\) and \(V\) to \(Y\). Measure the Pearson, Kendall, and Spearman correlation between \(X\) and \(Y\) when \(\theta = 2\). Make a 2-D plot of \((X, Y)\).
Exercise 8.18 Suppose that the random variable \(X_1\) is the zinc content of an ore sample with a range of values in \([0.5, 1.5]\) and the random variable \(X_2\) is the iron content of the ore with values in \([20.0, 35.0]\). The joint distribution density function for the random variables has been modeled as:
\[ f(x_1, x_2) = \begin{cases} \frac{39}{400} - \frac{17(x_1 - 1)^2}{50} - \frac{(x_2 - 25)^2}{10000} & \, 0.5 \leq x_1 \leq 1.5; \, 20 \leq x_2 \leq 35\\ 0.0 & otherwise \end{cases} \]
Derive the marginal distributions for \(X_1\) and \(X_2\). Using the marginal distributions compute \(E[X_1]\), \(\text{Var}[X_1]\), \(E[X_2]\), \(\text{Var}[X_2]\).
Derive and compute \(\text{cov}(X_1, X_2)\) and \(\text{corr}(X_1, X_2)\).
Derive the conditional distributions for \(X_1|X_2\) and \(X_2|X_1\).
Exercise 8.19 Suppose that the random variable \(X_1\) is the zinc content of an ore sample with a range of values in \([0.5, 1.5]\) and the random variable \(X_2\) is the iron content of the ore with values in \([20.0, 35.0]\). The joint distribution density function for the random variables has been modeled as:
\[ f(x_1, x_2) = \begin{cases} \frac{39}{400} - \frac{17(x_1 - 1)^2}{50} - \frac{(x_2 - 25)^2}{10000} & \, 0.5 \leq x_1 \leq 1.5; \, 20 \leq x_2 \leq 35\\ 0.0 & otherwise \end{cases} \]
Design an independence sampler that is better than the sampler in the example from Section 8.3.4. .
Estimate the correlation of \((X_1, X_2)\) from the example’s implementation and for your sampler. Compare the estimated quantity to the theoretical value.
Report the acceptance probability estimate for your sampler.
Make a time series plot of the example’s \(x_1\) and \(x_2\) series. Make an ACF plot for the time series.
Make a time series plot of your independence sampler \(x_1\) and \(x_2\) series. Make an ACF plot for the time series.
Exercise 8.20 Suppose that the random variable \(X_1\) is the zinc content of an ore sample with a range of values in \([0.5, 1.5]\) and the random variable \(X_2\) is the iron content of the ore with values in \([20.0, 35.0]\). The joint distribution density function for the random variables has been modeled as:
\[ f(x_1, x_2) = \begin{cases} \frac{39}{400} - \frac{17(x_1 - 1)^2}{50} - \frac{(x_2 - 25)^2}{10000} & \, 0.5 \leq x_1 \leq 1.5; \, 20 \leq x_2 \leq 35\\ 0.0 & otherwise \end{cases} \]
Consider the following algorithm for generating a random vector \((X_1, X_2,\cdots,X_d)\) from a d-dimensional distribution \(F_{\vec{X}}(\vec{x})\). Let \(F_i(x_i|x_1, x_2,\cdots,x_{i-1})\) be the conditional distribution of \(X_i\) given that \(X_j = x_j\) for \(j=1,2,\cdots,x_{i-1}\). Let \(F_{X_i}(x_i)\) be the marginal distribution for \(X_i\), for \(i=1,2,\cdots,d\). Then a algorithm for generating \(\vec{X}\) with distribution \(F_{\vec{X}}(\vec{x})\) is:
- Generate \(X_1\) with distribution \(F_{X_1}(\cdot)\).
- Generate \(X_2\) with distribution \(F_{2}(\cdot|X_1)\).
- Generate \(X_3\) with distribution \(F_{3}(\cdot|X_1, X_2)\).
- etc.
- Generate \(X_d\) with distribution \(F_{d}(\cdot|X_1, X_2, \cdots, X_{d-1})\) and return \(\vec{X} = (X_1, X_2,\cdots,X_d)\).
Prove that the algorithm will result in \(\vec{X} \sim F_{\vec{X}}(\vec{x})\) for the 2-dimensional case of \((X_1, X_2)\).
Apply the algorithm to generate zinc and iron content, \((X_1, X_2)\), from \(f(x_1, x_2)\).
Estimate the correlation of \((X_1, X_2)\) from your implementation. Compare the estimated quantity to the theoretical value.
Provide a statistical analysis of the marginal samples when compared to the theoretical marginal distributions.
Exercise 8.21 Consider the following joint density of two random variables x and y given by:
\[ f(x,y) = \begin{cases} \frac{6}{5}(x+y^2) & 0 \leq x \leq 1; \, 0 \leq y \leq 1\\ 0 & \text{otherwise} \\ \end{cases} \]
Develop an algorithm to generate from this joint probability distribution.
Illustrate a histogram of the marginal distributions using your algorithm
Estimate the correlation between x and y using the data from your algorithm
Exercise 8.22 Suppose that the random variable \(X_1\) is the zinc content of an ore sample with a range of values in \([0.5, 1.5]\) and the random variable \(X_2\) is the iron content of the ore with values in \([20.0, 35.0]\). The joint distribution density function for the random variables has been modeled as:
\[ f(x_1, x_2) = \begin{cases} \frac{39}{400} - \frac{17(x_1 - 1)^2}{50} - \frac{(x_2 - 25)^2}{10000} & \, 0.5 \leq x_1 \leq 1.5; \, 20 \leq x_2 \leq 35\\ 0.0 & otherwise \end{cases} \]
Develop a Gibbs sampler for generating from this distribution.
Estimate the correlation of \((X_1, X_2)\) for your sampler. Compare the estimated quantity to the theoretical value.
Report the acceptance probability estimate for your sampler.
Make a time series plot of your Gibbs sampler \(x_1\) and \(x_2\) series. Make an ACF plot for the time series.
Exercise 8.23 Use Latin hyper-cube sampling to estimate the following integral with 99% confidence to within \(\pm 0.01\).
\[\theta = \int\limits_{0}^{1} \int\limits_{0}^{1} \left( 4x^{2}y + y^{2}\right) \mathrm{d}x \mathrm{d}y\]
Compare and contrast this method to the method you used in Exercise 8.7 or Exercise 8.9.