import Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()BEE 4750 Homework 4: Monte Carlo, Uncertainty, and Risk
If you are enrolled in the course, use the assignment link posted on Ed Discussion so that we can find your repository if you need help.
Overview
Instructions
- Problem 1 consists of problems that should be solved by hand: expectations, Monte Carlo error, and return periods.
- Problem 2 is a short computational Monte Carlo analysis: propagate a flood hazard distribution through a depth-damage function.
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.
using Random
using Distributions
using Statistics
using PlotsProblems (Total: 50 Points)
Problem 1 (30 points)
Problem 1.1 (8 points)
A treatment unit removes a fraction \(R\) of the incoming load, where \(R\) is uncertain with mean \(\mathbb{E}[R] = 0.6\) and variance \(\text{Var}(R) = 0.01\). The incoming load is a known constant \(B_0 = 50\) mg/L, so the load leaving the unit is \(Y = B_0(1 - R)\).
Find \(\mathbb{E}[Y]\) and \(\text{Var}(Y)\).
Now suppose the quantity you care about is the square of the outgoing load, \(Z = Y^2\). Is \(\mathbb{E}[Z]\) equal to \(\left(\mathbb{E}[Y]\right)^2\)? Compute both and state the difference.
In one or two sentences, explain what this implies about running an environmental model once at the mean value of an uncertain input.
Problem 1.2 (7 points)
You are estimating a probability by Monte Carlo. With \(n = 2,000\) samples your estimate is \(\hat{p} = 0.08\) and the standard error is \(0.006\).
Write down the 95% confidence interval.
You need the standard error to be no larger than \(0.002\). How many samples will that take?
A colleague proposes reducing your error instead by using a finer spatial grid in the underlying simulation. Will that help with this source of error? Explain.
Problem 1.3 (7 points)
A pump station is designed against the 50-year flood.
What annual exceedance probability does that correspond to?
The station has a 20-year service life. Assuming years are independent, write the expression for the probability that it is overtopped at least once during that life. You do not need to evaluate it.
Your client says: “the station was overtopped last year, so we have another 49 years before it happens again.” Explain what is wrong with this.
Problem 1.4 (8 points)
Classify each of the following as primarily aleatory or primarily epistemic uncertainty, and justify each in one sentence.
- The daily variation in influent flow to a treatment plant.
- The strength of the ice-albedo feedback.
- The rate of sediment recycling in a shallow lake.
- Which of next year’s storms will be the largest.
Problem 2 (20 points)
Flood risk is usually quantified by propagating a distribution of flood depths through a depth-damage function, which converts a dflood epth into an economic loss. A common form for a house without a basement is a bounded logistic curve,
\[d(h) = \mathbb{1}_{h > 0} \frac{L}{1 + \exp\left(-k(h - h_0)\right)},\]
where \(h\) is the flood depth in metres and \(d\) is the damage in dollars. We’ll use \(L = \$200,000\), \(k = 0.8\), and \(h_0 = 3\) in our depth-damage function specification.
Assume the annual maximum flood depth at this structure is distributed as
\[h \sim \text{LogNormal}(1.2,\ 0.3).\]
Problem 2.1 (5 points)
Implement the depth-damage function and plot it over depths from 0 to 8m. On a second panel, plot the density of the hazard distribution over the same range.
Looking at the two panels together: over what range of depths does a small change in depth produce the largest change in damage?
function depth_damage(depth)
# TODO: return the damage in dollars for a flood of this depth.
# A depth at or below zero causes no damage.
error("depth_damage has not been written yet -- replace this line")
endProblem 2.2 (8 points)
Estimate the expected annual damage using Monte Carlo.
Report your estimate, a 95% confidence interval, the sample size you used, and the seed you set. Then justify the sample size by doubling it and comparing the estimates.
Problem 2.3 (7 points)
Now estimate the 99th percentile of annual damage. How much larger is this than the mean?
For the same number of samples, your estimate of the 99th percentile is less precise than your estimate of the mean. Explain why.
Your analysis produces a distribution of damages, not a distribution of depths. In one or two sentences, explain why just modeling depth does not fully capture risk, and identify which component of risk the depth-damage function represents. Is anything missing from this as a risk analysis?
References
List any external references consulted, including classmates.