Correlation modules refactor #10 – Du & Ning (2021) - #11723
Merged
Conversation
Implement the Du and Ning (2021) recommended seven-principal-component correlation model for normalized within-event residuals. The calibrated vector contains PGA, PGV, IA, CAV, RSD575, RSD595, and the 17 published 5%-damped SA ordinates from 0.01 to 10 s; off-grid periods are rejected rather than extrapolated or interpolated. The equations and rounded coefficients follow Tables 3 and 4 of the publication. Author-supplied Matlab files received by GEM on 25 May 2022 confirm the table ordering and normalized covariance reconstruction. The model leaves IMC unset because the source residual vector mixes CB14 RotD50 peak/spectral measures with geometric-mean IA, CAV, and duration measures.
Register DuNing2021 as a spatial cross-IMT correlation model. Its registry metadata identifies the published normalized within-event relationship, exact PGA/PGV/IA/CAV/duration/SA scope, 5% SA damping, and 0.01-10 s outer period limits while exact-period validation remains in the model.
Document the Du and Ning (2021) seven-PC within-event model and expose its API. The scientific notes identify PGA, PGV, IA, CAV, RSD575, RSD595, and the 17 published 5%-damped SA periods; explain the mixed RotD50 and as-recorded geometric-mean components; and record why the unpublished author-Matlab off-grid interpolation is intentionally excluded.
Add deterministic reference, matrix, limiting-case, symmetry, metadata, and validation tests for the published seven-PC within-event model across PGA, PGV, IA, CAV, RSD575, RSD595, and the exact 5%-damped SA nodes. The data were generated independently with GNU Octave 8.4.0 and Wenqi Du's unchanged Matlab functions supplied to GEM on 25 May 2022 (du.zip SHA-256 35ea324b4783df61f54c6e8ac6ee25d5a7fb9c07abfe857c96d3938c07fde7fe). Exact .mat array transport signatures were checked, and an independent non-OQ Python translation agreed within 6.1e-16. The unpublished off-grid interpolation row is excluded and its non-unit-diagonal defect is covered by rejection tests.
Add the explicit DuNing2021Interpolated within-event variant for PGA, PGV, IA, CAV, RSD575, RSD595, and 5%-damped SA from 0.01 to 10 s. Keep DuNing2021 restricted to the 17 periods published by Du and Ning (2021). Follow Wenqi Du's author-supplied Matlab convention by interpolating normalized seven-PC loadings linearly in ordinary period. Normalize with the zero-distance PC covariance to retain a unit diagonal and positive semidefiniteness. Verification uses author-function Octave values and deterministic matrix tests in the following verification commit.
Document the strict published DuNing2021 model and the explicit ordinary-period DuNing2021Interpolated extension. Explain that both are within-event models for the same calibrated IMTs, while only the extension admits intermediate 5%-damped SA periods within 0.01 to 10 s. Record the author-Matlab source, the covariance normalization that corrects its off-grid marginal variances, and the resulting exact-node, unit-diagonal, symmetric, and PSD behavior.
Verify the within-event interpolation extension over off-grid 5%-damped SA pairs, non-SA pairs, separations, diagonal normalization, exact published nodes, symmetry, float64 output, and positive definiteness. Generate raw correlations and off-grid marginal variances with Wenqi Du's Matlab equations in GNU Octave 8.4.0, then independently normalize their ratio. The data-only CSV records both the author values and expected normalized values; no OpenQuake output is used as reference data.
Clarify that PGA and SA(0.01) have identical coefficients only for PCs 1-7 retained by the published simplified within-event model. Their complete 23-PC rows in Table 3 differ in later columns. Rename the corresponding deterministic test to state that perfect correlation is a property of the implemented seven-PC approximation. No numerical results or supported IMTs change.
Replace the DuNing2021 catalog-style science text with a reusable description of PCA-based joint spatial and cross-IMT covariance construction. The new subsection distinguishes loading and component-scaling conventions, gives covariance reconstruction and normalization equations, explains positive-semidefinite preservation and full-versus-truncated rank tradeoffs, and motivates structure-preserving interpolation without implying that every model exposes the same behavior. Calibration scope and class-specific choices remain in the API documentation.
Remove the Matlab/Octave wrapper scripts used while preparing the deterministic Du and Ning reference tables. Keep only the data-only CSV fixtures in the test-data directory; their provenance remains documented in the model and tests, and the reference values still come from Wenqi Du's author-supplied functions rather than OpenQuake output.
Describe the deterministic reference tables in terms of Wenqi Du's author-supplied Matlab functions, GNU Octave 8.4.0, and the independent non-OpenQuake translation. Remove machine-specific archive naming, hashing, and online-runner details that do not identify the scientific source.
CB-quakemodel
approved these changes
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Du and Ning (2021) within-event joint spatial and cross-IMT correlation model
Part of #11230.
This PR implements the recommended seven-principal-component within-event spatial cross-IMT correlation model published by Du and Ning (2021)1. Matlab functions and coefficient arrays2 related to the model were kindly shared by Wenqi Du with GEM on 25 May 2022.
The supported intensity-measure vector consists of:
Two variants are provided:
DuNing2021implements the publication model at its 17 tabulated SA periods, with no interpolation support.DuNing2021Interpolatedadditionally supports intermediate SA periods within 0.01–10 s.The model combines the seven principal-component loading vectors with their nested spatial covariance functions and normalizes the reconstructed covariance to correlation. Interpolation is implemented as a separate variant because it is not specified in the publication and requires normalization to correct its non-unit off-grid diagonal; however, ordinary-period interpolation is supported in the authors' Matlab code.
PGA and SA(0.01) are distinct calibrated IMTs whose published loading rows for PC1–PC7 happen to be identical (see Table 3 of the publication), and are therefore perfectly correlated in this 7 PC model implementation.
Scientific scope and metadata
The model describes normalized within-event residuals.
The calibrated horizontal-component definitions are not uniform across the complete vector:
The implementation consequently leaves the model-wide IMC metadata unset.
Publication and authors' Matlab code
The implementation in this PR follows the equations and rounded coefficients in Tables 3 and 4 of the publication.
The author provided Matlab functions and coefficient files clarify:
The common factor of 0.9 in Equations 22–24 cancels when Equation 12 is normalized and therefore does not affect the returned correlations.
The authors' Matlab function also bilinearly interpolates the final correlation table in ordinary period. This interpolation is not described in the publication and produces non-unit off-grid diagonal values, for example, 0.9823016 for SA(0.06), 0.9376723 for SA(0.15), and 0.9611493 for SA(0.6).
For that reason, the
DuNing2021class is restricted to the 17 published periods and does not support interpolation.On the other hand, the
DuNing2021Interpolatedclass is added in order to provide interpolation support explicitly. It linearly interpolates the equivalent normalized principal-component loading vectors in ordinary period and then normalizes using the two zero-distance marginal variances. This is equivalent toThe interpolated variant is exact (as expected) at all published periods, and produces symmetric, unit-diagonal, positive-semidefinite matrices (without needing to apply a subsequent matrix repair.) Log-period interpolation might be a valid option too, but is not used here because it would differ from the authors' own Matlab implementation.
Verification tables
Deterministic reference values were generated with GNU Octave 8.4.0 from the authors' Matlab functions and coefficient arrays. The Matlab files were used only to produce independent verification data; the implementation in this PR was developed separately from the publication equations. The Matlab scripts used to build the verification tables
References
Footnotes
Du, W., & Ning, C.-L. (2021). Modeling spatial cross-correlation of multiple ground motion intensity measures (SAs, PGA, PGV, Ia, CAV, and significant durations) based on principal component and geostatistical analyses. Earthquake Spectra, 37(1), 486–504. https://doi.org/10.1177/8755293020952442 ↩
Du, W. (2022). Matlab functions and coefficient arrays for Du and Ning (2021).zip ↩
Campbell, K. W., & Bozorgnia, Y. (2014). NGA-West2 ground motion model for the average horizontal components of PGA, PGV, and 5% damped linear acceleration response spectra. Earthquake Spectra, 30(3), 1087–1115. ↩
Campbell, K. W., & Bozorgnia, Y. (2019). Ground motion models for the horizontal components of Arias intensity and cumulative absolute velocity using the NGA-West2 database. Earthquake Spectra, 35(3), 1289–1310. ↩
Du, W., & Wang, G. (2017). Prediction equations for ground-motion significant durations using the NGA-West2 database. Bulletin of the Seismological Society of America, 107(1), 319–333. ↩