Introduction to GMPEhaz Package
Person Lin
2026-03-31
Source:vignettes/GMPEhaz-introduction.Rmd
GMPEhaz-introduction.RmdIntroduction to GMPEhaz Package
GMPEhaz is an R package specialized for seismic hazard analysis, providing R language interfaces for various Ground Motion Prediction Equations (GMPEs). This package wraps the GMPE functions from Norman Abrahamson’s HAZ Fortran code, offering convenient tools for earthquake engineering researchers and practitioners.
Key Features
- Rich GMPE Models: Supports over 70 different ground motion prediction equations
- International Standard Models: Includes NGA-West2 series models (ASK14, BSSA14, CB14, CY14, etc.)
- Regional-specific Models: Provides Taiwan-specific adjustment models
- Multiple Earthquake Types: Supports crustal and subduction zone earthquakes
- Vectorized Computation: Supports batch calculations for multiple scenarios or periods
Quick Start
Basic Usage Example
# Calculate PGA using BSSA14 model
result <- BSSA14(Mag=6.5, Rjb=20, Prd=0, Vs30=760, ftype=0, Z1.0=0.5, regionflag=0, basinflag=0)
# Display results
cat("Magnitude:", result$mag, "\n")
#> Magnitude: 6.5
cat("Distance:", result$Rjb, "km\n")
#> Distance: 20 km
cat("Log PGA:", round(result$lnY, 3), "\n")
#> Log PGA: 4.785
cat("PGA(g):", round(exp(result$lnY)/ exp(6.89), 3), "\n")
#> PGA(g): 0.122
cat("Standard deviation:", round(result$sigma, 3), "\n")
#> Standard deviation: 0.605Package Data
Available Periods
# View standard periods for NGA-West models
head(periods.T, 10)
#> [1] 0.010 0.020 0.022 0.025 0.029 0.030 0.032 0.035 0.036 0.040GMPE Model List
# View available GMPE models and their period ranges
head(GMPEhaz.model)
#> name fortran_name crustal subduction_interface subduction_intraslab
#> 1 AB03 AB03 0 1 1
#> 2 AC10 AC_2010 1 0 0
#> 3 AGA16.tw.C01 AGA16_TW_C01 0 1 1
#> 4 AGA16.tw.F10 AGA16_TW_F10 0 1 1
#> 5 AM09 AM09_Cas 0 1 0
#> 6 Arroyo2010 Arroyo2010 0 1 0
#> region Taiwan PGA PGV PGD period.min period.max
#> 1 Cascadia 0 1 0 0 0.04 3
#> 2 Turkey 0 1 1 0 0.01 2
#> 3 Global 1 1 0 0 0.01 10
#> 4 Global 1 1 0 0 0.01 10
#> 5 Cascadia 0 1 0 0 0.01 10
#> 6 Mexican 0 1 0 0 0.04 5Query Period Range for Specific Model
# Query available period range for BSSA14 model
get.GMPE.prd("BSSA14")
#> period.min period.max
#> 23 0.01 10Different Types of GMPE Models
Crustal Earthquake Models
Applicable to shallow crustal earthquakes (depth typically less than 30 km):
# NGA-West2 series model comparison
models <- c("ASK14", "BSSA14", "CB14", "CY14")
mag <- 6.5
rjb <- 30
vs30 <- 760
for(model in models) {
if(model == "ASK14") {
result <- ASK14(mag, rjb, rjb, 0, 90, 0, 10, vs30, 0, 0, 1, 0.5, rjb, 10, 0, 0)
} else if(model == "BSSA14") {
result <- BSSA14(mag, rjb, 0, vs30, 0, 0.5, 0, 0)
} else if(model == "CB14") {
result <- CB14(mag, rjb, rjb, 0, 0, vs30, 90, 0, 0.5, 1, 0, rjb, 0, 0)
} else if(model == "CY14") {
result <- CY14(mag, rjb, rjb, 0, vs30, 90, 0, 0, 0.5, 1, 0, rjb, 0)
}
cat(model, "PGA:", round(exp(result$lnY)/exp(6.89), 3), "g\n")
}
#> ASK14 PGA: 0.063 g
#> BSSA14 PGA: 0.084 g
#> CB14 PGA: 0.092 g
#> CY14 PGA: 0.069 gSubduction Zone Earthquake Models
Applicable to subduction zone earthquakes (interface and intraslab earthquakes):
# Subduction zone model comparison
# LL08 - Taiwan-specific model
ll08_result <- LL08(Mag=7, Rrup=50, depth=30, ftype=0, Prd=0, Vs30=760)
cat("LL08 (Interface) PGA:", round(exp(ll08_result$lnY)/exp(6.89), 3), "g\n")
#> LL08 (Interface) PGA: 0.084 g
# BCHydroSub2018Global - Global model
bch_result <- BCHydroSub2018Global(Mag=7, Rrup=50, Prd=0, ftype=0, Vs30=760,
forearc=1, depth=30, Rhypo=60)
cat("BCHydroSub2018Global PGA:", round(exp(bch_result$lnY)/exp(6.89), 3), "g\n")
#> BCHydroSub2018Global PGA: 0.095 gAdvanced Applications
Response Spectrum Calculation
# Calculate complete response spectrum
periods <- c(0, 0.1, 0.2, 0.5, 1.0, 2.0, 3.0)
sa_values <- numeric(length(periods))
for(i in seq_along(periods)) {
result <- BSSA14(Mag=7, Rjb=20, Prd=periods[i], Vs30=760, ftype=0, Z1.0=0.5, regionflag=0, basinflag=0)
sa_values[i] <- exp(result$lnY)/exp(6.89)
}
# Create response spectrum data frame
response_spectrum <- data.frame(Period = periods, Sa = sa_values)
print(response_spectrum)
#> Period Sa
#> 1 0.0 0.14971243
#> 2 0.1 0.29032202
#> 3 0.2 0.34184601
#> 4 0.5 0.19965589
#> 5 1.0 0.10001009
#> 6 2.0 0.04233749
#> 7 3.0 0.02697313Distance Attenuation Relationship
# Calculate ground motion values at different distances
distances <- c(10, 20, 50, 100, 200)
pga_values <- numeric(length(distances))
for(i in seq_along(distances)) {
result <- BSSA14(Mag=6.5, Rjb=distances[i], Prd=0, Vs30=760, ftype=0, Z1.0=0.5, regionflag=0, basinflag=0)
pga_values[i] <- exp(result$lnY)/exp(6.89)
}
attenuation <- data.frame(Distance = distances, PGA = pga_values)
print(attenuation)
#> Distance PGA
#> 1 10 0.210402959
#> 2 20 0.121791228
#> 3 50 0.048901914
#> 4 100 0.019457352
#> 5 200 0.005155822Important Notes
- Period Range: Each GMPE model has its applicable period range, please check before use
- Parameter Validity: Ensure input parameters are within the model’s applicable range
- Regional Applicability: Choose GMPE models suitable for your study region
- Uncertainty: GMPE predictions include epistemic uncertainty and aleatory variability
More Information
- For detailed function usage, please refer to individual function documentation
- For detailed introduction of main GMPE functions, see “Main GMPE Functions Guide” vignette
- Package source code: https://github.com/personlin/GMPEhaz
- Issue reporting: https://github.com/personlin/GMPEhaz/issues