LDEstimator: Function to compute LD (location-dispersion) estimates

View source: R/LDEstimator.R

LDEstimatorR Documentation

Function to compute LD (location-dispersion) estimates

Description

Function LDEstimator provides a general way to compute estimates for a given parametric family of probability measures (with a scale and shape parameter) which can be obtained by matching location and dispersion functionals against empirical counterparts.

Usage

LDEstimator(x, loc.est, disp.est, loc.fctal, disp.fctal, ParamFamily,
            loc.est.ctrl = NULL, loc.fctal.ctrl=NULL,
            disp.est.ctrl = NULL, disp.fctal.ctrl=NULL,
            q.lo =1e-3, q.up=15, log.q =TRUE,
            name, Infos, asvar = NULL, nuis.idx = NULL,
            trafo = NULL, fixed = NULL, asvar.fct  = NULL, na.rm = TRUE,
            ..., .withEvalAsVar = FALSE, vdbg = FALSE)
medkMAD(x, ParamFamily, k=1, q.lo =1e-3, q.up=15, nuis.idx = NULL,
        trafo = NULL, fixed = NULL, asvar.fct = NULL, na.rm = TRUE,
        ..., .withEvalAsVar = FALSE, vdbg = FALSE)
medkMADhybr(x, ParamFamily, k=1, q.lo =1e-3, q.up=15, KK = 20, nuis.idx = NULL,
        trafo = NULL, fixed = NULL,  asvar.fct = NULL, na.rm = TRUE,
        ..., .withEvalAsVar = FALSE)
medSn(x, ParamFamily, q.lo =1e-3, q.up=10, nuis.idx = NULL,
      trafo = NULL, fixed = NULL, asvar.fct = NULL, na.rm = TRUE,
      accuracy = 100, ..., .withEvalAsVar = FALSE)
medQn(x, ParamFamily, q.lo =1e-3, q.up=15, nuis.idx = NULL,
      trafo = NULL, fixed = NULL, asvar.fct = NULL, na.rm = TRUE,
      ..., .withEvalAsVar = FALSE)

Arguments

x

(empirical) data

ParamFamily

an object of class "ParamFamily". The parametric family at which to evaluate the LDEstimator; the respective (main) parameter must contain "scale" and "shape".

loc.est

a function expecting x (a numeric vector) as first argument; location estimator.

disp.est

a function expecting x (a numeric vector) as first argument; dispersion estimator; may only take non-negative values.

loc.fctal

a function expecting a distribution object as first argument; location functional.

disp.fctal

a function expecting a distribution object as first argument; dispersion functional; may only take non-negative values.

loc.est.ctrl

a list (or NULL); optional additional arguments for the location estimator.

disp.est.ctrl

a list (or NULL); optional additional arguments for the dispersion estimator.

loc.fctal.ctrl

a list (or NULL); optional additional arguments for the location functional.

disp.fctal.ctrl

a list (or NULL); optional additional arguments for the dispersion functional.

k

numeric; additional parameter for kMAD; must be positive and of length 1.

KK

numeric; Maximal number of trials with different k in medkMADhybr .

q.lo

numeric; lower bound for search intervall in shape parameter.

q.up

numeric; upper bound for search intervall in shape parameter.

log.q

logical; shall the zero search be done on log-scale?

name

optional name for estimator.

Infos

character: optional informations about estimator

asvar

optionally the asymptotic (co)variance of the estimator

nuis.idx

optionally the indices of the estimate belonging to nuisance parameter

fixed

optionally (numeric) the fixed part of the parameter

trafo

an object of class MatrixorFunction – a transformation for the main parameter

asvar.fct

optionally: a function to determine the corresponding asymptotic variance; if given, asvar.fct takes arguments L2Fam((the parametric model as object of class L2ParamFamily)) and param (the parameter value as object of class ParamFamParameter); arguments are called by name; asvar.fct may also process further arguments passed through the ... argument

na.rm

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

accuracy

numeric: argument to be passed on to Sn.

...

further arguments to be passed to location estimator and functional and dispersion estimator and functional.

vdbg

logical; if TRUE, debugging information is shown.

.withEvalAsVar

logical: shall slot asVar be evaluated (if asvar.fct is given) or just the call be returned?

Details

The arguments loc.est, disp.est (location and dispersion estimators) have to be functions with first argument x (a numeric vector with the empirical data) and additional, optional individual arguments to be passed on in the respective calls as lists loc.est.ctrl, disp.est.ctrl, and global additional arguments through the ... argument. Similarly, arguments loc.fctal, disp.fctal (location and dispersion functionals) have to be functions with first argument an object of class UnivariateDistribution, and additional, optional individual arguments to be passed on in the respective calls as lists loc.fctal.ctrl, disp.fctal.ctrl, and global additional arguments again through the ... argument. Uses .LDMatch internally.

Value

An object of S4-class "Estimate".

Note

The values for q.lo and q.up are a bit delicate and have to be found, model by model, by try and error. As a rule, medSn is rather slow, as the evaluation of the Sn functional is quite expensive. So if medSn is the estimator of choice, it pays off, for a given shape-scale family, to evaluate medSn on a grid of shape-values (with scale 1) and then to use an interpolation techniques in a particular method to replace the default one for this shape-scale family. As an example, we have done so for the GPD family.

Author(s)

Nataliya Horbenko nhorbenko@gmail.com,
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de

References

Marazzi, A. and Ruffieux, C. (1999): The truncated mean of asymmetric distribution. Computational Statistics and Data Analysis 32, 79-100.

Ruckdeschel, P. and Horbenko, N. (2013): Optimally-Robust Estimators in Generalized Pareto Models. Statistics. 47(4), 762-791. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/02331888.2011.628022")}.

Ruckdeschel, P. and Horbenko, N. (2012): Yet another breakdown point notion: EFSBP –illustrated at scale-shape models. Metrika, 75(8), 1025-1047. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s00184-011-0366-4")}.

See Also

ParamFamily-class, ParamFamily, Estimate-class

Examples

## (empirical) Data
set.seed(123)
x <- rgamma(50, scale = 0.5, shape = 3)

## parametric family of probability measures
G <- GammaFamily(scale = 1, shape = 2)

medQn(x = x, ParamFamily = G)
medSn(x = x, ParamFamily = G, q.lo = 0.5, q.up = 4)


## not tested on CRAN because it takes time...
## without speedup for Sn:
LDEstimator(x, loc.est = median, disp.est = Sn, loc.fctal = median,
            disp.fctal = getMethod("Sn","UnivariateDistribution"),
            ParamFamily = G, disp.est.ctrl = list(constant=1))

medkMAD(x = x, ParamFamily = G)
medkMADhybr(x = x, ParamFamily = G)

medkMAD(x = x, k=10, ParamFamily = G)

##not at all robust:
LDEstimator(x, loc.est = mean, disp.est = sd,
               loc.fctal = E, disp.fctal = sd,
            ParamFamily = G)

RobExtremes documentation built on Feb. 12, 2024, 3:01 a.m.