| roptest {ROptEst} | R Documentation |
Function to compute optimally robust estimates for L2-differentiable parametric families via k-step construction.
roptest(x, L2Fam, eps, eps.lower, eps.upper, initial.est,
neighbor = ContNeighborhood(), risk = asMSE(), steps = 1,
distance = CvMDist, startPar = NULL, verbose = FALSE,
useLast = getRobAStBaseOption("kStepUseLast"), ...)
x |
sample |
L2Fam |
object of class "L2ParamFamily" |
eps |
positive real (0 < eps <= 0.5): amount of gross errors.
See details below. |
eps.lower |
positive real (0 <= eps.lower <= eps.upper):
lower bound for the amount of gross errors. See details below. |
eps.upper |
positive real (eps.lower <= eps.upper <= 0.5):
upper bound for the amount of gross errors. See details below. |
initial.est |
initial estimate for unknown parameter. If missing minimum distance estimator is computed. |
neighbor |
object of class "UncondNeighborhood" |
risk |
object of class "RiskType" |
steps |
positive integer: number of steps used for k-steps construction |
distance |
distance function |
startPar |
initial information used by optimize resp. optim;
i.e; if (total) parameter is of length 1, startPar is
a search interval, else it is an initial parameter value; if NULL
slot startPar of ParamFamily is used to produce it;
in the multivariate case, startPar may also be of class Estimate,
in which case slot untransformed.estimate is used. |
verbose |
logical: if TRUE, some messages are printed |
useLast |
which parameter estimate (initial estimate or
k-step estimate) shall be used to fill the slots pIC,
asvar and asbias of the return value. |
... |
further arguments |
Computes the optimally robust estimator for a given L2 differentiable
parametric family. The computation uses a k-step construction with an
appropriate initial estimate; cf. also kStepEstimator.
Valid candidates are e.g. Kolmogorov(-Smirnov) or von Mises minimum
distance estimators (default); cf. Rieder (1994) and Kohl (2005).
If the amount of gross errors (contamination) is known, it can be
specified by eps. The radius of the corresponding infinitesimal
contamination neighborhood is obtained by multiplying eps
by the square root of the sample size.
If the amount of gross errors (contamination) is unknown, try to find a
rough estimate for the amount of gross errors, such that it lies
between eps.lower and eps.upper.
In case eps.lower is specified and eps.upper is missing,
eps.upper is set to 0.5. In case eps.upper is specified and
eps.lower is missing, eps.lower is set to 0.
If neither eps nor eps.lower and/or eps.upper is
specified, eps.lower and eps.upper are set to 0 and 0.5,
respectively.
If eps is missing, the radius-minimax estimator in sense of
Rieder et al. (2001, 2008), respectively Section 2.2 of Kohl (2005) is returned.
The default value of argument useLast is set by the
global option kStepUseLast which by default is set to
FALSE. In case of general models useLast
remains unchanged during the computations. However, if
slot CallL2Fam of IC generates an object of
class "L2GroupParamFamily" the value of useLast
is changed to TRUE.
Explicitly setting useLast to TRUE should
be done with care as in this situation the influence curve
is re-computed using the value of the one-step estimate
which may take quite a long time depending on the model.
If useLast is set to TRUE the computation of asvar,
asbias and IC is based on the k-step estimate.
Object of class "kStepEstimate".
Matthias Kohl Matthias.Kohl@stamats.de
Kohl, M. (2005) Numerical Contributions to the Asymptotic Theory of Robustness. Bayreuth: Dissertation.
Rieder, H. (1994) Robust Asymptotic Statistics. New York: Springer.
Rieder, H., Kohl, M. and Ruckdeschel, P. (2008) The Costs of not Knowing the Radius. Statistical Methods and Applications 17(1) 13-40.
Rieder, H., Kohl, M. and Ruckdeschel, P. (2001) The Costs of not Knowing the Radius. Appeared as discussion paper Nr. 81. SFB 373 (Quantification and Simulation of Economic Processes), Humboldt University, Berlin; also available under www.uni-bayreuth.de/departments/math/org/mathe7/RIEDER/pubs/RR.pdf
roblox,
L2ParamFamily-class
UncondNeighborhood-class,
RiskType-class
#############################
## 1. Binomial data
#############################
## generate a sample of contaminated data
ind <- rbinom(100, size=1, prob=0.05)
x <- rbinom(100, size=25, prob=(1-ind)*0.25 + ind*0.9)
## ML-estimate
MLest <- MLEstimator(x, BinomFamily(size = 25))
estimate(MLest)
confint(MLest)
## compute optimally robust estimator (known contamination)
robest1 <- roptest(x, BinomFamily(size = 25), eps = 0.05, steps = 3)
estimate(robest1)
confint(robest1, method = symmetricBias())
## neglecting bias
confint(robest1)
plot(pIC(robest1))
## compute optimally robust estimator (unknown contamination)
robest2 <- roptest(x, BinomFamily(size = 25), eps.lower = 0, eps.upper = 0.2, steps = 3)
estimate(robest2)
confint(robest2, method = symmetricBias())
plot(pIC(robest2))
## total variation neighborhoods (known deviation)
robest3 <- roptest(x, BinomFamily(size = 25), eps = 0.025,
neighbor = TotalVarNeighborhood(), steps = 3)
estimate(robest3)
confint(robest3, method = symmetricBias())
plot(pIC(robest3))
## total variation neighborhoods (unknown deviation)
robest4 <- roptest(x, BinomFamily(size = 25), eps.lower = 0, eps.upper = 0.1,
neighbor = TotalVarNeighborhood(), steps = 3)
estimate(robest4)
confint(robest4, method = symmetricBias())
plot(pIC(robest4))
#############################
## 2. Poisson data
#############################
## Example: Rutherford-Geiger (1910); cf. Feller~(1968), Section VI.7 (a)
x <- c(rep(0, 57), rep(1, 203), rep(2, 383), rep(3, 525), rep(4, 532),
rep(5, 408), rep(6, 273), rep(7, 139), rep(8, 45), rep(9, 27),
rep(10, 10), rep(11, 4), rep(12, 0), rep(13, 1), rep(14, 1))
## ML-estimate
MLest <- MLEstimator(x, PoisFamily())
estimate(MLest)
confint(MLest)
## compute optimally robust estimator (unknown contamination)
robest <- roptest(x, PoisFamily(), eps.upper = 0.1, steps = 3)
estimate(robest)
confint(robest, symmetricBias())
plot(pIC(robest))
## total variation neighborhoods (unknown deviation)
robest1 <- roptest(x, PoisFamily(), eps.upper = 0.05,
neighbor = TotalVarNeighborhood(), steps = 3)
estimate(robest1)
confint(robest1, symmetricBias())
plot(pIC(robest1))
#############################
## 3. Normal (Gaussian) location and scale
#############################
## 24 determinations of copper in wholemeal flour
library(MASS)
data(chem)
plot(chem, main = "copper in wholemeal flour", pch = 20)
## ML-estimate
MLest <- MLEstimator(chem, NormLocationScaleFamily())
estimate(MLest)
confint(MLest)
## compute optimally robust estimator (known contamination)
## takes some time -> you can use package RobLox for normal
## location and scale which is optimized for speed
robest <- roptest(chem, NormLocationScaleFamily(), eps = 0.05, steps = 3)
estimate(robest)
confint(robest, symmetricBias())
plot(pIC(robest))
## plot of relative and absolute information; cf. Kohl (2005)
infoPlot(pIC(robest))
## compute optimally robust estimator (unknown contamination)
## takes some time -> use package RobLox!
robest1 <- roptest(chem, NormLocationScaleFamily(), eps.lower = 0.05,
eps.upper = 0.1, steps = 3)
estimate(robest1)
confint(robest1, symmetricBias())
plot(pIC(robest1))
## plot of relative and absolute information; cf. Kohl (2005)
infoPlot(pIC(robest1))