[Robast-commits] r180 - in pkg/ROptEst: . inst/scripts
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Oct 24 06:53:05 CEST 2008
Author: stamats
Date: 2008-10-24 06:53:05 +0200 (Fri, 24 Oct 2008)
New Revision: 180
Modified:
pkg/ROptEst/DESCRIPTION
pkg/ROptEst/inst/scripts/GumbelLocationModel.R
Log:
Gumbel model seems to work properly now ...
Modified: pkg/ROptEst/DESCRIPTION
===================================================================
--- pkg/ROptEst/DESCRIPTION 2008-10-23 14:38:56 UTC (rev 179)
+++ pkg/ROptEst/DESCRIPTION 2008-10-24 04:53:05 UTC (rev 180)
@@ -1,6 +1,6 @@
Package: ROptEst
Version: 0.6.1
-Date: 2008-10-20
+Date: 2008-10-24
Title: Optimally robust estimation
Description: Optimally robust estimation using S4 classes and methods
Depends: R(>= 2.4.0), methods, distr(>= 2.0), distrEx(>= 2.0), distrMod(>= 2.0), RandVar(>= 0.6.4), RobAStBase
Modified: pkg/ROptEst/inst/scripts/GumbelLocationModel.R
===================================================================
--- pkg/ROptEst/inst/scripts/GumbelLocationModel.R 2008-10-23 14:38:56 UTC (rev 179)
+++ pkg/ROptEst/inst/scripts/GumbelLocationModel.R 2008-10-24 04:53:05 UTC (rev 180)
@@ -7,7 +7,7 @@
## generates Gumbel Location Family with loc = 0
## (known scale = 1)
-distrExOptions(ElowerTruncQuantile = 1e-15) # non-finite function value in integrate
+distrExOptions(ElowerTruncQuantile = 1e-7) # non-finite function value in integrate
G0 <- GumbelLocationFamily(loc = 0, scale = 1)
G0 # show G0
plot(G0) # plot of Gumbel(loc = 0, scale = 1) and L_2 derivative
@@ -107,28 +107,56 @@
G0.x <- rgumbel(1e2, loc=(1-ind)*0.5+ind*1)
## 2. Kolmogorov(-Smirnov) minimum distance estimator
-(G0.est0 <- MDEstimator(x=G0.x, GumbelLocationFamily(), interval = c(0, 5)))
+(G0.est01 <- MDEstimator(x=G0.x, GumbelLocationFamily()))
-## 3. one-step estimation: radius known
-G0.Rob3 <- InfRobModel(center=GumbelLocationFamily(loc=G0.est0$estimate),
+## 3. Cramer von Mises minimum distance estimator
+(G0.est02 <- MDEstimator(x=G0.x, GumbelLocationFamily(), distance = CvMDist))
+
+## 4. one-step estimation: radius known
+G0.Rob3 <- InfRobModel(center=GumbelLocationFamily(loc=estimate(G0.est02)),
neighbor=ContNeighborhood(radius=0.5))
G0.IC9 <- optIC(model=G0.Rob3, risk=asMSE())
-(G0.est1 <- oneStepEstimator(G0.x, IC=G0.IC9, start=G0.est0$estimate))
+(G0.est1 <- oneStepEstimator(G0.x, IC=G0.IC9, start=G0.est02))
-## 4. M estimation: radius known
+## 5. k-step estimation: radius known
+(G0.est2 <- kStepEstimator(G0.x, IC=G0.IC9, start=G0.est02, steps = 3))
+
+## 6. M estimation: radius known
G0.Rob31 <- InfRobModel(center=GumbelLocationFamily(loc=0),
neighbor=ContNeighborhood(radius=0.5))
G0.IC91 <- optIC(model=G0.Rob31, risk=asMSE())
(G0.est11 <- locMEstimator(G0.x, IC=G0.IC91))
-## 5. one-step estimation: radius interval
-G0.IC10 <- radiusMinimaxIC(L2Fam=GumbelLocationFamily(loc=G0.est0$estimate),
+## 7. one-step estimation: radius interval
+G0.IC10 <- radiusMinimaxIC(L2Fam=GumbelLocationFamily(loc=estimate(G0.est02)),
neighbor=ContNeighborhood(), risk=asMSE(), loRad=0.5, upRad=1)
-(G0.est2 <- oneStepEstimator(G0.x, IC=G0.IC10, start=G0.est0$estimate))
+(G0.est3 <- oneStepEstimator(G0.x, IC=G0.IC10, start=G0.est02))
-## 6. M estimation: radius interval
+## 8. k-step estimation: radius interval
+(G0.est4 <- kStepEstimator(G0.x, IC=G0.IC10, start=G0.est02, steps = 3))
+
+## 9. M estimation: radius interval
G0.IC101 <- radiusMinimaxIC(L2Fam=GumbelLocationFamily(),
neighbor=ContNeighborhood(), risk=asMSE(), loRad=0.5, upRad=1)
(G0.est21 <- locMEstimator(G0.x, IC=G0.IC101))
+## 10. It's easier to use function roptest for k-step (k >= 1) estimation!
+sqrtn <- sqrt(length(G0.x))
+G0.est5 <- roptest(G0.x, eps.lower = 0.5/sqrtn, eps.upper = 1/sqrtn,
+ L2Fam = GumbelLocationFamily())
+G0.est6 <- roptest(G0.x, eps.lower = 0.5/sqrtn, eps.upper = 1/sqrtn,
+ L2Fam = GumbelLocationFamily(), steps = 3)
+
+## comparison - radius known
+estimate(G0.est1)
+estimate(G0.est2)
+estimate(G0.est11)
+
+## comparison - radius interval
+estimate(G0.est3)
+estimate(G0.est5)
+estimate(G0.est4)
+estimate(G0.est6)
+estimate(G0.est21)
+
distrExOptions(ElowerTruncQuantile=0) # default
More information about the Robast-commits
mailing list