internalRobestHelpers: Internal / Helper functions of package ROptEst for function...

internals_for_ROptEst_robestR Documentation

Internal / Helper functions of package ROptEst for function robest

Description

These functions are internally used helper functions for robest, in package ROptEst.

Usage

.dynScopeEval(expr)
.constructArg.list(fun,matchCall, onlyFormal=FALSE, debug =FALSE)
.fix.in.defaults(call.list, fun, withEval=TRUE)
.pretreat(x, na.rm = TRUE)
.check.eps(...)
.isOKsteps(steps)
.isOKfsCor(fsCor)

Arguments

expr

an expression.

fun

function, a matched call of which is manipulated.

matchCall

a return value of a call to match.call.

onlyFormal

logical; shall arguments not explicitely contained in the formals of fun be kept in the matched call?

debug

logical: if switched on, issues information for debugging.

call.list

a list of matched arguments drawn from a call to match.call applied to fun which is to be supplemented by defaults of not-yet-matched formals.

withEval

logical: shall arguments be evaluated?

x

input data x of robest or roptest.

na.rm

logical: if TRUE, the estimator is evaluated at complete.cases(x).

...

input from robest or roptest from which to conclude on radiuses.

steps

number of steps to be used in kStep estimator in robest.

fsCor

argument fsCor of robest.

Details

.dynScopeEval marches up the stack of calls to evaluate an expression, hence realizes dynamical scoping.

.constructArg.list takes a function fun and the return value of match.call and, as return value, produces a list of arguments where the formal arguments of fun are set to their default values and with extra item esc.

If argument onlyFormals is TRUE and the formals contain ..., the returned list only contains formal arguments of fun, filled with default values from the definition where available, and, in addition, in element esc a list with element one of the original matched call and, as subsequent elements, with the named, evaluated arguments of the matched call which are no formal arguments of fun.

If argument onlyFormals is FALSE or the formals do not contain ..., the returned list again contains formal arguments of fun filled in with defaults where available, but in addition it contains the arguments of the matched calls non matched to formals (in particular those passed on through ...). Then element esc in the returned list with contains element one of the original matched call coerced to list, i.e., the name of the called function.

.fix.in.defaults takes a list of arguments of fun taken from a matched call obtained by match.call from within a call of fun (after coercing to list) and supplements this list by formal arguments of fun which are not yet matched but have default arguments (with exactly these default values). The return value is the prolongated list.

.pretreat, if is.numeric(x) is FALSE, coerces x to a numeric matrix (by a call to data.matrix in case x is a data.frame, respectively, by a call to as.matrix else. If na.rm is TRUE, x is reduced to na.omit(x). The return value is a list of elements x, the possibly modified input x, and completecases, the return value of compeletecases(x).

.check.eps takes its input (possibly empty in part) and returns a list eps with elements sqn, e, lower, and upper. Necessarily the input ... must contain an argument matching to x, and sqn is the square root of either the length of x (if x is a vector) or the number of columns of x (in case dim(x)==2). In case ... contains none of the elements eps, eps.lower, eps.upper, elements lower and upper of the return value are set to 0 and 0.5, respectively. Else, if eps is contained input ... element e of the return list is set to eps, and lower and upper are left empty. Otherwise, element e of the return list is left empty and lower and upper are filled with eps.lower and eps.upper from input ... if available and else with default values 0 and 0.5, respectively.

.isOKsteps checks whether argument steps is a valid argument, i.e., is an integer larger than 0 of length 1 and, accordingly, returns TRUE or FALSE.

.isOKfsCor checks whether argument fsCor is a valid argument, i.e., larger than 0 and of length 1 and, accordingly, returns TRUE or FALSE.


ROptEst documentation built on Sept. 12, 2024, 7:40 a.m.