Skip to content

Correlated Monte Carlo and city bands

Module: quakecascade.montecarlo

What it computes

  • sample_damage_states_correlated(rng, probabilities, sigma_between, sigma_within, mode) produces one earthquake realization: a damage-state index for every building. Each building keeps its Hazus marginal distribution exactly, and the dependence between buildings comes from the shared ground-motion residual.
  • city_bands(damage, tau, phi, runs, seed, modes) gives percentiles of the city-wide count of buildings in each damage state across runs realizations, for each correlation mode and design level.
  • summarize_samples, validation_metrics and tornado are small helpers for Monte Carlo summaries, model checks against observations, and one-at-a-time sensitivity.

Without correlation the bands are misleading. Independent per-building draws average out over a city, so the band on a city total shrinks like a binomial, \(\sqrt{p(1-p)/n}\). In a real event, neighbouring buildings share the shaking.

Equations

A Gaussian copula on the fragility's own latent variable. The Hazus dispersion is split into a building-specific threshold part \(\beta_M\) and a demand part \(\beta_D\) (FEMA 2024, Section 5.4.3), and only the demand part is shared. For building \(i\) in one realization:

\[ g_i = \frac{\tau\,\eta + \phi\,\varepsilon_i}{\sqrt{\tau^2+\phi^2}},\qquad z_i = \sqrt{w}\,g_i + \sqrt{1-w}\,c_i,\qquad w = \frac{\beta_D^2}{\beta_M^2+\beta_D^2} \]

with \(\eta, \varepsilon_i, c_i \sim N(0,1)\). The term \(\eta\) is drawn once per realization. \(u_i = \Phi(z_i)\) selects the state by inverse transform on the building's cumulative distribution, lightest state first:

\[ DS_i = \min\{k : u_i < \textstyle\sum_{j\le k} P_i(ds_j)\} \]

Because \(z_i \sim N(0,1)\) exactly, \(u_i\) is uniform and the marginal is unchanged.

Mode \(\eta\) \(\varepsilon_i\) Reading
independent – – \(u_i\) uniform and independent. Gives the narrow (binomial) band
between_event shared independent Lower bound of the real correlation
fully_correlated shared shared Upper bound. Thresholds \(c_i\) are still independent

The real band lies between the last two. A distance-decaying within-event correlation, such as Jayaram and Baker (2009), needs a range parameter taken from its own paper and is not built in.

city_bands counts, for each run, the buildings in each state. It reports the mean, the percentiles (default p05, p10, p50, p90, p95, made non-decreasing), and analytic_expected \(=\sum_i P_i(ds)\). A correct sampler gives a mean close to analytic_expected in every mode.

Parameters

Parameter Unit Default Source
tau / sigma_between ln units required The GMPE that produced the PGA, e.g. ASB2014 PGA between-event σ (Akkar et al. 2014)
phi / sigma_within ln units required Same GMPE, within-event σ
beta_threshold \(\beta_M\) – 0.4 FEMA (2024) Section 5.4.3
beta_demand \(\beta_D\) – 0.5 FEMA (2024) Section 5.4.3
runs – required A few hundred give stable p05/p95
seed – required Each (design level, mode) pair uses its own stream default_rng([seed, level, mode])

Status and missing data

A building whose probabilities are NaN, for example no_pga from fragility.damage, gets state -1 from the sampler. It is never treated as "none". city_bands leaves such buildings out and reports them in n_missing. band_status is partial when some buildings are missing, because the totals then cover only the computed buildings and are a lower bound. It is empty when no building is computed, and the band values are then NaN.

For a bracketing damage frame (each building repeated once per design level), city_bands returns one band set per level. For a per-building level frame, where each building appears once at its own level, the stock is one population and the output has no design_level column.

Example

import numpy as np
import pandas as pd
import quakecascade.fragility as fr
import quakecascade.montecarlo as mc

pga = pd.Series([0.45, 0.30, np.nan, 0.62], index=["b1", "b2", "b3", "b4"])
dmg = fr.damage(pga, "C1", floors=[2, 5, 4, np.nan], design_levels=("pre", "moderate"))
# tau, phi: ASB2014 PGA sigmas for the R_JB model (approximately 0.35 and 0.62)
bands = mc.city_bands(dmg, tau=0.35, phi=0.62, runs=500, seed=1)
print(bands[bands.state == "complete"][["design_level", "mode", "mean", "p05", "p95", "band_status"]])

Applicability

  • The copula changes only the dependence between buildings. Every per-building expectation is the Hazus value.
  • The two correlated modes bracket the real correlation; they do not estimate it.
  • Damage-state counts per run sum to the number of computed buildings, so each run partitions the stock.

References

  • Akkar, S., Sandıkkaya, M. A., & Bommer, J. J. (2014). Empirical ground-motion models for point- and extended-source crustal earthquake scenarios in Europe and the Middle East. Bulletin of Earthquake Engineering, 12(1), 359–387. doi:10.1007/s10518-013-9461-4
  • FEMA (2024). Hazus 6.1 Earthquake Model Technical Manual, Section 5.4.3. https://www.fema.gov/flood-maps/tools-resources/flood-map-products/hazus/user-technical-manuals
  • Jayaram, N., & Baker, J. W. (2009). Correlation model for spatially distributed ground-motion intensities. Earthquake Engineering & Structural Dynamics, 38(15), 1687–1708. doi:10.1002/eqe.922