[Robast-commits] r127 - in branches/robast-0.6/pkg/RobAStBase: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 28 09:12:46 CEST 2008


Author: stamats
Date: 2008-07-28 09:12:46 +0200 (Mon, 28 Jul 2008)
New Revision: 127

Modified:
   branches/robast-0.6/pkg/RobAStBase/R/oneStepEstimator.R
   branches/robast-0.6/pkg/RobAStBase/man/oneStepEstimator.Rd
Log:
adapted to new implementation of class "Estimate" in package distrMod

Modified: branches/robast-0.6/pkg/RobAStBase/R/oneStepEstimator.R
===================================================================
--- branches/robast-0.6/pkg/RobAStBase/R/oneStepEstimator.R	2008-07-28 06:14:58 UTC (rev 126)
+++ branches/robast-0.6/pkg/RobAStBase/R/oneStepEstimator.R	2008-07-28 07:12:46 UTC (rev 127)
@@ -8,18 +8,12 @@
         nrvalues <- dimension(IC at Curve)
         if(is.list(start)) start <- unlist(start)
         if(nrvalues != length(start))
-            stop("length of 'start' != dimension of 'Curve'")
+            stop("dimension of 'start' != dimension of 'Curve'")
 
         res <- start + rowMeans(evalIC(IC, as.matrix(x)), na.rm = TRUE)
 
         return(res)
     })
-setMethod("oneStepEstimator", signature(x = "numeric", 
-                                        IC = "InfluenceCurve",
-                                        start = "list"),
-    function(x, IC, start){
-        return(oneStepEstimator(x, IC, unlist(start)))
-    })
 setMethod("oneStepEstimator", signature(x = "matrix", 
                                         IC = "InfluenceCurve",
                                         start = "numeric"),
@@ -27,7 +21,7 @@
         nrvalues <- dimension(IC at Curve)
         if(is.list(start)) start <- unlist(start)
         if(nrvalues != length(start))
-            stop("length of 'start' != dimension of 'Curve'")
+            stop("dimension of 'start' != dimension of 'Curve'")
         if(ncol(x) != IC at Curve[[1]]@Domain at dimension)
             stop("'x' has wrong dimension")
 
@@ -35,9 +29,33 @@
 
         return(res)
     })
+setMethod("oneStepEstimator", signature(x = "numeric", 
+                                        IC = "InfluenceCurve",
+                                        start = "Estimate"),
+    function(x, IC, start){
+        nrvalues <- dimension(IC at Curve)
+        start0 <- estimate(start)
+        if(is.list(start0)) start0 <- unlist(start0)
+        if(nrvalues != length(start0))
+            stop("dimension of slot 'estimate' of 'start' != dimension of 'Curve'")
+
+        res <- start0 + rowMeans(evalIC(IC, as.matrix(x)), na.rm = TRUE)
+
+        return(res)
+    })
 setMethod("oneStepEstimator", signature(x = "matrix", 
                                         IC = "InfluenceCurve",
-                                        start = "list"),
+                                        start = "Estimate"),
     function(x, IC, start){
-        return(oneStepEstimator(x, IC, unlist(start)))
+        nrvalues <- dimension(IC at Curve)
+        start0 <- estimate(start)
+        if(is.list(start0)) start0 <- unlist(start0)
+        if(nrvalues != length(start0))
+            stop("dimension of slot 'estimate' of 'start' != dimension of 'Curve'")
+        if(ncol(x) != IC at Curve[[1]]@Domain at dimension)
+            stop("'x' has wrong dimension")
+
+        res <- start0 + rowMeans(evalIC(IC, x), na.rm = TRUE)
+
+        return(res)
     })

Modified: branches/robast-0.6/pkg/RobAStBase/man/oneStepEstimator.Rd
===================================================================
--- branches/robast-0.6/pkg/RobAStBase/man/oneStepEstimator.Rd	2008-07-28 06:14:58 UTC (rev 126)
+++ branches/robast-0.6/pkg/RobAStBase/man/oneStepEstimator.Rd	2008-07-28 07:12:46 UTC (rev 127)
@@ -2,9 +2,9 @@
 \alias{oneStepEstimator}
 \alias{oneStepEstimator-methods}
 \alias{oneStepEstimator,numeric,InfluenceCurve,numeric-method}
-\alias{oneStepEstimator,numeric,InfluenceCurve,list-method}
 \alias{oneStepEstimator,matrix,InfluenceCurve,numeric-method}
-\alias{oneStepEstimator,matrix,InfluenceCurve,list-method}
+\alias{oneStepEstimator,numeric,InfluenceCurve,Estimate-method}
+\alias{oneStepEstimator,matrix,InfluenceCurve,Estimate-method}
 
 \title{Generic function for the computation of one-step estimators}
 \description{
@@ -28,12 +28,12 @@
 \describe{
   \item{x = "numeric", IC = "InfluenceCurve", start = "numeric"}{ 
     univariate samples. }
-  \item{x = "numeric", IC = "InfluenceCurve", start = "list"}{ 
-    univariate samples. }
   \item{x = "matrix", IC = "InfluenceCurve", start = "numeric"}{ 
     multivariate samples. }
-  \item{x = "matrix", IC = "InfluenceCurve", start = "list"}{ 
+  \item{x = "matrix", IC = "InfluenceCurve", start = "Estimate"}{ 
     multivariate samples. }
+  \item{x = "matrix", IC = "InfluenceCurve", start = "Estimate"}{ 
+    multivariate samples. }
 }}
 \references{
   Rieder, H. (1994) \emph{Robust Asymptotic Statistics}. New York: Springer.
@@ -47,4 +47,5 @@
 %\examples{}
 \concept{one-step estimator}
 \concept{estimator}
-\keyword{}
+\keyword{univar}
+\keyword{robust}



More information about the Robast-commits mailing list