Skip to contents

Evaluates integrateSiteMixture() at the increasing quadrature orders and returns the site mixture of the first order whose quantiles and mean agree with those of the previous order, together with the order and the agreement reached, so that the numerical error of the result is visible.

Usage

refineSiteMixture(mixture, VS30, Vref, model, levels, orders, tolerance)

Arguments

mixture

The rock mixture, see integrateSiteMixture().

VS30

One target velocity in m/s.

Vref

One reference velocity in m/s.

model

Site factor model of evaluateSiteFactor(), "ST20" or "ST17".

levels

Probabilities in \((0, 1)\) whose quantiles enter the comparison with the mean.

orders

At least three increasing integers, each at least 2.

tolerance

One positive relative change.

Value

A list with mixture (the site mixture of the accepted order, as integrateSiteMixture() returns it), order (the accepted order) and change (the pair \(\Delta\) of that order, named all and mean); order and change are NA when VS30 equals Vref.

Mathematics

At order \(n_i\) the report \(R_i\) is summarizeMixture() of the site mixture at levels and the mean, at every period. With the relative change \(\delta(a, b) = \max |a - b| / \max(|b|, \epsilon)\) over corresponding entries (\(\epsilon\) the smallest positive double), the change between \(R_{i-1}\) and \(R_i\) is the pair \(\Delta_i = (\delta \text{ over all entries}, \delta \text{ over the means})\). The first change \(\Delta_2\) is the reference; order \(n_i\), \(i \ge 3\), is accepted when \(\max \Delta_i \le\) tolerance and each component of \(\Delta_i\) does not exceed that of \(\Delta_2\) by more than \(10^{-12}\). No order accepted is an error. When VS30 equals Vref the rock mixture is returned without quadrature.

Examples

Mixture <- data.table::CJ(Tn = c(0, 0.2, 1), k = c("a", "b"))
Mixture[, `:=`(muLn = log(0.4) + 0.1 * (k == "b") - 0.5 * Tn, sigmaLn = 0.5, w = 0.5)]
#> Key: <Tn, k>
#>       Tn      k       muLn sigmaLn     w
#>    <num> <char>      <num>   <num> <num>
#> 1:   0.0      a -0.9162907     0.5   0.5
#> 2:   0.0      b -0.8162907     0.5   0.5
#> 3:   0.2      a -1.0162907     0.5   0.5
#> 4:   0.2      b -0.9162907     0.5   0.5
#> 5:   1.0      a -1.4162907     0.5   0.5
#> 6:   1.0      b -1.3162907     0.5   0.5
refineSiteMixture(Mixture, VS30 = 360, Vref = 760, model = "ST20",
                  levels = c(0.16, 0.50, 0.84), orders = c(8, 16, 32, 64),
                  tolerance = 2e-3)[c("order", "change")]
#> $order
#> [1] 32
#> 
#> $change
#>          all         mean 
#> 2.784021e-06 7.165999e-16 
#>