[Robast-commits] r424 - in branches/robast-0.8/pkg/ROptEst: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 6 17:59:20 CEST 2010


Author: ruckdeschel
Date: 2010-09-06 17:59:20 +0200 (Mon, 06 Sep 2010)
New Revision: 424

Modified:
   branches/robast-0.8/pkg/ROptEst/R/cniperCont.R
   branches/robast-0.8/pkg/ROptEst/man/cniperCont.Rd
Log:
ROptEst: filled Feature Request #919 / cniperPointPlot now digests arbitrary plot arguments.

Modified: branches/robast-0.8/pkg/ROptEst/R/cniperCont.R
===================================================================
--- branches/robast-0.8/pkg/ROptEst/R/cniperCont.R	2010-09-06 12:48:04 UTC (rev 423)
+++ branches/robast-0.8/pkg/ROptEst/R/cniperCont.R	2010-09-06 15:59:20 UTC (rev 424)
@@ -50,7 +50,9 @@
 setMethod("cniperPointPlot", signature(L2Fam = "L2ParamFamily", 
                                    neighbor = "ContNeighborhood",
                                    risk = "asMSE"),
-    function(L2Fam, neighbor, risk, lower, upper, n = 101){
+    function(L2Fam, neighbor, risk, lower, upper, n = 101, ...){
+        dots <- as.list(match.call(call = sys.call(sys.parent(1)), 
+                       expand.dots = FALSE)$"...")
         D <- trafo(L2Fam at param)
         tr.invF <- sum(diag(D %*% solve(FisherInfo(L2Fam)) %*% t(D)))
         psi <- optIC(model = L2Fam, risk = asCov())
@@ -61,12 +63,44 @@
             y <- evalIC(psi, x) 
             tr.invF + as.vector(y %*% y)*neighbor at radius^2 - maxMSE
         }
-        x <- seq(from = lower, to = upper, length = n)
-        y <- sapply(x, fun)
-        plot(x, y, type = "l", main = "Cniper point plot", 
-             xlab = "Dirac point", ylab = "Asymptotic MSE difference (classic - robust)")
+        dots$x <- x <- seq(from = lower, to = upper, length = n)
+        dots$y <- sapply(x, fun)
+        colSet <- ltySet <- lwdSet <- FALSE
+        if(!is.null(dots$col)) {colSet <- TRUE; colo <- eval(dots$col)}
+        if(colSet) {
+           colo <- rep(colo,length.out=2)          
+           dots$col <- colo[1]
+        }
+        if(!is.null(dots$lwd)) {lwdSet <- TRUE; lwdo <- eval(dots$lwd)}
+        if(lwdSet) {
+           lwdo <- rep(lwdo,length.out=2)
+           dots$lwd <- lwdo[1]
+        }
+        if(!is.null(dots$lty)) {ltySet <- TRUE; ltyo <- eval(dots$lty)}
+        if(ltySet && ((!is.numeric(ltyo) && length(ltyo)==1)||
+                        is.numeric(ltyo))){          
+           ltyo <- list(ltyo,ltyo)
+           dots$lty <- ltyo[[1]]
+        }else{ if (ltySet && !is.numeric(ltyo) && length(ltyo)==2){
+                   dots$lty <- ltyo[[1]]
+            }
+        }
+        if(is.null(dots$main)) dots$main <- gettext("Cniper point plot")
+        if(is.null(dots$xlab)) dots$xlab <- gettext("Dirac point")
+        if(is.null(dots$ylab)) 
+            dots$ylab <- gettext("Asymptotic MSE difference (classic - robust)")
+        dots$type <- "l"
+        do.call(plot, dots)
 #        text(min(x), max(y)/2, "Robust", pos = 4)
 #        text(min(x), min(y)/2, "Classic", pos = 4)
-        abline(h = 0)
+        dots$x <- dots$y <- dots$xlab <- dots$ylab <- dots$main <- dots$type <- NULL
+        dots$h <- 0
+        if(colSet) dots$col <- colo[2]
+        if(lwdSet) dots$lwd <- lwdo[2]
+        if(ltySet) dots$lty <- ltyo[[2]]
+        do.call(abline, dots)
         invisible()
     })
+#
+#cniperPointPlot(L2Fam=N0, neighbor=ContNeighborhood(radius = 0.5), risk=asMSE(),lower=-12, n =30, upper=8, lwd=c(2,4),lty=list(c(5,1),3),col=c(2,4))
+ 
\ No newline at end of file

Modified: branches/robast-0.8/pkg/ROptEst/man/cniperCont.Rd
===================================================================
--- branches/robast-0.8/pkg/ROptEst/man/cniperCont.Rd	2010-09-06 12:48:04 UTC (rev 423)
+++ branches/robast-0.8/pkg/ROptEst/man/cniperCont.Rd	2010-09-06 15:59:20 UTC (rev 424)
@@ -27,7 +27,7 @@
 
 cniperPointPlot(L2Fam, neighbor, risk, ...)
 \S4method{cniperPointPlot}{L2ParamFamily,ContNeighborhood,asMSE}(L2Fam, 
-      neighbor, risk, lower, upper, n = 101)
+      neighbor, risk, lower, upper, n = 101, ...)
 }
 \arguments{
   \item{IC1}{ object of class \code{IC} }
@@ -35,7 +35,7 @@
   \item{L2Fam}{ object of class \code{L2ParamFamily} }
   \item{neighbor}{ object of class \code{Neighborhood} }
   \item{risk}{ object of class \code{RiskType} }
-  \item{\dots}{ additional parameters. }
+  \item{\dots}{ additional parameters (in particular to be passed on to \code{plot}). }
   \item{lower, upper}{ the lower and upper end points of the 
           contamination interval. }
   \item{n}{ number of points between \code{lower} and \code{upper}}
@@ -51,7 +51,12 @@
 
   As such points might be difficult to find, we provide the
   function \code{cniperPointPlot} which can be used to obtain a plot
-  of the risk difference.
+  of the risk difference; in this function the usual arguments for
+  \code{plot} can be used. For arguments \code{col}, \code{lwd},
+  vectors can be used; then the first coordinate is taken for the
+  curve, the second one for the balancing line. For argument \code{lty},
+  a list can be used; its first component is then taken for the
+  curve, the second one for the balancing line.
 
   For more details about cniper contamination and cniper points we refer 
   to Section~3.5 of Kohl et al. (2008) as well as Ruckdeschel (2004) and 



More information about the Robast-commits mailing list