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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Aug 8 09:36:56 CEST 2008


Author: stamats
Date: 2008-08-08 09:36:56 +0200 (Fri, 08 Aug 2008)
New Revision: 155

Modified:
   branches/robast-0.6/pkg/ROptEst/inst/scripts/BinomialModel.R
Log:
adapted to new implementation, seems to work ...

Modified: branches/robast-0.6/pkg/ROptEst/inst/scripts/BinomialModel.R
===================================================================
--- branches/robast-0.6/pkg/ROptEst/inst/scripts/BinomialModel.R	2008-08-07 13:35:16 UTC (rev 154)
+++ branches/robast-0.6/pkg/ROptEst/inst/scripts/BinomialModel.R	2008-08-08 07:36:56 UTC (rev 155)
@@ -103,6 +103,11 @@
                     risk=asMSE(), rho=0.5))
 r.rho2
 
+
+###############################################################################
+## k-step (k >= 1) estimation
+###############################################################################
+
 ## one-step estimation
 ## 1. generate a contaminated sample
 ind <- rbinom(100, size=1, prob=0.05) 
@@ -169,7 +174,7 @@
 
 ## 3.2. k-step estimation: radius known
 IC9 <- optIC(model=RobB3, risk=asMSE())
-(est2c <- kStepEstimator(x, IC=IC9, start=est0, steps = 3L)
+(est2c <- kStepEstimator(x, IC=IC9, start=est0, steps = 3L))
 
 est2c1 <- roptest(x, BinomFamily(size = 25), eps = 0.05, initial.est = est0, steps = 3L)
 checkIC(pIC(est2c1))
@@ -193,6 +198,26 @@
 (est2v <- kStepEstimator(x, IC=IC10, start=est0, steps = 3L))
 checkIC(pIC(est2v))
 
+est2v1 <- roptest(x, BinomFamily(size = 25), eps = 0.025, initial.est = est0, 
+                  steps = 3L, neighbor = TotalVarNeighborhood())
+checkIC(pIC(est2v1))
+
+est2v2 <- roptest(x, BinomFamily(size = 25), eps = 0.025, steps = 3L,
+                  distance = KolmogorovDist, neighbor = TotalVarNeighborhood())
+checkIC(pIC(est2v2))
+
+## Using Cramer-von-Mises MD estimator
+est2v3 <- roptest(x, BinomFamily(size = 25), eps = 0.025, steps = 3L, 
+                  neighbor = TotalVarNeighborhood())
+checkIC(pIC(est2v3))
+
+## comparison of estimates
+estimate(est2v)
+estimate(est2v1)
+estimate(est2v2)
+estimate(est2v3)
+
+
 ## 4.1. one-step estimation: radius interval
 IC11 <- radiusMinimaxIC(L2Fam=BinomFamily(size=25, prob=estimate(est0)),
                 neighbor=ContNeighborhood(), risk=asMSE(), loRad=0, upRad=Inf)
@@ -205,9 +230,9 @@
 checkIC(pIC(est3v))
 
 ## maximum radius for given sample size n: sqrt(n)*0.5
-est3c1 <- roptest(x, BinomFamily(size = 25), eps.upper = 0.5)
+(est3c1 <- roptest(x, BinomFamily(size = 25), eps.upper = 0.5))
 checkIC(pIC(est3c1))
-est3v1 <- roptest(x, BinomFamily(size = 25), eps.upper = 0.5, neighbor = TotalVarNeighborhood())
+(est3v1 <- roptest(x, BinomFamily(size = 25), eps.upper = 0.5, neighbor = TotalVarNeighborhood()))
 checkIC(pIC(est3v1))
 
 ## 4.2. k-step estimation: radius interval
@@ -222,8 +247,8 @@
 checkIC(pIC(est4v))
 
 ## maximum radius for given sample size n: sqrt(n)*0.5
-est4c1 <- roptest(x, BinomFamily(size = 25), eps.upper = 0.5, steps = 3L)
+(est4c1 <- roptest(x, BinomFamily(size = 25), eps.upper = 0.5, steps = 3L))
 checkIC(pIC(est4c1))
-est4v1 <- roptest(x, BinomFamily(size = 25), eps.upper = 0.5, neighbor = TotalVarNeighborhood(),
-        steps = 3L)
-checkIC(pIC(est4v1)
+(est4v1 <- roptest(x, BinomFamily(size = 25), eps.upper = 0.5, neighbor = TotalVarNeighborhood(),
+        steps = 3L))
+checkIC(pIC(est4v1))



More information about the Robast-commits mailing list