[Robast-commits] r205 - pkg/ROptEst/inst/scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 3 07:33:23 CET 2008


Author: stamats
Date: 2008-11-03 07:33:23 +0100 (Mon, 03 Nov 2008)
New Revision: 205

Modified:
   pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R
Log:
some small additions, seem to work correctly ...

Modified: pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R
===================================================================
--- pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R	2008-11-03 06:32:29 UTC (rev 204)
+++ pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R	2008-11-03 06:33:23 UTC (rev 205)
@@ -92,17 +92,6 @@
 N0.r.rho1 <- leastFavorableRadius(L2Fam=N0, neighbor=ContNeighborhood(),
                     risk=asMSE(), rho=0.5)
 
-
-library(ROptEst)
-library(MASS)
-data(chem)
-initial.est <- c(median(chem), mad(chem))
-system.time(ROest1 <- roptest(chem, NormLocationScaleFamily(), eps.upper = 0.05, steps = 3L, 
-                           initial.est = initial.est))
-
-library(RobLox)
-system.time(ROest2 <- roblox(chem, eps.upper = 0.05, k = 3, returnIC = TRUE))
-
 ## one-step estimation
 ## 1. generate a contaminated sample
 ind <- rbinom(100, size=1, prob=0.05) 
@@ -125,3 +114,23 @@
 IC2 <- radiusMinimaxIC(L2Fam=N1, neighbor=ContNeighborhood(),risk=asMSE(), 
                        loRad=0.1, upRad=1.0) 
 (est2 <- oneStepEstimator(x, IC2, est0$estimate))
+
+
+## a simple example
+library(MASS)
+data(chem)
+initial.est <- c(median(chem), mad(chem))
+system.time(ROest1 <- roptest(chem, NormLocationScaleFamily(), eps.upper = 0.1, steps = 3L, 
+                              initial.est = initial.est, useLast = TRUE))
+
+## optimized for speed
+library(RobLox)
+system.time(ROest2 <- roblox(chem, eps.upper = 0.1, k = 3, returnIC = TRUE))
+
+## comparison
+estimate(ROest1)
+estimate(ROest2)
+
+## confidence intervals
+confint(ROest1, symmetricBias())
+confint(ROest2, symmetricBias())



More information about the Robast-commits mailing list