Applied statistics (ESB: RISK)

Frontpage Lecture plan Vidcasts Datasets R install help

Monte Carlo simulations

Lecture material

This lecture as: slideshow (html), Rmarkdown (Rmd), notes (pdf).

The entire module: notes (pdf).

Exercises

Exercise 1

Re-run all the examples from the lecture and be sure to understand the method and the code.

Exercise 2

Expand Example 3 (Bivariate reliability problem) from the lecture.

Go back to using normally distributed B and C. In the original example they were independent. Now we want to investigate if they are dependent, e.g. to account for inflation. We use the package mvtnorm to simulate from a bivariate normal distribution. This distribution is parameterised by a variances and covariance.

  1. Recall what variance, covariance and correlation are.

  2. Understand the code below. For example, read it and try it out, e.g. Sigma(-1), Sigma(0) and Sigma(1):

mu <- c(100, 50)
Sigma <- function(corr) {
  var <- 10^2
  # corBC = covBC / sqrt(varB*varC)
  # <=>
  # covBC = corBC * sqrt(varB*varC)
  cov <- corr*sqrt(var*var)
  matrix(c(var, cov, cov, var), nrow = 2)
}
library(mvtnorm)
set.seed(48)
x <- rmvnorm(n = 1, mean = mu, sigma = Sigma(1))
x
  1. Draw random samples for correlation of -1, -0.5, 0, 0.5 and 1 and illustrate these (in individual figures).

  2. Now, investigate the sensitivity of the correlation on P(g(B, C) < 0) for correlation values ranging from -0.95 to 0.95. Remember figure(s).

Exercise 3

Expand Example 4 (Wholesales offer) from the lecture.

  1. Investigate how the probability of sales more than $6 mio. depends on the probability of getting the patent.

Exercise 4

Expand Example 3 (Bivariate reliability problem) from the lecture

Use Gamma distributed variables for budget and expected costs (read about the gamma distribution e.g. [WMMY] Sec. 6.6, note that [WMMY] uses α and β to denote shape and scale).

  1. Find parameter values of shape and scale that approximately resembles the corresponding normal distribution.

  2. Do the Monte Carlo approximation of P(g(B, C) < 0). Note that rgamma() is used to sample from a gamma distribution. Is the probability similar or different from when using the normal distribution?

  3. Draw a scatterplot and mark the points where g(B, C) < 0.