[Robast-commits] r109 - in branches/robast-0.6/pkg/RobLox: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 21 14:39:08 CEST 2008


Author: stamats
Date: 2008-07-21 14:39:08 +0200 (Mon, 21 Jul 2008)
New Revision: 109

Modified:
   branches/robast-0.6/pkg/RobLox/R/rlOptIC.R
   branches/robast-0.6/pkg/RobLox/R/rlsOptIC_AL.R
   branches/robast-0.6/pkg/RobLox/R/roblox.R
   branches/robast-0.6/pkg/RobLox/R/rsOptIC.R
   branches/robast-0.6/pkg/RobLox/man/roblox.Rd
Log:
adapted RobLox to the changes made in ROptEst

Modified: branches/robast-0.6/pkg/RobLox/R/rlOptIC.R
===================================================================
--- branches/robast-0.6/pkg/RobLox/R/rlOptIC.R	2008-07-21 12:01:18 UTC (rev 108)
+++ branches/robast-0.6/pkg/RobLox/R/rlOptIC.R	2008-07-21 12:39:08 UTC (rev 109)
@@ -10,11 +10,20 @@
     A <- sd^2*A1
 
     if(computeIC){
+        w <- new("HampelWeight")
+        clip(w) <- b
+        cent(w) <- 0
+        stand(w) <- as.matrix(A)
+        weight(w) <- getweight(w, neighbor = ContNeighborhood(radius = r), 
+                               biastype = symmetricBias(), 
+                               normW = NormType())
+
         return(generateIC(neighbor = ContNeighborhood(radius = r), 
                     L2Fam = NormLocationFamily(mean = mean, sd = sd), 
                     res = list(A = as.matrix(A), a = 0, b = b, d = NULL, 
                                risk = list(asMSE = A, asBias = b, asCov = A - r^2*b^2), 
-                               info = c("rlOptIC", "optimally robust IC for AL estimators and 'asMSE'"))))
+                               info = c("rlOptIC", "optimally robust IC for AL estimators and 'asMSE'"),
+                               w = w, biastype = symmetricBias(), normtype = NormType())))
     }else{
         return(list(A = A, a = 0, b = b))
     }

Modified: branches/robast-0.6/pkg/RobLox/R/rlsOptIC_AL.R
===================================================================
--- branches/robast-0.6/pkg/RobLox/R/rlsOptIC_AL.R	2008-07-21 12:01:18 UTC (rev 108)
+++ branches/robast-0.6/pkg/RobLox/R/rlsOptIC_AL.R	2008-07-21 12:39:08 UTC (rev 109)
@@ -127,11 +127,20 @@
 
 
     if(computeIC){
+        w <- new("HampelWeight")
+        clip(w) <- b
+        cent(w) <- c(0, a2)
+        stand(w) <- A
+        weight(w) <- getweight(w, neighbor = ContNeighborhood(radius = r), 
+                               biastype = symmetricBias(), 
+                               normW = NormType())
+
         return(generateIC(neighbor = ContNeighborhood(radius = r), 
                     L2Fam = NormLocationScaleFamily(mean = mean, sd = sd), 
-                    res = list(A = A, a = a, b = b, d = NULL, 
-                               risk = list(asMSE = mse, asBias = b, asCov = mse - r^2*b^2), 
-                               info = c("rlsOptIC.AL", "optimally robust IC for AL estimators and 'asMSE'"))))
+                    res = list(A = as.matrix(A), a = a, b = b, d = NULL, 
+                               risk = list(asMSE = mse, asBias = b, trAsCov = mse - r^2*b^2), 
+                               info = c("rlOptIC", "optimally robust IC for AL estimators and 'asMSE'"),
+                               w = w, biastype = symmetricBias(), normtype = NormType())))
     }else{
         return(list(A = A, a = a, b = b))
     }

Modified: branches/robast-0.6/pkg/RobLox/R/roblox.R
===================================================================
--- branches/robast-0.6/pkg/RobLox/R/roblox.R	2008-07-21 12:01:18 UTC (rev 108)
+++ branches/robast-0.6/pkg/RobLox/R/roblox.R	2008-07-21 12:39:08 UTC (rev 109)
@@ -242,11 +242,19 @@
                                           "and 'asMSE'")),
                                   ncol = 2, dimnames = list(NULL, c("method", "message")))
             if(returnIC){
+                w <- new("HampelWeight")
+                clip(w) <- b
+                cent(w) <- a/A2
+                stand(w) <- diag(c(A1, A2))
+                weight(w) <- getweight(w, neighbor = ContNeighborhood(radius = r), 
+                                       biastype = symmetricBias(), 
+                                       normW = NormType())
                 IC1 <- generateIC(neighbor = ContNeighborhood(radius = r), 
                                   L2Fam = NormLocationScaleFamily(mean = mean, sd = sd), 
                                   res = list(A = diag(c(A1, A2)), a = a, b = b, d = NULL, 
                                       risk = list(asMSE = mse, asBias = b, asCov = mse - r^2*b^2), 
-                                      info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'")))
+                                      info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'"),
+                                      w = w, biastype = symmetricBias(), normtype = NormType()))
                 return(structure(list("estimate" = robEst, "steps" = k, "Infos" = Info.matrix, "optIC" = IC1), 
                                  class = c("ALEstimate", "Estimate")))
             }else
@@ -296,11 +304,19 @@
                                   paste("maximum MSE-inefficiency: ", round(ineff, 3), sep = "")), 
                                   ncol = 2, dimnames = list(NULL, c("method", "message")))
             if(returnIC){
+                w <- new("HampelWeight")
+                clip(w) <- b
+                cent(w) <- a/A2
+                stand(w) <- diag(c(A1, A2))
+                weight(w) <- getweight(w, neighbor = ContNeighborhood(radius = r), 
+                                       biastype = symmetricBias(), 
+                                       normW = NormType())
                 IC1 <- generateIC(neighbor = ContNeighborhood(radius = r), 
                                   L2Fam = NormLocationScaleFamily(mean = mean, sd = sd), 
                                   res = list(A = diag(c(A1, A2)), a = a, b = b, d = NULL, 
                                       risk = list(asMSE = mse, asBias = b, asCov = mse - r^2*b^2), 
-                                      info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'")))
+                                      info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'"),
+                                      w = w, biastype = symmetricBias(), normtype = NormType()))
                 Infos(IC1) <- matrix(c(rep("roblox", 3), 
                                       paste("radius-minimax IC for contamination interval [", 
                                         round(eps.lower, 3), ", ", round(eps.upper, 3), "]", sep = ""),
@@ -341,11 +357,19 @@
                                               "and 'asMSE'")),
                                       ncol = 2, dimnames = list(NULL, c("method", "message")))
                 if(returnIC){
+                    w <- new("HampelWeight")
+                    clip(w) <- b
+                    cent(w) <- 0
+                    stand(w) <- A
+                    weight(w) <- getweight(w, neighbor = ContNeighborhood(radius = r), 
+                                       biastype = symmetricBias(), 
+                                       normW = NormType())
                     IC1 <- generateIC(neighbor = ContNeighborhood(radius = r), 
                                       L2Fam = NormLocationFamily(mean = mean, sd = sd), 
                                       res = list(A = as.matrix(A), a = 0, b = b, d = NULL, 
                                           risk = list(asMSE = A, asBias = b, asCov = b^2), 
-                                          info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'")))
+                                          info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'"),
+                                          w = w, biastype = symmetricBias(), normtype = NormType()))
                     return(structure(list("estimate" = robEst, "steps" = k, "Infos" = Info.matrix, "optIC" = IC1),
                                  class = c("ALEstimate", "Estimate")))
                 }else
@@ -387,11 +411,19 @@
                                       paste("maximum MSE-inefficiency: ", round(ineff, 3), sep = "")), 
                                       ncol = 2, dimnames = list(NULL, c("method", "message")))
                 if(returnIC){
+                    w <- new("HampelWeight")
+                    clip(w) <- b
+                    cent(w) <- 0
+                    stand(w) <- A
+                    weight(w) <- getweight(w, neighbor = ContNeighborhood(radius = r), 
+                                       biastype = symmetricBias(), 
+                                       normW = NormType())
                     IC1 <- generateIC(neighbor = ContNeighborhood(radius = r), 
                                       L2Fam = NormLocationFamily(mean = mean, sd = sd), 
                                       res = list(A = as.matrix(A), a = 0, b = b, d = NULL, 
                                           risk = list(asMSE = A, asBias = b, asCov = b^2), 
-                                          info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'")))
+                                          info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'"),
+                                          w = w, biastype = symmetricBias(), normtype = NormType()))
                     Infos(IC1) <- matrix(c(rep("roblox", 3), 
                                  paste("radius-minimax IC for contamination interval [", 
                                    round(eps.lower, 3), ", ", round(eps.upper, 3), "]", sep = ""),
@@ -437,11 +469,19 @@
                                               "and 'asMSE'")),
                                       ncol = 2, dimnames = list(NULL, c("method", "message")))
                 if(returnIC){
+                    w <- new("HampelWeight")
+                    clip(w) <- b
+                    cent(w) <- a/A
+                    stand(w) <- A
+                    weight(w) <- getweight(w, neighbor = ContNeighborhood(radius = r), 
+                                       biastype = symmetricBias(), 
+                                       normW = NormType())
                     IC1 <- generateIC(neighbor = ContNeighborhood(radius = r), 
                                       L2Fam = NormScaleFamily(mean = mean, sd = sd), 
                                       res = list(A = as.matrix(A), a = a, b = b, d = NULL, 
                                           risk = list(asMSE = A, asBias = b, asCov = b^2), 
-                                          info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'")))
+                                          info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'"),
+                                          w = w, biastype = symmetricBias(), normtype = NormType()))
                     return(structure(list("estimate" = robEst, "steps" = k, "Infos" = Info.matrix, "optIC" = IC1),
                                  class = c("ALEstimate", "Estimate")))
                 }else
@@ -485,11 +525,19 @@
                                       paste("maximum MSE-inefficiency: ", round(ineff, 3), sep = "")), 
                                       ncol = 2, dimnames = list(NULL, c("method", "message")))
                 if(returnIC){
+                    w <- new("HampelWeight")
+                    clip(w) <- b
+                    cent(w) <- a/A
+                    stand(w) <- A
+                    weight(w) <- getweight(w, neighbor = ContNeighborhood(radius = r), 
+                                       biastype = symmetricBias(), 
+                                       normW = NormType())
                     IC1 <- generateIC(neighbor = ContNeighborhood(radius = r), 
                                       L2Fam = NormScaleFamily(mean = mean, sd = sd), 
                                       res = list(A = as.matrix(A), a = a, b = b, d = NULL, 
                                           risk = list(asMSE = A, asBias = b, asCov = b^2), 
-                                          info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'")))
+                                          info = c("roblox", "optimally robust IC for AL estimators and 'asMSE'"),
+                                          w = w, biastype = symmetricBias(), normtype = NormType()))
                     Infos(IC1) <- matrix(c(rep("roblox", 3), 
                                  paste("radius-minimax IC for contamination interval [", 
                                    round(eps.lower, 3), ", ", round(eps.upper, 3), "]", sep = ""),

Modified: branches/robast-0.6/pkg/RobLox/R/rsOptIC.R
===================================================================
--- branches/robast-0.6/pkg/RobLox/R/rsOptIC.R	2008-07-21 12:01:18 UTC (rev 108)
+++ branches/robast-0.6/pkg/RobLox/R/rsOptIC.R	2008-07-21 12:39:08 UTC (rev 109)
@@ -62,11 +62,20 @@
     A <- sd^2*A1
 
     if(computeIC){
+        w <- new("HampelWeight")
+        clip(w) <- b
+        cent(w) <- z
+        stand(w) <- as.matrix(A)
+        weight(w) <- getweight(w, neighbor = ContNeighborhood(radius = r), 
+                               biastype = symmetricBias(), 
+                               normW = NormType())
+
         return(generateIC(neighbor = ContNeighborhood(radius = r), 
-                    L2Fam = NormScaleFamily(mean = mean, sd = sd), 
+                    L2Fam = NormScaleFamily(sd = sd, mean = mean), 
                     res = list(A = as.matrix(A), a = a, b = b, d = NULL, 
                                risk = list(asMSE = A, asBias = b, asCov = A - r^2*b^2), 
-                               info = c("rsOptIC", "optimally robust IC for AL estimators and 'asMSE'"))))
+                               info = c("rlOptIC", "optimally robust IC for AL estimators and 'asMSE'"),
+                               w = w, biastype = symmetricBias(), normtype = NormType())))
     }else{
         return(list(A = A, a = a, b = b))
     }

Modified: branches/robast-0.6/pkg/RobLox/man/roblox.Rd
===================================================================
--- branches/robast-0.6/pkg/RobLox/man/roblox.Rd	2008-07-21 12:01:18 UTC (rev 108)
+++ branches/robast-0.6/pkg/RobLox/man/roblox.Rd	2008-07-21 12:39:08 UTC (rev 109)
@@ -90,8 +90,7 @@
 
 ## amount of gross errors known
 res1 <- roblox(x, eps = 0.05, returnIC = TRUE)
-res1$mean
-res1$sd
+res1$estimate
 res1$optIC
 checkIC(res1$optIC)
 Risks(res1$optIC)
@@ -101,8 +100,7 @@
 
 ## amount of gross errors unknown
 res2 <- roblox(x, eps.lower = 0.01, eps.upper = 0.1, returnIC = TRUE)
-res2$mean
-res2$sd
+res2$estimate
 res2$optIC
 checkIC(res2$optIC)
 Risks(res2$optIC)
@@ -118,10 +116,10 @@
 c(median(x), mad(x))
 
 # optimally robust (amount of gross errors known)
-c(res1$mean, res1$sd)
+res1$estimate
 
 # optimally robust (amount of gross errors unknown)
-c(res2$mean, res2$sd)
+res2$estimate
 
 # Kolmogorov(-Smirnov) minimum distance estimator (robust)
 (ks.est <- MDEstimator(x, ParamFamily = NormLocationScaleFamily(), distance = KolmogorovDist))



More information about the Robast-commits mailing list