[Robast-commits] r165 - in pkg: ROptEst/inst/scripts ROptEst/man RandVar/inst/doc RobAStBase/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Aug 15 11:40:24 CEST 2008
Author: stamats
Date: 2008-08-15 11:40:24 +0200 (Fri, 15 Aug 2008)
New Revision: 165
Modified:
pkg/ROptEst/inst/scripts/ExponentialScaleModel.R
pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R
pkg/ROptEst/man/radiusMinimaxIC.Rd
pkg/RandVar/inst/doc/RandVar.pdf
pkg/RobAStBase/man/IC-class.Rd
Log:
merged branch into trunk
Modified: pkg/ROptEst/inst/scripts/ExponentialScaleModel.R
===================================================================
--- pkg/ROptEst/inst/scripts/ExponentialScaleModel.R 2008-08-15 09:25:44 UTC (rev 164)
+++ pkg/ROptEst/inst/scripts/ExponentialScaleModel.R 2008-08-15 09:40:24 UTC (rev 165)
@@ -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)
Modified: pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R
===================================================================
--- pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R 2008-08-15 09:25:44 UTC (rev 164)
+++ pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R 2008-08-15 09:40:24 UTC (rev 165)
@@ -92,6 +92,17 @@
N0.r.rho1 <- leastFavorableRadius(L2Fam=N0, neighbor=ContNeighborhood(),
risk=asMSE(), rho=0.5)
+
+library(ROptEst)
+library(MASS)
+data(chem)
+initial.est <- c(median(chem), mad(chem))
+system.time(ROest1 <- roptest(chem, NormLocationScaleFamily(), eps.upper = 0.05, steps = 3L,
+ initial.est = initial.est))
+
+library(RobLox)
+system.time(ROest2 <- roblox(chem, eps.upper = 0.05, k = 3, returnIC = TRUE))
+
## one-step estimation
## 1. generate a contaminated sample
ind <- rbinom(100, size=1, prob=0.05)
Modified: pkg/ROptEst/man/radiusMinimaxIC.Rd
===================================================================
--- pkg/ROptEst/man/radiusMinimaxIC.Rd 2008-08-15 09:25:44 UTC (rev 164)
+++ pkg/ROptEst/man/radiusMinimaxIC.Rd 2008-08-15 09:40:24 UTC (rev 165)
@@ -12,7 +12,7 @@
\S4method{radiusMinimaxIC}{L2ParamFamily,UncondNeighborhood,asGRisk}(
L2Fam, neighbor, risk, loRad, upRad, z.start = NULL, A.start = NULL,
- upper = 1e5, maxiter = 100, tol = .Machine$double.eps^0.4,
+ upper = 1e5, maxiter = 50, tol = .Machine$double.eps^0.4,
warn = FALSE, verbose = FALSE)
}
\arguments{
Modified: pkg/RandVar/inst/doc/RandVar.pdf
===================================================================
(Binary files differ)
Modified: pkg/RobAStBase/man/IC-class.Rd
===================================================================
--- pkg/RobAStBase/man/IC-class.Rd 2008-08-15 09:25:44 UTC (rev 164)
+++ pkg/RobAStBase/man/IC-class.Rd 2008-08-15 09:40:24 UTC (rev 165)
@@ -12,7 +12,7 @@
\alias{evalIC,IC,numeric-method}
\alias{evalIC,IC,matrix-method}
\alias{infoPlot,IC-method}
-\alias{plot,IC-method}
+\alias{plot,IC,ANY-method}
\alias{show,IC-method}
\title{Influence curve}
More information about the Robast-commits
mailing list