[Robast-commits] r122 - 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 16:04:04 CEST 2008
Author: stamats
Date: 2008-07-24 16:04:03 +0200 (Thu, 24 Jul 2008)
New Revision: 122
Modified:
branches/robast-0.6/pkg/ROptEst/inst/scripts/GumbelLocationModel.R
Log:
adapted to new implementation
Modified: branches/robast-0.6/pkg/ROptEst/inst/scripts/GumbelLocationModel.R
===================================================================
--- branches/robast-0.6/pkg/ROptEst/inst/scripts/GumbelLocationModel.R 2008-07-24 13:11:52 UTC (rev 121)
+++ branches/robast-0.6/pkg/ROptEst/inst/scripts/GumbelLocationModel.R 2008-07-24 14:04:03 UTC (rev 122)
@@ -7,25 +7,24 @@
## generates Gumbel Location Family with loc = 0
## (known scale = 1)
-distrExOptions(ElowerTruncQuantile, 1e-15) # non-finite function value in integrate
-G0 <- GumbelLocationFamily(loc=0, scale=1)
+distrExOptions(ElowerTruncQuantile = 1e-15) # 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
checkL2deriv(G0)
-# classical optimal IC
+## classical optimal IC
G0.IC0 <- optIC(model = G0, risk = asCov())
G0.IC0 # show IC
plot(G0.IC0) # plot IC
checkIC(G0.IC0)
-Risks(G0.IC0)
-# L_2 family + infinitesimal neighborhood
+## L_2 family + infinitesimal neighborhood
G0.Rob1 <- InfRobModel(center = G0, neighbor = ContNeighborhood(radius = 0.5))
G0.Rob1 # show G0.Rob1
G0.Rob2 <- InfRobModel(center = G0, neighbor = TotalVarNeighborhood(radius = 0.5))
-# MSE solution
+## MSE solution
E1.Rob1 <- InfRobModel(center = ExpScaleFamily(), neighbor = ContNeighborhood(radius = 0.5))
(E1.IC1 <- optIC(model=E1.Rob1, risk=asMSE()))
G0.IC1 <- optIC(model=G0.Rob1, risk=asMSE())
@@ -37,7 +36,8 @@
clip(G0.IC1)
cent(G0.IC1)
stand(G0.IC1)
-# alternatively
+
+## alternatively
G0.IC11 <- E1.IC1 # rate = 1!
CallL2Fam(G0.IC11) <- call("GumbelLocationFamily")
cent(G0.IC11) <- -cent(E1.IC1)
@@ -47,7 +47,6 @@
E1.Rob2 <- InfRobModel(center = ExpScaleFamily(), neighbor = TotalVarNeighborhood(radius = 0.5))
E1.IC2 <- optIC(model=E1.Rob2, risk=asMSE())
-#distrExOptions(ElowerTruncQuantile, 1e-15)
G0.IC2 <- optIC(model=G0.Rob2, risk=asMSE())
checkIC(G0.IC2)
Risks(G0.IC2)
@@ -57,7 +56,7 @@
clipLo(G0.IC2)
clipUp(G0.IC2)
stand(G0.IC2)
-# alternatively
+## alternatively
G0.IC21 <- E1.IC2 # rate = 1!
CallL2Fam(G0.IC21) <- call("GumbelLocationFamily")
clipLo(G0.IC21) <- -clipUp(E1.IC2)
@@ -66,7 +65,7 @@
checkIC(G0.IC21)
Risks(G0.IC21)
-# lower case solutions
+## lower case solutions
(G0.IC3 <- optIC(model=G0.Rob1, risk=asBias()))
checkIC(G0.IC3)
Risks(G0.IC3)
@@ -74,7 +73,7 @@
checkIC(G0.IC4)
Risks(G0.IC4)
-# Hampel solution
+## Hampel solution
(G0.IC5 <- optIC(model=G0.Rob1, risk=asHampel(bound=clip(G0.IC1))))
checkIC(G0.IC5)
Risks(G0.IC5)
@@ -82,25 +81,25 @@
checkIC(G0.IC6)
Risks(G0.IC6)
-# radius minimax IC
-# numerically instable for small 'loRad'!
-# => use connection to ExpScaleFamily for computations
-#(G0.IC7 <- radiusMinimaxIC(L2Fam=G0, neighbor=ContNeighborhood(),
-# risk=asMSE(), loRad=0.5, upRad=1.0))
-#checkIC(G0.IC7)
-#Risks(G0.IC7)
-#(G0.IC8 <- radiusMinimaxIC(L2Fam=G0, neighbor=TotalVarNeighborhood(),
-# risk=asMSE(), loRad=0.5, upRad=1.0))
-#checkIC(G0.IC8)
-#Risks(G0.IC8)
+## radius minimax IC
+## numerically instable for small 'loRad'!
+## => use connection to ExpScaleFamily for computations
+(G0.IC7 <- radiusMinimaxIC(L2Fam=G0, neighbor=ContNeighborhood(),
+ risk=asMSE(), loRad=0.5, upRad=1.0))
+checkIC(G0.IC7)
+Risks(G0.IC7)
+(G0.IC8 <- radiusMinimaxIC(L2Fam=G0, neighbor=TotalVarNeighborhood(),
+ risk=asMSE(), loRad=0.5, upRad=1.0))
+checkIC(G0.IC8)
+Risks(G0.IC8)
-# least favorable radius
-# numerically instable!
-# => use connection to ExpScaleFamily for computations
-#(G0.r.rho1 <- leastFavorableRadius(L2Fam=G0, neighbor=ContNeighborhood(),
-# risk=asMSE(), rho=0.5))
-#(G0.r.rho2 <- leastFavorableRadius(L2Fam=G0, neighbor=TotalVarNeighborhood(),
-# risk=asMSE(), rho=1/3))
+## least favorable radius
+## numerically instable!
+## => use connection to ExpScaleFamily for computations
+(G0.r.rho1 <- leastFavorableRadius(L2Fam=G0, neighbor=ContNeighborhood(),
+ risk=asMSE(), rho=0.5))
+(G0.r.rho2 <- leastFavorableRadius(L2Fam=G0, neighbor=TotalVarNeighborhood(),
+ risk=asMSE(), rho=1/3))
## one-step estimation
## 1. generate a contaminated sample
@@ -108,24 +107,24 @@
G0.x <- rgumbel(1e2, loc=(1-ind)*0.5+ind*1)
## 2. Kolmogorov(-Smirnov) minimum distance estimator
-(G0.est0 <- ksEstimator(x=G0.x, Gumbel(), param = "loc"))
+(G0.est0 <- MDEstimator(x=G0.x, GumbelLocationFamily(), interval = c(0, 5)))
## 3. one-step estimation: radius known
-G0.Rob3 <- InfRobModel(center=GumbelLocationFamily(loc=G0.est0$loc),
- neighbor=ContNeighborhood(radius=0.5))
+G0.Rob3 <- InfRobModel(center=GumbelLocationFamily(loc=G0.est0$estimate),
+ neighbor=ContNeighborhood(radius=0.5))
G0.IC9 <- optIC(model=G0.Rob3, risk=asMSE())
-(G0.est1 <- oneStepEstimator(G0.x, IC=G0.IC9, start=G0.est0$loc))
+(G0.est1 <- oneStepEstimator(G0.x, IC=G0.IC9, start=G0.est0$estimate))
## 4. M estimation: radius known
G0.Rob31 <- InfRobModel(center=GumbelLocationFamily(loc=0),
- neighbor=ContNeighborhood(radius=0.5))
+ 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$loc),
+G0.IC10 <- radiusMinimaxIC(L2Fam=GumbelLocationFamily(loc=G0.est0$estimate),
neighbor=ContNeighborhood(), risk=asMSE(), loRad=0.5, upRad=1)
-(G0.est2 <- oneStepEstimator(G0.x, IC=G0.IC10, start=G0.est0$loc))
+(G0.est2 <- oneStepEstimator(G0.x, IC=G0.IC10, start=G0.est0$estimate))
## 6. M estimation: radius interval
G0.IC101 <- radiusMinimaxIC(L2Fam=GumbelLocationFamily(),
More information about the Robast-commits
mailing list