BEE 4850/5850 · Environmental Data Analysis and Simulation

Is the Surge Rising?

A p-value asks how often a world with no trend would produce a record like ours. Play against simulated worlds, then decide which cities should pay for protection.

Which Record Is Real?

The San Francisco tide gauge has recorded the water level every hour since 1897. For each year from 1898 to 2022, take the highest hourly level above the average of the surrounding fifteen days. Subtracting that average removes sea-level rise and the seasons, so what is left is high tide plus storm surge: 125 annual maxima, in metres.

One panel below is the real record. The other 19 are the same 125 values in a random order. If the real record has a trend, its order should give it away. Click the panel you think is real.

A lineup is a hypothesis test (Buja et al. 2009). If the values had no trend, every order would be equally likely, and you would pick the real record by luck 1 time in 20: finding it is evidence at the 0.05 level for whatever your eye was using.

A Test You Can Write Down

An eye is hard to describe and harder to repeat. A test replaces it with a number computed the same way every time, and replaces the 19 decoys with as many simulated records as we like.

  1. Statistic. The least-squares slope of the record: 0.41 mm per year.
  2. Null model. Each year is an independent Gaussian draw with the record's mean (1.29 m) and standard deviation (0.074 m). There is no trend.
  3. Simulate. Draw a 125-year record from the null model and fit its slope. Repeat.
  4. Compare. Place the observed slope among the simulated ones.
  5. p-value. The share of simulated slopes at least as large as the observed one.
\[\hat\beta = \frac{\sum_t (t - \bar t)(y_t - \bar y)}{\sum_t (t - \bar t)^2}, \qquad y^{*}_t \sim \mathcal{N}(\bar y, s^2) \text{ independently}, \qquad p = \Pr\left(\hat\beta^{*} \geq \hat\beta \mid H_0\right) \approx \frac{\#\{\hat\beta^{*}_k \geq \hat\beta\}}{N}\] The Monte Carlo standard error of the estimate is \(\sqrt{p(1-p)/N}\).

Before you simulate

If there were no trend, how often would a 125-year record show a slope of at least 0.41 mm per year?

Alternative

Latest simulated record

Slopes of the simulated records

The alternative sets the tail. A rise predicts a positive slope, so only simulated slopes at least as large as 0.41 count. If a trend in either direction would count, slopes at least 0.41 from zero on either side count, and p roughly doubles. The tail is chosen from the question before looking at the data.

A p-value is computed from data, so it is random too: another century of storms would give another p. The size of the trend is read from the slope, 0.41 mm per year, not from p.

Every Test Is a Statistic and a Null

Named tests are particular choices of these steps. Pick a statistic and a null model and simulate; the table fills in as you try combinations.

Statistic
Null model

Null modelSlopeS
Gaussian––
Resampled years––
Shuffled years––
Formula–
\(t\)-test
–
Mann–Kendall

One-sided p-values (a rise).

Two cells of the table have formulas. The \(t\)-test is the Gaussian null with the slope, worked out with mathematics instead of simulation. The Mann–Kendall test is the shuffled null with S, the number of later-higher pairs of years minus later-lower pairs, worked out with a Gaussian approximation. Each formula carries its null model's assumptions with it.

\[t = \frac{\hat\beta}{\widehat{\text{se}}(\hat\beta)} \sim t_{n-2} \text{ under the Gaussian null}, \qquad S = \sum_{i

The nulls agree here because the annual maxima barely depend on their neighbours: the correlation between one year's maximum and the next is 0.07. Every null in the table treats the years as exchangeable, meaning any year could trade places with any other.

When Neighbouring Years Are Alike

The Pacific Decadal Oscillation (PDO) index summarizes sea-surface temperatures in the North Pacific. Its annual means from 1900 to 2022 have a slope of −0.05 per decade, and a year's value is correlated with the next year's at 0.52. The PDO has no expected direction, so a trend either way counts.

Find the real PDO record. The other seven panels are shuffles of its values.

Decoys

A null model that is easy to tell apart from the data compares the data with the wrong world. Two nulls keep neighbouring years together: shuffle blocks of consecutive years instead of single years, or simulate an AR(1) series, in which each year is the previous year times the lag-1 correlation plus Gaussian noise.

\[\text{AR(1)}: \quad y^{*}_t = \rho\, y^{*}_{t-1} + \varepsilon_t, \qquad \varepsilon_t \sim \mathcal{N}\!\left(0,\ s^2(1-\rho^2)\right), \qquad y^{*}_1 \sim \mathcal{N}(0, s^2)\]
Record
Null model

The record and one simulated record

Slopes of the simulated records

For the PDO, shuffling single years gives p of about 0.03, 5-year blocks about 0.15, and an AR(1) null with the PDO's lag-1 correlation about 0.22. Runs of warm or cool years near one end of the record tilt the fitted line, and a null that breaks the runs apart makes large slopes look rarer than they are. For San Francisco, where neighbouring years are close to unrelated, 5-year blocks move p only from 0.014 to 0.030.

The block length is a modelling choice. Where the blocks start is too: each shuffle above draws the first block's length at random, and fixing it instead moves the PDO's p anywhere from 0.11 to 0.19.

Would the Test Catch a Real Rise?

A p-value uses only the null. To ask whether the test would notice a rise, plant one: simulate records with a true trend and the record's scatter, and count how often the fitted slope clears the critical value, the slope that only 5% of records with no trend exceed. That share is the power of the test against that trend, and one minus the power is the Type II error rate.

Before you simulate

Plant a rise of 5 cm per century (0.5 mm per year). The full 125-year record catches it most of the time. How often would the last 40 years alone catch it?

Planted trend (mm per year)
0.50
Record

Slopes with and without the planted trend

Power against each planted trend

Against a rise of 5 cm per century, the 125-year record has power of about 0.86 and the last 40 years about 0.12. A 40-year record that shows no significant trend says little about whether the water is rising: it would miss a rise that size nearly nine times in ten. Power is computed for a trend chosen in advance; computing it at the observed slope only restates the p-value.

Which Cities Should Pay for Protection?

You advise twelve coastal cities. In about three of every ten, storm-surge maxima are rising by 5 cm per century; in the rest there is no trend. You don't know which cities are which. Each city has a 40- or 125-year record with the same scatter as San Francisco's, and you see its slope and one-sided p-value.

Protection costs 1 unit. A city that waits pays nothing if its water isn't rising and 4 units in damage if it is. Keep the total low.

City 1 of 12

A Thousand Cities

The same question for 1,000 simulated cities, with a fixed rule: fund protection when \(p\) is below a threshold. Each dot is a city.

Share of cities rising
0.30
Fund when p is below
0.050
Record length
Damage if a rising city waits
4.0

Cost per city for each threshold

A p-value below 0.05 does not mean a 5% chance that the city's water isn't rising. The p-value is the chance of a slope this large if there were no rise. How often an alarm is false depends also on how many cities are rising and how often the test catches a rise, and the p-value knows neither. The cheapest threshold depends on the costs: when a missed rise costs far more than protection, the cheapest rule funds cities whose p-values are well above 0.05.