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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 10 19:16:22 CEST 2008


Author: stamats
Date: 2008-08-10 19:16:21 +0200 (Sun, 10 Aug 2008)
New Revision: 160

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

Modified: branches/robast-0.6/pkg/ROptEst/inst/scripts/ExponentialScaleModel.R
===================================================================
--- branches/robast-0.6/pkg/ROptEst/inst/scripts/ExponentialScaleModel.R	2008-08-10 16:49:24 UTC (rev 159)
+++ branches/robast-0.6/pkg/ROptEst/inst/scripts/ExponentialScaleModel.R	2008-08-10 17:16:21 UTC (rev 160)
@@ -69,20 +69,69 @@
                     risk=asMSE(), rho=1/3))
 
 ## one-step estimation
+## We use contamination neighborhoods but could also use total variation 
+## neighborhoods
 ## 1. generate a contaminated sample
 ind <- rbinom(1e2, size=1, prob=0.05) 
 E1.x <- rexp(1e2, rate=(1-ind)*2+ind*10)
 
-## 2. Kolmogorov(-Smirnov) minimum distance estimator
-(E1.est0 <- MDEstimator(x=E1.x, ExpScaleFamily()))
+## 2.1 Kolmogorov(-Smirnov) minimum distance estimator
+(E1.est01 <- MDEstimator(x=E1.x, ExpScaleFamily()))
 
-## 3. one-step estimation: radius known
-E1.Rob3 <- InfRobModel(center=ExpScaleFamily(scale=estimate(E1.est0)),
+## 2.2 Cramer-von-Mises minimum distance estimator
+(E1.est02 <- MDEstimator(x=E1.x, ExpScaleFamily(), distance = CvMDist))
+
+## 3. k-step estimation: radius known
+E1.Rob31 <- InfRobModel(center=ExpScaleFamily(scale=estimate(E1.est01)),
                 neighbor=ContNeighborhood(radius=0.5))
-E1.IC9 <- optIC(model=E1.Rob3, risk=asMSE())
-(E1.est1 <- oneStepEstimator(E1.x, IC=E1.IC9, start=E1.est0))
+E1.IC9 <- optIC(model=E1.Rob31, risk=asMSE())
+(E1.est11 <- oneStepEstimator(E1.x, IC=E1.IC9, start=E1.est01))
+(E1.est12 <- kStepEstimator(E1.x, IC=E1.IC9, start=E1.est01, steps = 3))
 
+## its simpler to use function roptest
+(E1.est13 <- roptest(E1.x, ExpScaleFamily(), eps = 0.05, distance = KolmogorovDist,
+                     steps = 3))
+
+E1.Rob32 <- InfRobModel(center=ExpScaleFamily(scale=estimate(E1.est02)),
+                neighbor=ContNeighborhood(radius=0.5))
+E1.IC10 <- optIC(model=E1.Rob32, risk=asMSE())
+(E1.est21 <- oneStepEstimator(E1.x, IC=E1.IC10, start=E1.est02))
+(E1.est22 <- kStepEstimator(E1.x, IC=E1.IC10, start=E1.est02, steps = 3))
+
+## its simpler to use function roptest
+(E1.est23 <- roptest(E1.x, ExpScaleFamily(), eps = 0.05, steps = 3))
+
+## comparison
+estimate(E1.est11)
+estimate(E1.est12)
+estimate(E1.est13)
+estimate(E1.est21)
+estimate(E1.est22)
+estimate(E1.est23)
+
+
 ## 4. one-step estimation: radius interval
-E1.IC10 <- radiusMinimaxIC(L2Fam=ExpScaleFamily(rate=1/E1.est0$estimate),
+E1.IC11 <- radiusMinimaxIC(L2Fam=ExpScaleFamily(scale=estimate(E1.est01)),
                 neighbor=ContNeighborhood(), risk=asMSE(), loRad=0, upRad=Inf)
-(E1.est2 <- oneStepEstimator(E1.x, IC=E1.IC10, start=E1.est0$estimate))
+(E1.est31 <- oneStepEstimator(E1.x, IC=E1.IC11, start=E1.est01))
+(E1.est32 <- kStepEstimator(E1.x, IC=E1.IC11, start=E1.est01, steps = 3))
+
+## its simpler to use function roptest
+(E1.est33 <- roptest(E1.x, ExpScaleFamily(), eps.upper = 0.5, distance = KolmogorovDist,
+                     steps = 3))
+
+E1.IC12 <- radiusMinimaxIC(L2Fam=ExpScaleFamily(scale=estimate(E1.est02)),
+                neighbor=ContNeighborhood(), risk=asMSE(), loRad=0, upRad=Inf)
+(E1.est41 <- oneStepEstimator(E1.x, IC=E1.IC12, start=E1.est02))
+(E1.est42 <- kStepEstimator(E1.x, IC=E1.IC12, start=E1.est02, steps = 3))
+
+## its simpler to use function roptest
+(E1.est43 <- roptest(E1.x, ExpScaleFamily(), eps.upper = 0.5, steps = 3))
+
+## comparison
+estimate(E1.est31)
+estimate(E1.est32)
+estimate(E1.est33)
+estimate(E1.est41)
+estimate(E1.est42)
+estimate(E1.est43)



More information about the Robast-commits mailing list