Exercise Set 07: Monte Carlo Simulations

BEE 4850/5850, Fall 2024

Due Date

Friday, 3/08/24, 9:00pm

You can find a Jupyter notebook, data, and a Julia 1.9.x environment in the exercise’s Github repository. You should feel free to clone the repository and switch the notebook to another language, or to download the relevant data file(s) and solve the problems without using a notebook. In either of these cases, if you using a different environment, you will be responsible for setting up an appropriate package environment.

Regardless of your solution method, make sure to include your name and NetID on your solution PDF for submission to Gradescope.

Overview

Instructions

The goal of this exercise is for you to explore how sensitive Monte Carlo estimates can be to the underlying probability distribution(s).

Load Environment

The following code loads the environment and makes sure all needed packages are installed. This should be at the start of most Julia scripts.

import Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()

The following packages are included in the environment (to help you find other similar packages in other languages). The code below loads these packages for use in the subsequent notebook (the desired functionality for each package is commented next to the package).

using Distributions # API to work with statistical distributions
using Plots # plotting library
using StatsBase # statistical quantities like mean, median, etc
using StatsPlots # some additional statistical plotting tools

Problems

Problem 1

A common engineering problem is to quantify flood risk, which is typically computed by propagating a flood hazard distribution through a depth-damage function relating flood depths to economic damages. A reasonable depth-damage function is a bounded logistic function, \[d(h) = \mathbb{1}_{x > 0} \frac{L}{1 + \exp(-k (x - x_0))},\]

where \(d\) is the damage as a percent of total structure value, \(h\) is the water depth in m, \(\mathbb{1}_{x > 0}\) is the indicator function, \(L\) is the maximum loss in USD, \(k\) is the slope of the depth-damage relationship, and \(x_0\) is the inflection point. We’ll assume \(L=\$200,000\), \(k=0.75\), and \(x_0=4\).

For this problem, suppose that we have two different probability distributions characterizing annual maxima flood depths:

  1. \(h \sim LogNormal(1.5, 0.25)\);
  2. \(h \sim GEV(4.5, 1.5, 0.3)\).

To control for the variances in different programming languages and how they implement both the LogNormal and GEV distributions, match your distributions to the figure below.

plot(LogNormal(1.5, 0.3), xlims=(0, 10), xlabel="Annual Maximum Flood Depth", ylabel="Probability Density", label="LogNormal(1.5, 0.25)")
plot!(GeneralizedExtremeValue(4.5, 1.5, 0.3), label="GEV(4.5, 1.5, 0.3)")
UndefVarError: `LogNormal` not defined
Stacktrace:
 [1] top-level scope
   @ ~/Teaching/BEE4850/sp24/exercises/ex07/ex07.qmd:107

What are the Monte Carlo estimates of the expected value and the 99% quantile for the annual maximum damage the structure would suffer for each of these flood hazard distributions? How did you ensure your sample size was sufficiently large? Why do you think the estimates differed or did not differ?

References