[Robast-commits] r315 - in branches/robast-0.7/pkg/RobRex: . inst inst/scripts man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 30 15:08:24 CEST 2009


Author: stamats
Date: 2009-06-30 15:08:24 +0200 (Tue, 30 Jun 2009)
New Revision: 315

Added:
   branches/robast-0.7/pkg/RobRex/chm/
   branches/robast-0.7/pkg/RobRex/inst/CITATION
   branches/robast-0.7/pkg/RobRex/inst/NEWS
   branches/robast-0.7/pkg/RobRex/inst/scripts/ExamplesEstimation.R
   branches/robast-0.7/pkg/RobRex/inst/scripts/ExamplesIC.R
Modified:
   branches/robast-0.7/pkg/RobRex/DESCRIPTION
   branches/robast-0.7/pkg/RobRex/man/rgsOptIC.ALs.Rd
   branches/robast-0.7/pkg/RobRex/man/rgsOptIC.BM.Rd
   branches/robast-0.7/pkg/RobRex/man/rgsOptIC.M.Rd
   branches/robast-0.7/pkg/RobRex/man/rgsOptIC.MK.Rd
   branches/robast-0.7/pkg/RobRex/man/rgsOptIC.Mc.Rd
   branches/robast-0.7/pkg/RobRex/man/rgsOptIC.Ms.Rd
Log:
merged branch and trunk

Modified: branches/robast-0.7/pkg/RobRex/DESCRIPTION
===================================================================
--- branches/robast-0.7/pkg/RobRex/DESCRIPTION	2009-06-30 13:05:57 UTC (rev 314)
+++ branches/robast-0.7/pkg/RobRex/DESCRIPTION	2009-06-30 13:08:24 UTC (rev 315)
@@ -1,17 +1,16 @@
 Package: RobRex
-Version: 0.7
-Date: 2008-11-27
+Version: 0.6.1
+Date: 2009-04-14
 Title: Optimally robust influence curves for regression and scale
 Description: functions for the determination of optimally robust
         influence curves in case of linear regression with unknown
         scale and standard normal distributed errors where the
         regressor is random.
-Depends: R (>= 2.4.0), ROptRegTS(>= 0.5.0)
+Depends: R (>= 2.4.0), ROptRegTS(>= 0.6.1)
 Author: Matthias Kohl <Matthias.Kohl at stamats.de>
 Maintainer: Matthias Kohl <Matthias.Kohl at stamats.de>
 LazyLoad: yes
 License: LGPL-3
-URL: http://www.stamats.de/RobASt.htm
-Packaged: Mon Aug 6 08:18:03 2007; kohl
+URL:  http://robast.r-forge.r-project.org/
 LastChangedDate: {$LastChangedDate$}
 LastChangedRevision: {$LastChangedRevision$}

Copied: branches/robast-0.7/pkg/RobRex/chm (from rev 308, pkg/RobRex/chm)

Copied: branches/robast-0.7/pkg/RobRex/inst/CITATION (from rev 308, pkg/RobRex/inst/CITATION)
===================================================================
--- branches/robast-0.7/pkg/RobRex/inst/CITATION	                        (rev 0)
+++ branches/robast-0.7/pkg/RobRex/inst/CITATION	2009-06-30 13:08:24 UTC (rev 315)
@@ -0,0 +1,19 @@
+if(!exists("meta") || is.null(meta)) meta <- packageDescription("RobRex")
+year <- sub("-.*", "", meta$Date)
+note <- sprintf("R package version %s", meta$Version)
+
+citHeader("To cite package RobRex in publications use:")
+
+citEntry(entry="Manual",
+         title = "RobRex: Optimally robust influence curves for regression and scale",
+         author = personList(as.person("M. Kohl")),
+         language = "English",
+         year = year,
+         note = note,
+         type = "R package",
+         url = "http://robast.r-forge.r-project.org/",
+         textVersion = paste("Kohl, M.",
+                             sprintf("(%s).", year),
+                             "RobRex: Optimally robust influence curves for regression and scale.",
+                             paste(note, ".", sep = ""),
+                             "URL http://robast.r-forge.r-project.org/"))

Copied: branches/robast-0.7/pkg/RobRex/inst/NEWS (from rev 308, pkg/RobRex/inst/NEWS)
===================================================================
--- branches/robast-0.7/pkg/RobRex/inst/NEWS	                        (rev 0)
+++ branches/robast-0.7/pkg/RobRex/inst/NEWS	2009-06-30 13:08:24 UTC (rev 315)
@@ -0,0 +1,9 @@
+###############################################################################
+##  News: to package ROptRegTS
+###############################################################################
+
+#######################################
+version 0.6.1
+#######################################
++ introduction of NEWS-file
++ update of CITATION-file (based on code provided by A. Zeileis on R help)
\ No newline at end of file

Copied: branches/robast-0.7/pkg/RobRex/inst/scripts/ExamplesEstimation.R (from rev 308, pkg/RobRex/inst/scripts/ExamplesEstimation.R)
===================================================================
--- branches/robast-0.7/pkg/RobRex/inst/scripts/ExamplesEstimation.R	                        (rev 0)
+++ branches/robast-0.7/pkg/RobRex/inst/scripts/ExamplesEstimation.R	2009-06-30 13:08:24 UTC (rev 315)
@@ -0,0 +1,91 @@
+###############################################################################
+## Optimally Robust Estimation
+###############################################################################
+
+###############################################################################
+## Example 1
+###############################################################################
+require(MASS)
+require(robustbase)
+library(ISwR)
+data(thuesen)
+attach(thuesen)
+
+## LS-estimator
+fit.LS <- lm(short.velocity ~ blood.glucose)
+## M-estimator
+fit.M <- rlm(short.velocity ~ blood.glucose)
+## MM-estimator
+fit.MM <- lmrob(short.velocity ~ blood.glucose)
+## LTS-estimator
+fit.LTS <- ltsReg(short.velocity ~ blood.glucose)
+
+## AL-estimators
+## regressor distribution: design measure
+require(RobRex)
+K <- DiscreteMVDistribution(cbind(1,blood.glucose))
+## ALc-estimator: conditional neighborhood; i.e., only y is contaminated
+## about 10 sec. on my system
+system.time(IC1 <- rgsOptIC.ALc(r = 0.5, K = K, theta = fit.M$coeff, scale = fit.M$s))
+ALc1 <- oneStepEstimator(cbind(1,as.matrix(thuesen)), IC1, c(fit.M$coeff, fit.M$s))
+## AL-estimator: unconditional neighborhood; i.e., x and y are contaminated
+## about 85 sec. on my system
+system.time(IC2 <- rgsOptIC.AL(r = 0.5, K = K, theta = fit.MM$coeff, scale = fit.MM$s))
+AL1 <- oneStepEstimator(cbind(1,as.matrix(thuesen)), IC2, c(fit.MM$coeff, fit.MM$s))
+
+## Plot
+require(RColorBrewer)
+myCol <- brewer.pal(6, "Set1")
+plot(short.velocity ~ blood.glucose, ylab = "fasting blood glucose [mmol/l]", 
+     xlab = "mean circumferential shortening velocity [%/s]", 
+     main = "Ventricular shortening velocity", pch = 20)
+abline(fit.LS, lwd = 2, col = myCol[1])
+abline(fit.M, lwd = 2, col = myCol[2])
+abline(fit.MM, lwd = 2, col = myCol[3])
+abline(fit.LTS, lwd = 2, col = myCol[4])
+lines(c(1, c(blood.glucose,25)), ALc1[1] + ALc1[2]*c(1,c(blood.glucose,25)), 
+      col = myCol[5], lwd = 2)
+lines(c(1, c(blood.glucose,25)), AL1[1] + AL1[2]*c(1,c(blood.glucose,25)), 
+      col = myCol[6], lwd = 1)
+legend("topleft", legend = c("LS", "M", "MM", "LTS", "ALc", "AL"), 
+       fill = myCol, ncol = 2)
+detach(thuesen)
+
+###############################################################################
+## Example 2
+###############################################################################
+data(phones)
+attach(phones)
+
+## LS estimator
+fit2.LS <- lm(calls ~ year)
+## M estimator
+fit2.M <- rlm(calls ~ year, maxit = 50)
+## MM estimator
+fit2.MM <- lmrob(calls ~ year)
+## LTS estimator
+fit2.LTS <- ltsReg(calls ~ year)
+
+## AL estimators
+## regressor distribution: design measure
+K <- DiscreteMVDistribution(cbind(1,year))
+## ALc estimator: only y contaminated
+system.time(IC1 <- rgsOptIC.ALc(r = 0.5, K = K, theta = fit2.M$coeff, scale = fit2.M$s))
+## takes about 9 sec. on my system
+ALc2 <- oneStepEstimator(cbind(1,year,calls), IC1, c(fit2.M$coeff, fit2.M$s))
+## AL estimator: x and y contaminated
+system.time(IC2 <- rgsOptIC.AL(r = 0.5, K = K, theta = fit2.MM$coeff, scale = fit2.MM$s))
+## takes about 80 sec. on my system
+AL2 <- oneStepEstimator(cbind(1,year,calls), IC2, c(fit2.MM$coeff, fit2.MM$s))
+
+## Plot
+plot(calls ~ year, ylab = "phone calls [Mio.]", xlab = "year", 
+     main = "Belgium Phone Calls 1950-1973", pch = 20)
+abline(fit2.LS, lwd = 2, col = "black", col = myCol[1])
+abline(fit2.M, lwd = 2, col = myCol[2])
+abline(fit2.MM, lwd = 2, col = myCol[3])
+abline(fit2.LTS, lwd = 2, col = myCol[4], lty = 2)
+lines(c(1, c(year,75)), ALc2[1] + ALc2[2]*c(1,c(year,75)), lwd = 2, col = myCol[5])
+lines(c(1, c(year,75)), AL2[1] + AL2[2]*c(1,c(year,75)), lwd = 2, col = myCol[6])
+legend("topleft", legend = c("LS", "M", "MM", "LTS", "ALc", "AL"), 
+       fill = myCol, ncol = 2)

Copied: branches/robast-0.7/pkg/RobRex/inst/scripts/ExamplesIC.R (from rev 308, pkg/RobRex/inst/scripts/ExamplesIC.R)
===================================================================
--- branches/robast-0.7/pkg/RobRex/inst/scripts/ExamplesIC.R	                        (rev 0)
+++ branches/robast-0.7/pkg/RobRex/inst/scripts/ExamplesIC.R	2009-06-30 13:08:24 UTC (rev 315)
@@ -0,0 +1,156 @@
+###############################################################################
+## Optimal Influence Curves
+###############################################################################
+
+library(RobRex)
+options("newDevice"=TRUE)
+
+###############################################################################
+## Example 1 (1-dim., discrete Regressor)
+###############################################################################
+K1 <- DiscreteDistribution(supp = 1:5)
+
+# AL-estimator
+system.time(IC.AL1 <- rgsOptIC.AL(r = 0.1, K = K1, check = TRUE), gcFirst = TRUE)
+distrExOptions(ErelativeTolerance, 1e-10)
+checkIC(IC.AL1)
+distrExOptions(ErelativeTolerance, .Machine$double.eps^0.25)
+Risks(IC.AL1)
+
+# M-estimator
+system.time(IC.M1 <- rgsOptIC.M(r = 0.1, K = K1, check = TRUE), gcFirst = TRUE)
+checkIC(IC.M1)
+Risks(IC.M1)
+
+# MK-estimator
+system.time(IC.MK1 <- rgsOptIC.MK(r = 0.1, K = K1, check = TRUE), gcFirst = TRUE)
+checkIC(IC.MK1)
+Risks(IC.MK1)
+
+# ALc-estimator
+system.time(IC.ALc1 <- rgsOptIC.ALc(r = 0.1, K = K1, check = TRUE), gcFirst = TRUE)
+checkIC(IC.ALc1)
+Risks(IC.ALc1)
+
+# Mc-estimator
+system.time(IC.Mc1 <- rgsOptIC.Mc(r = 0.1, K = K1, check = TRUE), gcFirst = TRUE)
+checkIC(IC.Mc1)
+Risks(IC.Mc1)
+
+# ALs-estimator
+system.time(IC.ALs1 <- rgsOptIC.ALs(r = 0.1, scale = 2, K = K1, check = TRUE), gcFirst = TRUE)
+checkIC(IC.ALs1)
+Risks(IC.ALs1)
+
+# Ms-estimator
+system.time(IC.Ms1 <- rgsOptIC.Ms(r = 0.1, K = K1, check = TRUE), gcFirst = TRUE)
+checkIC(IC.Ms1)
+Risks(IC.Ms1)
+
+# BM-estimator
+system.time(IC.BM1 <- rgsOptIC.BM(r = 0.1, K = K1), gcFirst = TRUE)
+checkIC(IC.BM1)
+Risks(IC.BM1)
+
+# asymptotic MSEs
+Risks(IC.AL1)$asMSE
+Risks(IC.M1)$asMSE
+Risks(IC.MK1)$asMSE
+Risks(IC.ALc1)$asMSE
+Risks(IC.Mc1)$asMSE
+Risks(IC.ALs1)$asMSE
+Risks(IC.Ms1)$asMSE
+Risks(IC.BM1)$asMSE
+
+
+###############################################################################
+## Example 2 (1-dim., abs. cont. Regressor)
+###############################################################################
+K2 <- Unif(Min = 0, Max = 1)
+
+# AL-estimator
+IC.AL2 <- rgsOptIC.AL(r = 0.1, K = K2, check = TRUE)
+#checkIC(IC.AL2, eval(CallL2Fam(IC.AL2)))
+Risks(IC.AL2)
+
+# M-estimator
+IC.M2 <- rgsOptIC.M(r = 0.1, K = K2, check = TRUE)
+#checkIC(IC.M2, eval(CallL2Fam(IC.M2)))
+Risks(IC.M2)
+
+# MK-estimator
+IC.MK2 <- rgsOptIC.MK(r = 0.1, K = K2, check = TRUE)
+#checkIC(IC.MK2, eval(CallL2Fam(IC.MK2)))
+Risks(IC.MK2)
+
+# ALc-estimator
+# only implemented for discrete distributions
+
+# Mc-estimator
+# only implemented for 1-dim. discrete distributions
+
+# ALs-estimator
+IC.ALs2 <- rgsOptIC.ALs(r = 0.1, K = K2, check = TRUE)
+#checkIC(IC.ALs2, eval(CallL2Fam(IC.ALs2)))
+Risks(IC.ALs2)
+
+# Ms-estimator
+# only implemented for 1-dim. discrete distributions
+
+# BM-estimator
+# only defined for discrete distributions
+
+
+# asymptotic MSEs
+Risks(IC.AL2)$asMSE
+Risks(IC.M2)$asMSE
+Risks(IC.MK2)$asMSE
+Risks(IC.ALs2)$asMSE
+
+
+###############################################################################
+## Example 3 (2-dim., discrete Regressor)
+###############################################################################
+K3 <- DiscreteMVDistribution(supp = matrix(c(0,1,1,1,0,2,2,0,2,1), ncol=2, byrow = TRUE))
+
+# AL-estimator
+IC.AL3 <- rgsOptIC.AL(r = 0.1, K = K3, check = TRUE)
+checkIC(IC.AL3)
+Risks(IC.AL3)
+
+# M-estimator
+IC.M3 <- rgsOptIC.M(r = 0.1, K = K3, check = TRUE)
+checkIC(IC.M3)
+Risks(IC.M3)
+
+# MK-estimator
+IC.MK3 <- rgsOptIC.MK(r = 0.1, K = K3, check = TRUE)
+checkIC(IC.MK3)
+Risks(IC.MK3)
+
+# ALc-estimator
+IC.ALc3 <- rgsOptIC.ALc(r = 0.1, K = K3, check = TRUE)
+checkIC(IC.ALc3)
+Risks(IC.ALc3)
+
+# Mc-estimator
+# only implemented for 1-dim. discrete distributions
+
+# ALs-estimator
+IC.ALs3 <- rgsOptIC.ALs(r = 0.1, K = K3, check = TRUE)
+checkIC(IC.ALs3)
+Risks(IC.ALs3)
+
+# Ms-estimator
+# only implemented for 1-dim. discrete distributions
+
+# BM-estimator
+# only defined for discrete distributions
+# and only implemented for 1-dim. discrete distributions
+
+# asymptotic MSEs
+Risks(IC.AL3)$asMSE
+Risks(IC.M3)$asMSE
+Risks(IC.MK3)$asMSE
+Risks(IC.ALc3)$asMSE
+Risks(IC.ALs3)$asMSE

Modified: branches/robast-0.7/pkg/RobRex/man/rgsOptIC.ALs.Rd
===================================================================
--- branches/robast-0.7/pkg/RobRex/man/rgsOptIC.ALs.Rd	2009-06-30 13:05:57 UTC (rev 314)
+++ branches/robast-0.7/pkg/RobRex/man/rgsOptIC.ALs.Rd	2009-06-30 13:08:24 UTC (rev 315)
@@ -39,12 +39,15 @@
 %\note{}
 \seealso{\code{ContIC-class}}
 \examples{
+## code takes some time
+\dontrun{
 K <- DiscreteDistribution(1:5) # = Unif({1,2,3,4,5})
 IC1 <- rgsOptIC.ALs(r = 0.1, K = K)
 checkIC(IC1)
 Risks(IC1)
 Infos(IC1)
 }
+}
 \concept{regression and scale}
 \concept{influence curve}
 \keyword{robust}

Modified: branches/robast-0.7/pkg/RobRex/man/rgsOptIC.BM.Rd
===================================================================
--- branches/robast-0.7/pkg/RobRex/man/rgsOptIC.BM.Rd	2009-06-30 13:05:57 UTC (rev 314)
+++ branches/robast-0.7/pkg/RobRex/man/rgsOptIC.BM.Rd	2009-06-30 13:08:24 UTC (rev 315)
@@ -43,11 +43,14 @@
 %\note{}
 \seealso{\code{CondIC-class}}
 \examples{
+## code takes some time
+\dontrun{
 K <- DiscreteDistribution(1:5) # = Unif({1,2,3,4,5})
 IC1 <- rgsOptIC.BM(r = 0.1, K = K)
 checkIC(IC1)
 Risks(IC1)
 }
+}
 \concept{regression and scale}
 \concept{influence curve}
 \keyword{robust}

Modified: branches/robast-0.7/pkg/RobRex/man/rgsOptIC.M.Rd
===================================================================
--- branches/robast-0.7/pkg/RobRex/man/rgsOptIC.M.Rd	2009-06-30 13:05:57 UTC (rev 314)
+++ branches/robast-0.7/pkg/RobRex/man/rgsOptIC.M.Rd	2009-06-30 13:08:24 UTC (rev 315)
@@ -50,11 +50,14 @@
 %\note{}
 \seealso{\code{IC-class}}
 \examples{
+## code takes some time
+\dontrun{
 K <- DiscreteDistribution(1:5) # = Unif({1,2,3,4,5})
 IC1 <- rgsOptIC.M(r = 0.1, K = K)
 checkIC(IC1)
 Risks(IC1)
 }
+}
 \concept{regression and scale}
 \concept{influence curve}
 \keyword{robust}

Modified: branches/robast-0.7/pkg/RobRex/man/rgsOptIC.MK.Rd
===================================================================
--- branches/robast-0.7/pkg/RobRex/man/rgsOptIC.MK.Rd	2009-06-30 13:05:57 UTC (rev 314)
+++ branches/robast-0.7/pkg/RobRex/man/rgsOptIC.MK.Rd	2009-06-30 13:08:24 UTC (rev 315)
@@ -42,11 +42,14 @@
 %\note{}
 \seealso{\code{IC-class}}
 \examples{
+## code takes some time
+\dontrun{
 K <- DiscreteDistribution(1:5) # = Unif({1,2,3,4,5})
 IC1 <- rgsOptIC.MK(r = 0.1, K = K)
 checkIC(IC1)
 Risks(IC1)
 }
+}
 \concept{regression and scale}
 \concept{influence curve}
 \keyword{robust}

Modified: branches/robast-0.7/pkg/RobRex/man/rgsOptIC.Mc.Rd
===================================================================
--- branches/robast-0.7/pkg/RobRex/man/rgsOptIC.Mc.Rd	2009-06-30 13:05:57 UTC (rev 314)
+++ branches/robast-0.7/pkg/RobRex/man/rgsOptIC.Mc.Rd	2009-06-30 13:08:24 UTC (rev 315)
@@ -41,11 +41,14 @@
 %\note{}
 \seealso{\code{CondIC-class}}
 \examples{
+## code takes some time
+\dontrun{
 K <- DiscreteDistribution(1:5) # = Unif({1,2,3,4,5})
 IC1 <- rgsOptIC.Mc(r = 0.1, K = K)
 checkIC(IC1)
 Risks(IC1)
 }
+}
 \concept{regression and scale}
 \concept{influence curve}
 \keyword{robust}

Modified: branches/robast-0.7/pkg/RobRex/man/rgsOptIC.Ms.Rd
===================================================================
--- branches/robast-0.7/pkg/RobRex/man/rgsOptIC.Ms.Rd	2009-06-30 13:05:57 UTC (rev 314)
+++ branches/robast-0.7/pkg/RobRex/man/rgsOptIC.Ms.Rd	2009-06-30 13:08:24 UTC (rev 315)
@@ -44,11 +44,14 @@
 %\note{}
 \seealso{\code{CondIC-class}}
 \examples{
+## code takes some time
+\dontrun{
 K <- DiscreteDistribution(1:5) # = Unif({1,2,3,4,5})
 IC1 <- rgsOptIC.Ms(r = 0.1, K = K)
 checkIC(IC1)
 Risks(IC1)
 }
+}
 \concept{regression and scale}
 \concept{influence curve}
 \keyword{robust}



More information about the Robast-commits mailing list