[Robast-commits] r1279 - pkg/ROptEst/inst/scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 6 21:20:56 CET 2024


Author: ruckdeschel
Date: 2024-02-06 21:20:56 +0100 (Tue, 06 Feb 2024)
New Revision: 1279

Modified:
   pkg/ROptEst/inst/scripts/AnscombeOrNot.R
   pkg/ROptEst/inst/scripts/BinomialModel.R
   pkg/ROptEst/inst/scripts/GammaModel.R
   pkg/ROptEst/inst/scripts/GumbelLocationModel.R
   pkg/ROptEst/inst/scripts/NbinomModel.R
   pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R
Log:
[ROptEst] trunk: in R-scripts in inst/scripts, added/updated some timings
          clarified that GumelLocationModel.R depends on RobExtremes
          (as infrastructure to this model was moved to RobExtremes in version 0.9
           i.e, ~2013....) and reset some local changes to default option values
           in distrExOptions 

Modified: pkg/ROptEst/inst/scripts/AnscombeOrNot.R
===================================================================
--- pkg/ROptEst/inst/scripts/AnscombeOrNot.R	2024-02-06 19:59:01 UTC (rev 1278)
+++ pkg/ROptEst/inst/scripts/AnscombeOrNot.R	2024-02-06 20:20:56 UTC (rev 1279)
@@ -42,7 +42,7 @@
 contnb <- ContNeighborhood(radius = 0.5)
 totvnb <- TotalVarNeighborhood(radius = 0.5)
 medianmad <- list(function(x)sign(x),function(x)sign(abs(x)-qnorm(.75)))
-### Normal location and scale --- takes ~2min:
+### Normal location and scale --- takes ~20 sec:
 system.time({print(round(mineff.ls <- checkOut(L2M = NormLocationScaleFamily(), nbd = contnb,
          extraICs = list(medmad=medianmad)),3))})
 ### Normal location
@@ -51,9 +51,9 @@
 system.time(print(round(mineff.sc <- checkOut(L2M = NormScaleFamily(), nbd = contnb),3)))
 ### Normal scale total variation
 system.time(print(round(mineff.sv <- checkOut(L2M = NormScaleFamily(), nbd = totvnb),3)))
-### Poisson(lambda=1) convex contamination:
+### Poisson(lambda=1) convex contamination: ### ~ 13 sec
 system.time(print(round(mineff.pc <- checkOut(L2M = PoisFamily(lambda = 1), nbd = contnb),3)))
-### Poisson(lambda=1) scale convex contamination:
+### Poisson(lambda=1) scale convex contamination: ~20 sec
 system.time(print(round(mineff.pv <- checkOut(L2M = PoisFamily(lambda = 1), nbd = totvnb),3)))
 
 

Modified: pkg/ROptEst/inst/scripts/BinomialModel.R
===================================================================
--- pkg/ROptEst/inst/scripts/BinomialModel.R	2024-02-06 19:59:01 UTC (rev 1278)
+++ pkg/ROptEst/inst/scripts/BinomialModel.R	2024-02-06 20:20:56 UTC (rev 1279)
@@ -160,7 +160,10 @@
 system.time(ICA <-  optIC(model=RobB1, risk=asAnscombe(),
             verbose=TRUE,lower=NULL,upper=10))
 
+#   user  system elapsed 
+#   2.75    0.00    2.76 
 
+
 #-------------------------------------------------------------------------------
 ## MSE solution
 #-------------------------------------------------------------------------------
@@ -167,7 +170,7 @@
 system.time(IC1 <- optIC(model=RobB1, risk=asMSE()))
 
 #   user  system elapsed
-#   3.62    0.00    3.62
+#   0.41    0.01    0.42 
 
 IC1
 
@@ -501,7 +504,7 @@
 system.time(IC2 <- optIC(model=RobB2, risk=asMSE()))
 
 #   user  system elapsed
-#   9.46    0.02    9.47
+#   1.03    0.01    1.05 
 
 IC2
 
@@ -1181,7 +1184,7 @@
 system.time(IC7 <- radiusMinimaxIC(L2Fam=B, neighbor=ContNeighborhood(),
                         risk=asMSE(), loRad=0, upRad=1))
 #   user  system elapsed
-#  39.39    0.02   39.45
+#   4.55    0.07    4.83 
 
 IC7
 
@@ -1297,7 +1300,7 @@
 system.time(IC8 <- radiusMinimaxIC(L2Fam=B, neighbor=TotalVarNeighborhood(),
                         risk=asMSE(), loRad=0, upRad=1))
 #   user  system elapsed
-# 163.20    0.12  168.21
+#  18.39    0.22   18.67 
 
 IC8
 
@@ -1434,7 +1437,7 @@
 #current radius:  0.6388282      inefficiency:    1.044571
 #current radius:  0.6387762      inefficiency:    1.044584
 #   user  system elapsed
-# 125.41    1.20  143.03
+#  54.50    1.11   55.92 
 
 r.rho1
 
@@ -1464,7 +1467,7 @@
 #current radius:  0.3104966      inefficiency:    1.043323
 #current radius:  0.3105373      inefficiency:    1.043323
 #   user  system elapsed
-# 431.94    2.64  483.05
+# 280.18    4.97  286.97
 r.rho2
 
 #$rho
@@ -1694,8 +1697,7 @@
 #              prob
 #prob -2.220446e-16
 #maximum deviation
-#
-     9.843168e-15
+#     9.843168e-15
 ## you can also omit step 2
 est1v2 <- roptest(x, BinomFamily(size = 25), eps = 0.025,
                   neighbor = TotalVarNeighborhood(), distance = KolmogorovDist)

Modified: pkg/ROptEst/inst/scripts/GammaModel.R
===================================================================
--- pkg/ROptEst/inst/scripts/GammaModel.R	2024-02-06 19:59:01 UTC (rev 1278)
+++ pkg/ROptEst/inst/scripts/GammaModel.R	2024-02-06 20:20:56 UTC (rev 1279)
@@ -85,6 +85,8 @@
 
 ## MSE solution
 system.time(IC1 <- optIC(model=RobG1, risk=asMSE()))
+#  user  system elapsed 
+#  18.78    0.92   19.79 
 IC1
 checkIC(IC1)
 Risks(IC1)
@@ -94,7 +96,8 @@
 
 ## lower case solutions
 system.time(IC2 <- optIC(model=RobG1, risk=asBias(), tol = 1e-10))
-IC2
+#   user  system elapsed 
+#  21.29    1.19   22.47 IC2
 checkIC(IC2)
 Risks(IC2)
 plot(IC2)
@@ -103,6 +106,8 @@
 
 ## Hampel solution
 system.time(IC3 <- optIC(model=RobG1, risk=asHampel(bound=clip(IC1))))
+#  user  system elapsed 
+#  31.73    2.24   38.50 
 IC3
 checkIC(IC3)
 Risks(IC3)
@@ -111,10 +116,13 @@
 infoPlot(IC3)
 
 ## radius minimax IC
-## takes quite some time - about 180 sec.
+## takes quite some time - about 430 sec.
 system.time(IC4 <- radiusMinimaxIC(L2Fam=G, neighbor=ContNeighborhood(), 
             risk=asMSE(), loRad=0, upRad=Inf))
+#  user  system elapsed 
+# 389.11   22.08  429.66 
 
+
 ## least favorable radius
 ## takes really long time - 33 min!
 #system.time(r.rho1 <- leastFavorableRadius(L2Fam=G, neighbor=ContNeighborhood(),
@@ -159,3 +167,6 @@
 confint(est3, symmetricBias())
 confint(est2, symmetricBias())
 confint(est4, symmetricBias())
+
+## set back defaults
+distrExOptions(ErelativeTolerance = .Machine$double.eps^0.25) # increase precision for E

Modified: pkg/ROptEst/inst/scripts/GumbelLocationModel.R
===================================================================
--- pkg/ROptEst/inst/scripts/GumbelLocationModel.R	2024-02-06 19:59:01 UTC (rev 1278)
+++ pkg/ROptEst/inst/scripts/GumbelLocationModel.R	2024-02-06 20:20:56 UTC (rev 1279)
@@ -3,7 +3,16 @@
 ## computations numerically less stable than in case of the 
 ## Exponential Scale Family
 ###############################################################################
-require(ROptEst)
+
+###############################################################################
+# NOTE: the infrastructure for the Gumbel Location Family was moved
+#       to package RobExtremes (also on CRAN) in version 0.9 (~2013)
+# it remains as a copy in this folder, as it follows the same 
+# choreography as the other ones for smoothly parametrized models 
+# in this folder
+###############################################################################
+
+if(require(RobExtremes)){
 options("newDevice"=TRUE)
 
 ## generates Gumbel Location Family with loc = 0
@@ -173,3 +182,4 @@
 confint(G0.est21, symmetricBias())
 
 distrExOptions(ElowerTruncQuantile=0) # default
+}
\ No newline at end of file

Modified: pkg/ROptEst/inst/scripts/NbinomModel.R
===================================================================
--- pkg/ROptEst/inst/scripts/NbinomModel.R	2024-02-06 19:59:01 UTC (rev 1278)
+++ pkg/ROptEst/inst/scripts/NbinomModel.R	2024-02-06 20:20:56 UTC (rev 1279)
@@ -1407,6 +1407,7 @@
 #current radius:  0.5625595      inefficiency:    1.044701 
 #   user  system elapsed 
 #  141.37   0.84  150.89
+### 630 sec
 
 ## same as for binomial????
  
@@ -1441,7 +1442,8 @@
 #current radius:  0.2866889      inefficiency:    1.044456 
 #    user  system elapsed 
 #  707.48    3.17  760.09
- 
+### 630 sec
+
 r.rho2
 
 #$rho

Modified: pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R
===================================================================
--- pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R	2024-02-06 19:59:01 UTC (rev 1278)
+++ pkg/ROptEst/inst/scripts/NormalLocationScaleModel.R	2024-02-06 20:20:56 UTC (rev 1279)
@@ -73,7 +73,7 @@
 infoPlot(N0.IC3)
 
 ## radius minimax IC
-## (may take quite some time!)
+## (may take quite some time! ~14sec)
 system.time(N0.IC4 <- radiusMinimaxIC(L2Fam=N0, neighbor=ContNeighborhood(), 
                 risk=asMSE(), loRad=0, upRad=Inf, verbose = TRUE))
 checkIC(N0.IC4)
@@ -81,6 +81,7 @@
 plot(N0.IC4) 
 infoPlot(N0.IC4)
 
+## (may take quite some time! ~20sec)
 system.time(N0.IC4.i <- radiusMinimaxIC(L2Fam=N0, neighbor=ContNeighborhood(),
                 risk=asMSE(normtype=InfoNorm()), loRad=0, upRad=Inf))
 print(N0.IC4.i)
@@ -89,7 +90,7 @@
 plot(N0.IC4.i) 
 infoPlot(N0.IC4.i)
 
-## takes extremely long time:
+## takes extremely long time: (~5000s)
 system.time(N0.IC4.s <- radiusMinimaxIC(L2Fam=N0, neighbor=ContNeighborhood(),
                 risk=asMSE(normtype=SelfNorm()), loRad=0, upRad=Inf))
 print(N0.IC4.s)



More information about the Robast-commits mailing list