[Robast-commits] r119 - branches/robast-0.6/pkg/ROptEst/inst/scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 24 12:32:26 CEST 2008


Author: stamats
Date: 2008-07-24 12:32:26 +0200 (Thu, 24 Jul 2008)
New Revision: 119

Modified:
   branches/robast-0.6/pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R
Log:
adapted to new implementation

Modified: branches/robast-0.6/pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R
===================================================================
--- branches/robast-0.6/pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R	2008-07-24 10:21:49 UTC (rev 118)
+++ branches/robast-0.6/pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R	2008-07-24 10:32:26 UTC (rev 119)
@@ -9,38 +9,40 @@
 plot(N0)  # plot of Norm(mean = 0, sd = 1) and L_2 derivative
 checkL2deriv(N0)
 
-# classical optimal IC
+## classical optimal IC
 N0.IC0 <- optIC(model = N0, risk = asCov())
 N0.IC0       # show IC
 checkIC(N0.IC0)
 Risks(N0.IC0)
 plot(N0.IC0) # plot IC
 
-# L_2 family + infinitesimal neighborhood
+## L_2 family + infinitesimal neighborhood
 N0.Rob1 <- InfRobModel(center = N0, neighbor = ContNeighborhood(radius = 0.5))
 N0.Rob1     # show N0.Rob1
 
-# MSE solution
-system.time(N0.IC1 <- optIC(model = N0.Rob1, risk = asMSE()), gcFirst = TRUE)
+## MSE solution
+system.time(N0.IC1 <- optIC(model = N0.Rob1, risk = asMSE()))
 checkIC(N0.IC1)
 Risks(N0.IC1)
 plot(N0.IC1)
 infoPlot(N0.IC1)
 
-system.time(N0.IC1.i <- optIC(model = N0.Rob1, risk = asMSE(normtype=InfoNorm())), gcFirst = TRUE)
+system.time(N0.IC1.i <- optIC(model = N0.Rob1, risk = asMSE(normtype=InfoNorm())))
 checkIC(N0.IC1.i)
 Risks(N0.IC1.i)
 plot(N0.IC1.i)
 infoPlot(N0.IC1.i)
 
-system.time(N0.IC1.s <- optIC(model = N0.Rob1, risk = asMSE(normtype=SelfNorm())), gcFirst = TRUE)
+system.time(N0.IC1.s <- optIC(model = N0.Rob1, risk = asMSE(normtype=SelfNorm())))
 checkIC(N0.IC1.s)
 Risks(N0.IC1.s)
 plot(N0.IC1.s)
 infoPlot(N0.IC1.s)
 
 comparePlot(N0.IC1,N0.IC1.i,N0.IC1.s)
-# lower case solutions
+
+
+## lower case solutions
 (N0.IC2 <- optIC(model = N0.Rob1, risk = asBias(), tol = 1e-10))
 checkIC(N0.IC2)
 Risks(N0.IC2)
@@ -53,15 +55,15 @@
 plot(N0.IC2.i)
 infoPlot(N0.IC2.i)
 
-# Hampel solution
+## Hampel solution
 (N0.IC3 <- optIC(model = N0.Rob1, risk = asHampel(bound = clip(N0.IC1))))
 checkIC(N0.IC3)
 Risks(N0.IC3)
 plot(N0.IC3) 
 infoPlot(N0.IC3)
 
-# radius minimax IC
-# (may take quite some time!)
+## radius minimax IC
+## (may take quite some time!)
 (N0.IC4 <- radiusMinimaxIC(L2Fam=N0, neighbor=ContNeighborhood(), 
                 risk=asMSE(), loRad=0, upRad=Inf))
 checkIC(N0.IC4)
@@ -85,10 +87,10 @@
 infoPlot(N0.IC4.s)
 
 
-# least favorable radius
-# (may take quite some time!)
-#N0.r.rho1 <- leastFavorableRadius(L2Fam=N0, neighbor=ContNeighborhood(),
-#                    risk=asMSE(), rho=0.5)
+## least favorable radius
+## (may take quite some time!)
+N0.r.rho1 <- leastFavorableRadius(L2Fam=N0, neighbor=ContNeighborhood(),
+                    risk=asMSE(), rho=0.5)
 
 ## one-step estimation
 ## 1. generate a contaminated sample
@@ -96,13 +98,13 @@
 x <- rnorm(100, mean=0, sd=(1-ind) + ind*9)
 
 ## 2. Kolmogorov(-Smirnov) minimum distance estimator
-(est0 <- ksEstimator(x=x, Norm()))
+(est0 <- MDEstimator(x=x, NormLocationScaleFamily()))
 
 ## 3. one-step estimation: radius known
-N1 <- NormLocationScaleFamily(mean=est0$mean, sd=est0$sd)
+N1 <- NormLocationScaleFamily(mean=est0$estimate[1], sd=est0$estimate[2])
 N1.Rob <- InfRobModel(center = N1, neighbor = ContNeighborhood(radius = 0.5))
 IC1 <- optIC(model = N1.Rob, risk = asMSE())
-(est1 <- oneStepEstimator(x, IC1, est0))
+(est1 <- oneStepEstimator(x, IC1, est0$estimate))
 
 ## 4. one-step estimation: radius unknown
 ## rough estimate: 1-10% contamination
@@ -111,4 +113,4 @@
 ## takes some time
 IC2 <- radiusMinimaxIC(L2Fam=N1, neighbor=ContNeighborhood(),risk=asMSE(), 
                        loRad=0.1, upRad=1.0) 
-(est2 <- oneStepEstimator(x, IC2, est0))
+(est2 <- oneStepEstimator(x, IC2, est0$estimate))



More information about the Robast-commits mailing list