scenario_selection: A function for scenario (event or ground motion map)...

View source: R/scenario_selection.R

scenario_selectionR Documentation

A function for scenario (event or ground motion map) selection

Description

This function takes the target hazard (and target hazard magnitude and/or distance distributions) and the hazard (and hazard magnitude and/or distance distributions) produced by each of the considered event scenarios or ground motion map scenarios to efficiently and optimally select a series of subset scenarios with adjusted annual occurrence rates by using LASSO regression.

Usage

scenario_selection(
  Y,
  X,
  min_hazard = 1e-07,
  output_dir = NULL,
  max_rate_multiplier = NULL,
  num_lambda = 1000,
  Weight = 1
)

Arguments

Y

The target hazard and target hazard magnitude/distance distributions

X

The hazard matrix produced by each of the considered scenarios

min_hazard

The minimum hazard value in Y that is considered in regression. This is used to avoid having extremely large weights. Note the weights is 1/Y. The default value for min_hazard is 1e-7.

output_dir

If not NULL, the results will be written into a few CSV files under the specified directory

max_rate_multiplier

The maximum value for the multiplier of annual occurrence rate when running LASSO, a positive numeric number. It is an additional constraint for scenario selection. The rate multipliers are not straightly constrained: the rate multipliers could be much larger when the number of selected scenarios is too small; and the rate multipliers will get better constrained when the number of selected scenarios gets more.

num_lambda

The maximum number of trail penalty parameters. A larger num_lambda will search for more possible subset events.

Weight

The weight vector for each element in Y. The default is 1 that indicates using the default weight of scenario selection algorithm (which is 1/Y). If the other weights are preferred, then a vector with the same length as Y for the desired weights can be specified. Since the weight of 1/Y has been set in the function, so you'd need to multiply your desired weights by Y to compensate the default weights.

Value

A list of three elements is returned. The first element is the corresponding adjusted rate multipliers for each event (or each column in X), the second element is recovered hazard by the selected subset events, and the last element is the logarithmic mean squared error. The events with positive factors are selected events and the events with factors = 0 are NOT selected.

betas

A matrix of the adjusted rate multipliers for each scenario for each set of selected scenarios. The dimension is total number of candidate scenarios by the number of set of selected scenarios. The scenarios with zero multipliers are unselected

errors_mat

A matrix with four columns: the number of selected scenarios following by three error metrics (mean of squared logarithmic residuals, mean of absolute logarithmic relative errors, and mean of absolute arithmetic relative errors)

Y_hat

The predicted hazard by each set of selected scenarios


wltcwpf/RPSHA documentation built on July 6, 2023, 1:02 a.m.