[Robast-commits] r294 - in pkg/ROptEst: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 22 11:23:59 CEST 2009


Author: stamats
Date: 2009-04-22 11:23:58 +0200 (Wed, 22 Apr 2009)
New Revision: 294

Modified:
   pkg/ROptEst/DESCRIPTION
   pkg/ROptEst/R/roptest.R
   pkg/ROptEst/inst/NEWS
   pkg/ROptEst/man/0ROptEst-package.Rd
   pkg/ROptEst/man/roptest.Rd
Log:
added argument fsCor to function roptest enabling a finite-sample correction of the radius ...

Modified: pkg/ROptEst/DESCRIPTION
===================================================================
--- pkg/ROptEst/DESCRIPTION	2009-04-21 18:02:54 UTC (rev 293)
+++ pkg/ROptEst/DESCRIPTION	2009-04-22 09:23:58 UTC (rev 294)
@@ -1,6 +1,6 @@
 Package: ROptEst
 Version: 0.7
-Date: 2009-04-14
+Date: 2009-04-22
 Title: Optimally robust estimation
 Description: Optimally robust estimation in general smoothly
         parameterized models using S4 classes and methods.

Modified: pkg/ROptEst/R/roptest.R
===================================================================
--- pkg/ROptEst/R/roptest.R	2009-04-21 18:02:54 UTC (rev 293)
+++ pkg/ROptEst/R/roptest.R	2009-04-22 09:23:58 UTC (rev 294)
@@ -1,8 +1,8 @@
 ###############################################################################
 ## Optimally robust estimation
 ###############################################################################
-roptest <- function(x, L2Fam, eps, eps.lower, eps.upper, initial.est, 
-                    neighbor = ContNeighborhood(), risk = asMSE(), steps = 1, 
+roptest <- function(x, L2Fam, eps, eps.lower, eps.upper, fsCor = 1, initial.est, 
+                    neighbor = ContNeighborhood(), risk = asMSE(), steps = 1L, 
                     distance = CvMDist, startPar = NULL, verbose = FALSE, 
                     useLast = getRobAStBaseOption("kStepUseLast"), ...){
     es.call <- match.call()
@@ -41,6 +41,11 @@
         if((eps < 0) || (eps > 0.5))
             stop("'eps' has to be in (0, 0.5]")
     }
+    if(fsCor <= 0)
+        stop("'fsCor' has to be positive")
+    if(length(fsCor) != 1){
+        stop("'fsCor' has to be of length 1")
+    }
     if(!is.integer(steps))
         steps <- as.integer(steps)
     if(steps < 1){
@@ -66,9 +71,13 @@
         r.upper <- sqrtn*eps.upper
         ICstart <- radiusMinimaxIC(L2Fam = L2FamStart, neighbor = neighbor, risk = risk, 
                                    loRad = r.lower, upRad = r.upper, verbose = verbose)
+        if(!isTRUE(all.equal(fsCor, 1, tol = 1e-3))){
+            neighbor at radius <- neighborRadius(ICstart)*fsCor
+            infMod <- InfRobModel(center = L2FamStart, neighbor = neighbor)
+            ICstart <- optIC(model = infMod, risk = risk, verbose = verbose)
+        }    
     }else{
-        r <- sqrtn*eps
-        neighbor at radius <- r
+        neighbor at radius <- sqrtn*eps*fsCor
         infMod <- InfRobModel(center = L2FamStart, neighbor = neighbor)
         ICstart <- optIC(model = infMod, risk = risk, verbose = verbose)
     }

Modified: pkg/ROptEst/inst/NEWS
===================================================================
--- pkg/ROptEst/inst/NEWS	2009-04-21 18:02:54 UTC (rev 293)
+++ pkg/ROptEst/inst/NEWS	2009-04-22 09:23:58 UTC (rev 294)
@@ -3,6 +3,11 @@
 ###############################################################################
 
 #######################################
+version 0.7
+#######################################
++ added finite-sample correction factor to function roptest
+
+#######################################
 version 0.6.2
 #######################################
 + added functions to compute and plot cniper contamination and cniper points, 

Modified: pkg/ROptEst/man/0ROptEst-package.Rd
===================================================================
--- pkg/ROptEst/man/0ROptEst-package.Rd	2009-04-21 18:02:54 UTC (rev 293)
+++ pkg/ROptEst/man/0ROptEst-package.Rd	2009-04-22 09:23:58 UTC (rev 294)
@@ -13,7 +13,7 @@
 \tabular{ll}{
 Package: \tab ROptEst\cr
 Version: \tab 0.7 \cr
-Date: \tab 2009-04-14 \cr
+Date: \tab 2009-04-22 \cr
 Depends: \tab R(>= 2.7.0), methods, distr(>= 2.0), distrEx(>= 2.0),distrMod(>= 2.0), RandVar(>= 0.6.4), RobAStBase\cr
 LazyLoad: \tab yes\cr
 License: \tab LGPL-3\cr

Modified: pkg/ROptEst/man/roptest.Rd
===================================================================
--- pkg/ROptEst/man/roptest.Rd	2009-04-21 18:02:54 UTC (rev 293)
+++ pkg/ROptEst/man/roptest.Rd	2009-04-22 09:23:58 UTC (rev 294)
@@ -6,8 +6,8 @@
   parametric families via k-step construction.
 }
 \usage{
-roptest(x, L2Fam, eps, eps.lower, eps.upper, initial.est, 
-        neighbor = ContNeighborhood(), risk = asMSE(), steps = 1, 
+roptest(x, L2Fam, eps, eps.lower, eps.upper, fsCor = 1, initial.est, 
+        neighbor = ContNeighborhood(), risk = asMSE(), steps = 1L, 
         distance = CvMDist, startPar = NULL, verbose = FALSE, 
         useLast = getRobAStBaseOption("kStepUseLast"), ...)
 }
@@ -20,6 +20,8 @@
         lower bound for the amount of gross errors. See details below. }
   \item{eps.upper}{ positive real (\code{eps.lower} <= \code{eps.upper} <= 0.5): 
         upper bound for the amount of gross errors. See details below. }
+  \item{fsCor}{ positive real: factor used to correct the neighborhood radius;
+        see details. }
   \item{initial.est}{ initial estimate for unknown parameter. If missing 
         minimum distance estimator is computed. }
   \item{neighbor}{ object of class \code{"UncondNeighborhood"} }
@@ -65,6 +67,14 @@
   If \code{eps} is missing, the radius-minimax estimator in sense of 
   Rieder et al. (2001, 2008), respectively Section 2.2 of Kohl (2005) is returned.
 
+  Finite-sample and higher order results suggest that the asymptotically
+  optimal procedure is to liberal. Using \code{fsCor} the radius can be
+  modified - as a rule enlarged - to obtain a more conservative estimate.
+  In case of normal location and scale there is function 
+  \code{\link[RobLox]{finiteSampleCorrection}} which returns a finite-sample 
+  corrected (enlarged) radius based on the results of large Monte-Carlo
+  studies.
+
   The default value of argument \code{useLast} is set by the
   global option \code{kStepUseLast} which by default is set to 
   \code{FALSE}. In case of general models \code{useLast} 
@@ -194,6 +204,17 @@
 ## plot of relative and absolute information; cf. Kohl (2005)
 infoPlot(pIC(robest))
 
+## finite-sample correction
+if(require(RobLox)){
+    n <- length(chem)
+    r <- 0.05*sqrt(n)
+    r.fi <- finiteSampleCorrection(n = n, r = r)
+    fsCor <- r.fi/r
+    robest <- roptest(chem, NormLocationScaleFamily(), eps = 0.05, 
+                      fsCor = fsCor, steps = 3)
+    estimate(robest)
+}
+
 ## compute optimally robust estimator (unknown contamination)
 ## takes some time -> use package RobLox!
 robest1 <- roptest(chem, NormLocationScaleFamily(), eps.lower = 0.05, 



More information about the Robast-commits mailing list