# cniperCont: Functions for Computation and Plot of Cniper Contamination... In ROptEst: Optimally Robust Estimation

## Description

These functions and their methods can be used to determine cniper contamination as well as cniper points. That is, under which (Dirac) contamination is the risk of one procedure larger than the risk of some other procedure.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32``` ```cniperCont(IC1, IC2, data = NULL, ..., neighbor, risk, lower=getdistrOption("DistrResolution"), upper=1-getdistrOption("DistrResolution"), n = 101, with.automatic.grid = TRUE, scaleX = FALSE, scaleX.fct, scaleX.inv, scaleY = FALSE, scaleY.fct = pnorm, scaleY.inv=qnorm, scaleN = 9, x.ticks = NULL, y.ticks = NULL, cex.pts = 1, cex.pts.fun = NULL, col.pts = par("col"), pch.pts = 19, cex.npts = 0.6, cex.npts.fun = NULL, col.npts = "red", pch.npts = 20, jit.fac = 1, jit.tol = .Machine\$double.eps, with.lab = FALSE, lab.pts = NULL, lab.font = NULL, alpha.trsp = NA, which.lbs = NULL, which.Order = NULL, which.nonlbs = NULL, attr.pre = FALSE, return.Order = FALSE, withSubst = TRUE) cniperPoint(L2Fam, neighbor, risk, lower, upper) cniperPointPlot(L2Fam, data=NULL, ..., neighbor, risk= asMSE(), lower=getdistrOption("DistrResolution"), upper=1-getdistrOption("DistrResolution"), n = 101, withMaxRisk = TRUE, with.automatic.grid = TRUE, scaleX = FALSE, scaleX.fct, scaleX.inv, scaleY = FALSE, scaleY.fct = pnorm, scaleY.inv=qnorm, scaleN = 9, x.ticks = NULL, y.ticks = NULL, cex.pts = 1, cex.pts.fun = NULL, col.pts = par("col"), pch.pts = 19, cex.npts = 1, cex.npts.fun = NULL, col.npts = par("col"), pch.npts = 19, jit.fac = 1, jit.tol = .Machine\$double.eps, with.lab = FALSE, lab.pts = NULL, lab.font = NULL, alpha.trsp = NA, which.lbs = NULL, which.nonlbs = NULL, which.Order = NULL, attr.pre = FALSE, return.Order = FALSE, withSubst = TRUE, withMakeIC = FALSE) ```

## Arguments

 `IC1` object of class `IC` `IC2` object of class `IC` `L2Fam` object of class `L2ParamFamily` `neighbor` object of class `Neighborhood` `risk` object of class `RiskType` `...` additional parameters (in particular to be passed on to `plot`). `data` data to be plotted in `lower, upper` the lower and upper end points of the contamination interval (in prob-scale). `n` number of points between `lower` and `upper` `withMaxRisk` logical; if `TRUE`, for risk comparison uses the maximal risk of the classically optimal IC psi in all situations with contamination in Dirac points 'no larger' than the respective evaluation point and the optimally-robust IC eta at its least favorable contamination situation ('over all real Dirac contamination points'). This is the default and was the behavior prior to package version 0.9). If `FALSE` it uses exactly the situation with Dirac contamination in the evaluation point for both ICs psi and eta which amounts to calling `cniperCont` with `IC1=psi`, `IC2=eta`. `with.automatic.grid` logical; should a grid be plotted alongside with the ticks of the axes, automatically? If `TRUE` a respective call to `grid` in argument `panel.first` is ignored. `scaleX` logical; shall X-axis be rescaled (by default according to the cdf of the underlying distribution)? `scaleY` logical; shall Y-axis be rescaled (by default according to a probit scale)? `scaleX.fct` an isotone, vectorized function mapping the domain of the IC(s) to [0,1]; if `scaleX` is `TRUE` and `scaleX.fct` is missing, the cdf of the underlying observation distribution. `scaleX.inv` the inverse function to `scale.fct`, i.e., an isotone, vectorized function mapping [0,1] to the domain of the IC(s) such that for any `x` in the domain, `scaleX.inv(scaleX.fct(x))==x`; if `scaleX` is `TRUE` and `scaleX.inv` is missing, the quantile function of the underlying observation distribution. `scaleY.fct` an isotone, vectorized function mapping for each coordinate the range of the respective coordinate of the IC(s) to [0,1]; defaulting to the cdf of N(0,1). `scaleY.inv` an isotone, vectorized function mapping for each coordinate the range [0,1] into the range of the respective coordinate of the IC(s); defaulting to the quantile function of N(0,1). `scaleN` integer; defaults to 9; on rescaled axes, number of x and y ticks if drawn automatically; `x.ticks` numeric; defaults to NULL; (then ticks are chosen automatically); if non-NULL, user-given x-ticks (on original scale); `y.ticks` numeric; defaults to NULL; (then ticks are chosen automatically); if non-NULL, user-given y-ticks (on original scale); `cex.pts` size of the points of the second argument plotted (vectorized); `cex.pts.fun` rescaling function for the size of the points to be plotted; either `NULL` (default), then `log(1+abs(x))` is used for the rescaling, or a function which is then used for the rescaling. `col.pts` color of the points of the second argument plotted (vectorized); `pch.pts` symbol of the points of the second argument plotted (vectorized); `col.npts` color of the non-labelled points of the `data` argument plotted (vectorized); `pch.npts` symbol of the non-labelled points of the `data` argument plotted (vectorized); `cex.npts` size of the non-labelled points of the `data` argument plotted (vectorized); `cex.npts.fun` rescaling function for the size of the non-labelled points to be plotted; either `NULL` (default), then `log(1+abs(x))` is used for each of the rescalings, or a function which is then used for each of the rescalings. `with.lab` logical; shall labels be plotted to the observations? `lab.pts` character or NULL; labels to be plotted to the observations; if `NULL` observation indices; `lab.font` font to be used for labels `alpha.trsp` alpha transparency to be added ex post to colors `col.pch` and `col.lbl`; if one-dim and NA all colors are left unchanged. Otherwise, with usual recycling rules `alpha.trsp` gets shorted/prolongated to length the data-symbols to be plotted. Coordinates of this vector `alpha.trsp` with NA are left unchanged, while for the remaining ones, the alpha channel in rgb space is set to the respective coordinate value of `alpha.trsp`. The non-NA entries must be integers in [0,255] (0 invisible, 255 opaque). `jit.fac` jittering factor used in case of a `DiscreteDistribution` for plotting points of the second argument in a jittered fashion. `jit.tol` jittering tolerance used in case of a `DiscreteDistribution` for plotting points of the second argument in a jittered fashion. `which.lbs` either an integer vector with the indices of the observations to be plotted into graph or `NULL` — then no observation is excluded `which.nonlbs` indices of the observations which should be plotted but not labelled; either an integer vector with the indices of the observations to be plotted into graph or `NULL` — then all non-labelled observations are plotted. `which.Order` we order the observations (descending) according to the norm given by `normtype(object)`; then `which.Order` either is an integer vector with the indices of the ordered observations (remaining after a possible reduction by argument `which.lbs`) to be plotted into graph or `NULL` — then no (further) observation is excluded. `attr.pre` logical; do graphical attributes for plotted data refer to indices prior (`TRUE`) or posterior to selection via arguments `which.lbs`, `which.Order`, `which.nonlbs` (`FALSE`)? `return.Order` logical; if `TRUE`, an order vector is returned; more specifically, the order of the (remaining) observations given by their original index is returned (remaining means: after a possible reduction by argument `which.lbs`, and ordering is according to the norm given by `normtype(object)`); otherwise we return `invisible()` as usual. `withSubst` logical; if `TRUE` (default) pattern substitution for titles and lables is used; otherwise no substitution is used. `withMakeIC` logical; if `TRUE` the [p]IC is passed through `makeIC` before return.

## Details

In case of `cniperCont` the difference between the risks of two ICs is plotted.

The function `cniperPoint` can be used to determine cniper points. That is, points such that the optimally robust estimator has smaller minimax risk than the classical optimal estimator under contamination with Dirac measures at the cniper points.

As such points might be difficult to find, we provide the function `cniperPointPlot` which can be used to obtain a plot of the risk difference; in this function the usual arguments for `plot` can be used. For arguments `col`, `lwd`, vectors can be used; then the first coordinate is taken for the curve, the second one for the balancing line. For argument `lty`, a list can be used; its first component is then taken for the curve, the second one for the balancing line.

If argument `withSubst` is `TRUE`, in all title and axis lable arguments of `cniperCont` and `cniperPointPlot`, the following patterns are substituted:

`"%C"`

class of argument `L2Fam` (for `cniperPointPlot`)

`"%A"`

deparsed argument `L2Fam` (for `cniperPointPlot`)

`"%C1"`

class of argument `IC1` (for `cniperCont`)

`"%A1"`

deparsed argument `IC1` (for `cniperCont`)

`"%C2"`

class of argument `IC2` (for `cniperCont`)

`"%A2"`

deparsed argument `IC2` (for `cniperCont`)

`"%D"`

time/date-string when the plot was generated

For more details about cniper contamination and cniper points we refer to Section~3.5 of Kohl et al. (2008) as well as Ruckdeschel (2004) and the Introduction of Kohl (2005).

## Value

The cniper point is returned by `cniperPoint`. In case of `cniperPointPlot`, we return an S3 object of class `c("plotInfo","DiagnInfo")`, i.e., a list containing the information needed to produce the respective plot, which at a later stage could be used by different graphic engines (like, e.g. `ggplot`) to produce the plot in a different framework. A more detailed description will follow in a subsequent version.

## Author(s)

Matthias Kohl [email protected]

## References

Kohl, M. and Ruckdeschel, H. and Rieder, H. (2008). Infinitesimally Robust Estimation in General Smoothly Parametrized Models. Unpublished Manuscript.

Kohl, M. (2005) Numerical Contributions to the Asymptotic Theory of Robustness. Bayreuth: Dissertation.

Ruckdeschel, P. (2004). Higher Order Asymptotics for the MSE of M-Estimators on Shrinking Neighborhoods. Unpublished Manuscript.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```## cniper contamination P <- PoisFamily(lambda = 4) RobP1 <- InfRobModel(center = P, neighbor = ContNeighborhood(radius = 0.1)) IC1 <- optIC(model=RobP1, risk=asMSE()) RobP2 <- InfRobModel(center = P, neighbor = ContNeighborhood(radius = 1)) IC2 <- optIC(model=RobP2, risk=asMSE()) cniperCont(IC1 = IC1, IC2 = IC2, neighbor = ContNeighborhood(radius = 0.5), risk = asMSE(), lower = 0, upper = 8, n = 101) ## cniper point plot cniperPointPlot(P, neighbor = ContNeighborhood(radius = 0.5), risk = asMSE(), lower = 0, upper = 10) ## Don't run to reduce check time on CRAN ## cniper point cniperPoint(P, neighbor = ContNeighborhood(radius = 0.5), risk = asMSE(), lower = 0, upper = 4) cniperPoint(P, neighbor = ContNeighborhood(radius = 0.5), risk = asMSE(), lower = 4, upper = 8) ```

ROptEst documentation built on May 2, 2019, 5:45 p.m.