Internal helper functions for generating interpolation grids for speed up in package RobExtremes

Description

These functions are used internally to generate interpolation grids, for Lagrange multipliers or LDEstimators in package RobExtremes, to be stored in the respective ‘sysdata.rda’ file.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
.getPsi(param, fct, L2Fam , type)

.is.na.Psi(param, fct, nam = "shape")

.modify.xi.PFam.call(xi, PFam)

.RMXE.xi(xi, PFam)
.MBRE.xi(xi, PFam)
.OMSE.xi(xi, PFam)

.getLMGrid(xiGrid = getShapeGrid(), PFam = GParetoFamily(scale=1,shape=2),
           optFct = .RMXE.xi, GridFileName="LMGrid.Rdata", withPrint = FALSE,
           len = 13)

.svInt(optF = .RMXE.th, xiGrid = getShapeGrid(700, cutoff.at.0=0.005),
       PFam = GParetoFamily(shape=1,scale=2), radius = 0.5, upper = 1e4,
       lower = 1e-4, OptOrIter = "iterate",  maxiter = 150,
       tol = .Machine$double.eps^0.5, loRad = 0, upRad = Inf, loRad0 = 1e-3,
       loRad.s = 0.2, up.Rad.s = 1, withStartLM = TRUE, len = 13, namFzus = "")

.generateInterpGridSn(xiGrid = getShapeGrid(500, cutoff.at.0=0.005),
                      PFam = GParetoFamily(), withPrint = TRUE)

Arguments

param

object of class "ParamFamParameter".

fct

list of functions containing the interpolators.

L2Fam

an object of class "L2ParamFamily", the parametric family at which to evaluate the Lagrange multipliers or LDEstimators; in our use case, it is a shape-scale model, hence the respective (main) parameter must contain "scale" and "shape".

nam

character; name of the shape parameter.

type

type of the optimality: one of ".OMSE" for maxMSE, ".RMXE" for rmx, and ".MBRE" for MBRE.

xi

numeric of length 1; shape value.

PFam

an object of class "ParamFamily", the parametric family at which to evaluate the Lagrange multipliers or LDEstimators; in our use case, it is a shape-scale model, hence the respective (main) parameter must contain "scale" and "shape".

xiGrid

numeric; grid of shape values.

optFct, optF

function with arguments xi and PFam; determines the Lagrange multipliers.

GridFileName

character; if GridFileName!="", the pure y-grid values are saved under this filename.

withPrint

logical of length 1: shall current shape value be printed out?

radius

[for OMSE]: positive numeric of length 1: the radius of the neighborhood for which the LM's are to be computed; defaults to 0.5.

loRad

the lower end point of the interval to be searched in the inner optimization (for the least favorable situation to the user-guessed radius).

upRad

the upper end point of the interval to be searched in the inner optimization (for the least favorable situation to the user-guessed radius).

loRad.s

the lower end point of the interval to be searched in the outer optimization (for the user-guessed radius); if NULL set to loRad in the algorithm.

upRad.s

the upper end point of the interval to be searched in the outer optimization (for the user-guessed radius); if NULL set to upRad in the algorithm.

upper

upper bound for the optimal clipping bound.

lower

lower bound for the optimal clipping bound.

OptOrIter

character; which method to be used for determining Lagrange multipliers A and a: if (partially) matched to "optimize", getLagrangeMultByOptim is used; otherwise: by default, or if matched to "iterate" or to "doubleiterate", getLagrangeMultByIter is used. More specifically, when using getLagrangeMultByIter, and if argument risk is of class "asGRisk", by default and if matched to "iterate" we use only one (inner) iteration, if matched to "doubleiterate" we use up to Maxiter (inner) iterations.

loRad0

for numerical reasons: the effective lower bound for the zero search; internally set to max(loRad,loRad0).

withStartLM

logical of length 1: shall the LM's of the preceding grid value serve as starting value for the next grid value?

len

integer; number of Lagrange multipliers to be calibrated.

namFzus

character; infix for the name of the ‘.csv’-File to which the results are written; used to split the work on xi-grids into chunks.

Details

.getpsi reads the respective interpolating function from an object from ‘sysdata.rda’ and generates a respective HampelIC object by a call to generateIC.

.is.na.Psi checks whether the shape parameter already lies beyond the range for which inter-/extrapolation is admitted (and, correspondingly, returns TRUE if one has to compute the IC completely anew.).

.MBRE.xi computes the Lagrange multipliers for the MBRE estimator, .OMSE.xi for the OMSE estimator at radius r=0.5, and .RMXE.xi the RMXE estimator.

.svInt is a short form for ROptEst:::.generateInterpGrid for LM interpolation.

Value

.getpsi

an IC.

.is.na.Psi

logical of length 1.

.modify.xi.PFam.call

A call to evaluate the parametric family at the new parameter value.

.MBRE.xi

A list with items b (a number; clipping height), a (a 2-vector; outer centering), a.w (a 2-vector; inner centering, in the weight), A (a 2x2 matrix; outer standardization), A.w (a 2x2 matrix; inner standardization, in the weight).

.OMSE.xi

as .MBRE.xi.

.RMXE.xi

as .MBRE.xi.

.getLMGrid

A list with items grid, a matrix with the interpolation grid and fct a function in x (the shape) and i deciding on the Lagrange multiplier.

.generateInterpGridSn

invisible(NULL)

.svInt

invisible(NULL)

Note

These functions are only meant for the developers of package RobExtremes (or respective packages). They can be used to speed up things by interpolation. Our use case is a speed up for further scale-shape families (or enhance existing speed-ups) such that the respective grids are stored in the ‘sysdata.rda’ file of this package and can be used in (exported) new particular methods for functional Sn. Special attention has to be paid for R-versions pre and post R-2.16. So if interpolation functions are desired for both alternatives, one has to run ROptEst:::.recomputeInterpolators once on each version.

See Also

interpolateSn

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.